User:Patrick/myskin.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
if (navigator.userAgent.match(/Android/i)  || navigator.userAgent.match(/Droid/i)) {
        var styleEle = document.getElementsByTagName("head")[0].appendChild(document.createElement("style"));
        styleEle.sheet.insertRule(".mw-rollback-link { display: none; }", 0);
}

//==============================================
// edit top link and row of links at the bottom
//==============================================

setTimeout("editTopLink()", 0) // this is equivalent of onload
function editTopLink() {

// if this is preview page or generated page, stop
if(document.getElementById("wikiPreview") || window.location.href.indexOf("w/index.php?title=Special:") != -1) return;

// get the page title
var pageTitle = document.title.split(" - ")[0].replace(" ", "_"); 

// create div and set innerHTML to link
var divContainer = document.createElement("div");
divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-top:3px;"><a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">edit top</a></div>';

var divContainer1 = document.createElement("div");
divContainer1.innerHTML = '<ul><li><a href="/wiki/Special%3AWhatlinkshere/'+pageTitle+'">what links here</a> <a href="/wiki/Special%3ARecentchangeslinked/'+pageTitle+'">rcl</a> - <a href="/w/index.php?title=Special%3AAllpages&namespace=0">m</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=1">t</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=2">u</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=3">ut</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=4">w</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=5">wt</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=6">i</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=7">it</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=8">mw</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=9">mwt</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=10">t</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=11">tt</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=12">h</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=13">ht</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=14">c</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=15">ct</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=100">p</a> <a href="/w/index.php?title=Special%3AAllpages&namespace=101">pt</a></li></ul>';

// insert divContainer into the Document Object Model (DOM) before the h1
document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
document.getElementById("p-cactions").insertBefore(divContainer1, document.getElementsByTagName("h5")[0]);

}

function hideAnonUserPageLink()
{
    var userPageLink = document.getElementById("ca-nstab-user")
    if (!window.hideAnonUserPageLinkDisabled && userPageLink.className == "new")
    {
        document.getElementById("ca-nstab-user").style.visibility = "hidden"
    }
}
 
if (wgPageName.search(/^(User_talk:(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))$/) == 0)
{
    window.addOnloadHook(hideAnonUserPageLink)
}


// [[User:Lupin/popups.js]]
// importScript('User:Lupin/popups.js');
popupUseQueryInterface=false;

popupMaxWidth=1250