User:Creidieki/monobook.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure of whether the code is safe, you can ask at the help desk.
function openAdahLinks(kk) { var as = document.getElementsByTagName('a'); var k = 0; for (n=0; n<as.length; n++) { if (as[n].innerHTML == 'diff') { if (k <= kk) { window.open(as[n].href, '_blank'); } k++; } } } function addAdahLinks() { if (wgCanonicalNamespace == 'Special' && wgCanonicalSpecialPageName == 'Watchlist') { var as = document.getElementsByTagName('a'); var k = 0; for (n=0; n<as.length; n++) { if (as[n].innerHTML == 'diff') { var tn = document.createTextNode(') ('); var link = document.createElement('a'); link.href = 'javascript:openAdahLinks(' + (k++) + ')'; link.appendChild(document.createTextNode('adah'), null); as[n].parentNode.insertBefore(tn , as[n].nextSibling.nextSibling); as[n].parentNode.insertBefore(link , as[n].nextSibling.nextSibling); } } } } addOnloadHook(addAdahLinks); function externISBN() { var magicURL = "http://www.amazon.com/exec/obidos/ASIN/MAGICNUMBER/wikipedia08-20"; var magicRegex = /MAGICNUMBER/ig; if(wgPageName != "Special:Booksources" && wgPageName != "Wikipedia:Book_sources"){ for (var i = 0; i < document.links.length; i++) { if( document.links[i].href.match(/isbn=(.*)/) ) { document.links[i].href=magicURL.replace(magicRegex, RegExp.$1); } } } } addOnloadHook(externISBN); // adds a 'logs for this page' link to the navigation bar // if the page is a user's page, talk page or subpage, the link will go to logs for the user instead // if the page is a special page, then no link is displayed addOnloadHook(function () { // if this is a user, show the logs for the user rather than the page if ( wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk" ) { url = wgServer + "/w/index.php?title=Special:Log&user=" + wgTitle.split("/")[0]; } else if ( wgCanonicalNamespace == "Special" ) { // don't display link for special pages return; } else { url = wgServer + "/w/index.php?title=Special:Log&page=" + wgPageName; } addPortletLink("p-tb", url, "Logs", "pt-logs"); }); // // adds a 'random redirect' link to the toolbox addOnloadHook(function () { url = wgServer + "/w/index.php?title=Special:RandomRedirect"; addPortletLink("p-tb", url, "Random Redirect", "pt-randredirect"); }); // Adds a tab with redirect help to redirect pages. addOnloadHook(function () { if (document.getElementById('contentSub').innerHTML == "Redirect page") { url = wgServer + "/w/index.php?title=User:Creidieki/Redirects"; addPortletLink("p-cactions", url, "Redirects", "pc-redirect"); } }); // // Adds a tab with user talk templates to user talk pages. addOnloadHook(function () { if ( wgCanonicalNamespace == "User_talk" ) { url = wgServer + "/w/index.php?title=Wikipedia:Template messages/User talk namespace"; addPortletLink("p-cactions", url, "Messages", "messages"); } }); //