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) { if (href.indexOf("n=wikiamob") == -1) { return href + "&useskin=wikiamobile" + anchor; } else return href + anchor; } else return href + "?useskin=wikiamobile" + anchor; }

if(window.location.href.indexOf("n=wikiamob") == -1) window.location.href = work(window.location.href);

addPortletLink ('p-cactions', '/wiki/' + mw.html.escape(wgPageName) + '?useskin=wikiamobile', 'mobile');