User:Azliq7/global.js

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SCRIPTS (MONOBOOK) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

this.importArticles({   type: 'script',    articles: [        //'u:runescape:MediaWiki:Common.js/instantCollapsible.js'    ] });

function embedXMLimage { var allDivs = document.getElementsByTagName("div"); for (var i=0; i"; allDivs[i].innerHTML = embedString; }   } } addOnloadHook(embedXMLimage);

function purgeTab { var what; var url;

if (!(what = document.getElementById('ca-history') )) return; if (!(url = what.getElementsByTagName('a')[0] )) return; if (!(url = url.href )) return;

addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'), 'purge', 'ca-purge', 'Purge server cache for this page', '0'); }

function whatLinksHereTab { var what; var url;

if (!(what = document.getElementById('t-whatlinkshere') )) return; if (!(url = what.getElementsByTagName('a')[0] )) return; if (!(url = url.href )) return;

addPortletLink('p-cactions', url, 'what links here', 'ca-whatlinkshere', 'List of all wiki pages that link here'); }

function userContributionsTab { if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") { var what; var url;

if (!(what = document.getElementById('t-contributions') )) return; if (!(url = what.getElementsByTagName('a')[0] )) return; if (!(url = url.href )) return;

addPortletLink('p-cactions', url, 'contributions', 'ca-usercontibutions', 'View the list of contributions of this user', 'j'); } }

function uploadNewVersionTab { if (wgCanonicalNamespace == "File") { var url; url = wgServer; url += wgScript; url += '?title=Special:Upload&wpDestFile='; url += wgTitle.replace(" ", "_"); url += '&wpForReUpload=1';

addPortletLink('p-cactions', url, 'upload new version', 't-upload', 'Upload a new version of this file [u]', 'u'); } }

function addReplyLink { if (wgCanonicalNamespace == "User_talk") { var editSections = document.getElementsByTagName("span");

for (var i=0; i < editSections.length; i++) { if (hasClass(editSections[i], "editsection")) { var firstComment = editSections[i].parentNode.nextSibling.nextSibling; var commentLinks = firstComment.getElementsByTagName("a"); var userLink = '';

for (var j=0; j < commentLinks.length; j++) { var commentLink = commentLinks[j].href; userLink = '';

if (commentLink.indexOf('User:') != -1) { userLink = commentLink.substring(commentLink.indexOf('User:') + 5); } else if (commentLink.indexOf('User_talk:') != -1) { userLink = commentLink.substring(commentLink.indexOf('User_talk:') + 10); } else if (commentLink.indexOf('Template:Signatures/') != -1) { userLink = commentLink.substring(commentLink.indexOf('Template:Signatures/') + 20); }               }

if (userLink != '') { userLinkStr = ' [reply] ';

editSections[i].nextSibling.nextSibling.innerHTML += userLinkStr; }           }        }    } } if(skin == "monobook") { addOnloadHook(purgeTab); addOnloadHook(whatLinksHereTab); addOnloadHook(userContributionsTab); addOnloadHook(uploadNewVersionTab); addOnloadHook(addReplyLink); }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////