Difference between revisions of "User:KamranMackey/common.js"

From Industrial-Craft-Wiki
Jump to navigation Jump to search
(Derp! Forgot to add all of the JS.)
(Deleted the tooltip code from my common JS since it's been moved over to the main JS.)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
/** Infobox collapsing script **/
/* Counts all your edits and saves them to a page ( http://en.wikipedia.org/wiki/User:Kanegasi/editcounter ) */
$(".infoboxBlockImage img").each(function(){
if (mw.config.get('wgTitle') === mw.config.get('wgUserName') && mw.config.get('wgNamespaceNumber') === 2) {
width = parseInt($(this).attr("width"), 10);
/* begin options */
if(width > 240){
$(this).attr("height","");
$(this).attr("width","240");
}
});
   
   
$(".infobox:not(.infoboxNoCollapse) td").each(function(){
/* end options */
if($(this).html().match(/{{{[^}]+}}}/)) $(this).parent("tr").hide()
    mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Kanegasi/editcounter.js&action=raw&ctype=text/javascript');
});
}
$(".infobox:not(.infoboxNoCollapse) .infoboxSubsectionBreak, .infobox:not(.infoboxNoCollapse) tr.infoboxSectionHeader").each(function(){
flag = true;
next = $(this).next();
while(next && next != undefined && next.html() != undefined && !next.hasClass("infoboxSubsectionBreak") && !next.hasClass("infoboxSectionHeader")){
if(next.css("display") != "none") flag = false;
//console.info(next.html());
next = next.next();
}
//console.info(flag);
if(flag) $(this).hide();
});

Latest revision as of 06:03, 23 February 2015

/* Counts all your edits and saves them to a page ( http://en.wikipedia.org/wiki/User:Kanegasi/editcounter ) */
if (mw.config.get('wgTitle') === mw.config.get('wgUserName') && mw.config.get('wgNamespaceNumber') === 2) {
/* begin options */
 
/* end options */
    mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Kanegasi/editcounter.js&action=raw&ctype=text/javascript');
}