User:Handheld/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 + "&handheld=yes" + anchor; else return href + "?handheld=yes" + anchor; } function run{ if(navigator.userAgent.indexOf("3DS") != -1){ if(window.location.href.indexOf("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);