User:PedroM/global.js

function work(href) { var anchor = ""; if (href.indexOf("#") != -1) {     href = href.split("#"); anchor = "#" + href[1]; href = href[0]; }   if (href.indexOf("?") != -1) return href + "&useskin=monobook&handheld=yes" + anchor; else return href + "?useskin=monobook&handheld=yes" + anchor; }

function noscript(event) { if (event.url.indexOf("http://community.wikia.com") == -1) event.preventDefault; } function run { if(navigator.userAgent.indexOf("3DS") != -1){ document.addEventListener("beforeload", noscript, true); if(window.location.href.indexOf("useskin=monobook&handheld=yes") == -1) window.location = work(window.location.href); $("a[href^='/'],a[href*='.wikia.com/']").each(function{     $(this).attr("href", work($(this).attr("href")));    }); } } addOnloadHook(run);