User:Creidieki/monobook.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin is at User:Creidieki/monobook.css. |
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 (mw.config.get('wgCanonicalNamespace') == 'Special' && mw.config.get('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(mw.config.get('wgPageName') != "Special:Booksources" && mw.config.get('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 ( mw.config.get('wgCanonicalNamespace') == "User" || mw.config.get('wgCanonicalNamespace') == "User_talk" ) {
url = mw.config.get('wgServer') + "/w/index.php?title=Special:Log&user=" + mw.config.get('wgTitle').split("/")[0];
} else if ( mw.config.get('wgCanonicalNamespace') == "Special" ) {
// don't display link for special pages
return;
} else {
url = mw.config.get('wgServer') + "/w/index.php?title=Special:Log&page=" + mw.config.get('wgPageName');
}
mw.util.addPortletLink("p-tb", url, "Logs", "pt-logs");
});
//
// adds a 'random redirect' link to the toolbox
addOnloadHook(function () {
url = mw.config.get('wgServer') + "/w/index.php?title=Special:RandomRedirect";
mw.util.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 = mw.config.get('wgServer') + "/w/index.php?title=Category:Redirect_templates";
mw.util.addPortletLink("p-cactions", url, "Redirects", "pc-redirect");
}
});
//
// Adds a tab with user talk templates to user talk pages.
addOnloadHook(function () {
if ( mw.config.get('wgCanonicalNamespace') == "User_talk" )
{
url = mw.config.get('wgServer') + "/w/index.php?title=Wikipedia:Template messages/User talk namespace";
mw.util.addPortletLink("p-cactions", url, "Messages", "messages");
}
});
//