Jump to content

User:DatRoot/Skins/Skin2.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by DatRoot (talk | contribs) at 23:28, 19 November 2007 (attempt fix bug moving links to cactions). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
/*
 *  Set up the elements for the skin
 */
 
if(!DatRoot) importScript("User:DatRoot/Scripts/Common.js");
 
addOnloadHook(function(){ DatRoot.addOnloadHook(function()
{    
    if(wgNamespaceNumber >= 0)
    {
        // Add "Actions" label
        var firstAction = document.getElementById("ca-edit") || document.getElementById("ca-viewsource");
        if(firstAction) firstAction.parentNode.insertBefore(
            DatRoot.createElement("li", "", "cactionsLabel", "Actions>"), firstAction);
    
        // Add all page-related links to 'p-cations'
        var cactionsItems = [ DatRoot.createElement("br"),
            DatRoot.createElement("li", "", "cactionsLabel", "Related>"),
            "ca-history", "t-contributions", "t-log", "t-pagelog", "t-whatlinkshere",
            "t-recentchangeslinked", "t-emailuser", "t-permalink", "t-print", "t-cite" ];
        var cactions = document.getElementById("p-cactions");
        for(var i = 0; i < cactionsItems.length; i++)
            DatRoot.addPortletLink(cactions, cactionsItems[i]);
    }
     
    // Rename edit link form "Edit this page" to "Edit"
    var editLink = document.getElementById("ca-edit");
    if(editLink) editLink.firstChild.innerHTML = "Edit";

    // Rename add section link from "+" to "Add section"
    var addSectionLink = document.getElementById("ca-addsection");
    if(addSectionLink) addSectionLink.firstChild.innerHTML = "Add section";

    
    // Add some links to toolbox and move it to above search
    var toolbox = document.getElementById("p-tb");
    DatRoot.addPortletLink(toolbox, "n-recentchanges");
    DatRoot.addPortletLink(toolbox, "n-randompage");
    toolbox.parentNode.insertBefore(toolbox, document.getElementById("p-navigation"));

    // Move search to above navigation
    var search = document.getElementById("p-search");
    search.parentNode.insertBefore(search, document.getElementById("p-navigation"));
});});