725
edits
Changes
From The Bakugan Wiki
no edit summary
//syntax highlighter
mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=text/javascript');
/*
Tabber fix from GBF Wiki
*/
function checkExist(selector, cb) {
var i = 0;
var handler = setInterval(function() {
i += 1;
if (i > 4) clearInterval(handler);
if (document.querySelector(selector)) {
cb.call();
clearInterval(handler);
}
}, 1000);
}
checkExist('.tabbernav', function() {
$('div .tabbernav a').each( function() {
$(this).click( function(e) {
e.stopPropagation();
// https://github.com/HydraWiki/Tabber/blob/a499360d0d8081eed24bb8dfcbe3bc1e212e7301/js/tabber.js#L25
function showContent( title, tabber ) {
var tabContent = $(tabber).closest('.tabber').children('.tabbertab');
var nav = $(tabber).children('.tabbernav');
var content = tabContent.filter( '[title="' + title + '"]' );
if ( content.length !== 1 ) { return false; }
tabContent.hide();
content.show();
nav.find( '.tabberactive' ).removeClass( 'tabberactive' );
nav.find( 'a[title="' + title + '"]' ).parent().addClass( 'tabberactive' );
return true;
}
var tabber = $(this).closest('.tabber');
var title = $(this).attr('title');
showContent(title, tabber);
});
});
});
//
Mobile Tooltip Hover/Touch Fix
Prevent link from opening when you first tap a link with tooltip.
Tapping the link again opens the link.
//
(function () {
document.addEventListener("touchstart", function() {
$(".tooltip.hover").removeClass("hover");
});
$(".tooltip").on('touchstart', function (e) {
if (!$(this).hasClass("hover")) {
e.preventDefault();
e.stopPropagation();
$(".tooltip.hover").removeClass("hover");
$(this).addClass("hover");
}
});
})();