User:Chocohead/common.js

function poker(titles) { titles.each(function(i, item) {		$(item).click(function { $($(this).find(".mw-collapsible-toggle")[0]).trigger("click"); });	}); }

function poke { poker($("th.navbox-title")); if ($(".simple-navbox").length) {//Pray nothing else uses this mw.hook("wikipage.content").add(function(bits) {			console.log("Look, it just got hooked");			poker(bits.find("th.navbox-title"));			if (!($(".simple-navbox").length)) {				console.log("All lazy navboxes opened, unhooking");				mw.hook("wikipage.content").remove(this); //Might work			}		}); $(".simple-navbox").each(function(i, item) {			$($(item).find("th.navbox-title")[0]).click(function(e) { e.preventDefault; var button = $(this).parent, body = button.closest(".load-page"); new mw.Api.get({					action: "parse",					prop: "text",					page: body.data("page")				}).done(function(data) {					body.html(data.parse.text["*"]);					mw.hook("wikipage.content").fire(body);				}); });		});	} }

$(document).ready(poke);