Difference between revisions of "User:KamranMackey/common.js"
Jump to navigation
Jump to search
KamranMackey (talk | contribs) |
KamranMackey (talk | contribs) (Derp! Forgot to add all of the JS.) |
||
Line 6: | Line 6: | ||
$(this).attr("width","240"); | $(this).attr("width","240"); | ||
} | } | ||
}); | |||
$(".infobox:not(.infoboxNoCollapse) td").each(function(){ | |||
if($(this).html().match(/{{{[^}]+}}}/)) $(this).parent("tr").hide() | |||
}); | |||
$(".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(); | |||
}); | }); |
Revision as of 02:19, 21 February 2015
/** Infobox collapsing script **/ $(".infoboxBlockImage img").each(function(){ width = parseInt($(this).attr("width"), 10); if(width > 240){ $(this).attr("height",""); $(this).attr("width","240"); } }); $(".infobox:not(.infoboxNoCollapse) td").each(function(){ if($(this).html().match(/{{{[^}]+}}}/)) $(this).parent("tr").hide() }); $(".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(); });