User:0icke0/common.js

From Terraria Wiki
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.
const elems = document.querySelectorAll(".gamepedia_pro_user");
elems.forEach(function (elem) {
	elem.classList.remove("gamepedia_pro_user");
});

document.getElementById("bodyContent").style.width="100%";

//Reorder to put infobox on top of page.
const contents = document.getElementsByClassName("mw-parser-output");
for (var i=0; i<contents.length; i++) {
	const content = contents[i];
	var child = undefined;
	if (content.children[1] && content.children[1].className.toString().indexOf("infobox") !== -1) {
		child = content.children[1];
	} else if (content.children[2] && content.children[2].className.toString().indexOf("infobox") !== -1) {
		child = content.children[2];
	}
	if (child !== undefined) {
		content.removeChild(child);
		content.prepend(child);
	}
}