User:PedroM/global.js

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

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("useskin=") == -1) { return href + "&useskin=monobook&handheld=yes" + anchor; } else return href + anchor; } else return href + "?useskin=monobook&handheld=yes" + anchor; } if(navigator.userAgent.indexOf("3DS") != -1) { if(window.location.href.indexOf("useskin=") == -1) window.location = work(window.location.href); $(function run{   var links = document.getElementsByTagName("a");    for (i=0; i<links.length; i++)      if ( links[i].href.indexOf("/wiki/") != -1 )        links[i].href = work(links[i].href);  }); }