User:KamranMackey/common.js

From Industrial-Craft-Wiki
< User:KamranMackey
Revision as of 02:19, 21 February 2015 by KamranMackey (talk | contribs) (Derp! Forgot to add all of the JS.)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/** 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();
});