User:DatRoot/Skins/Skin2.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. |
![]() | Documentation for this user script can be added at User:DatRoot/Skins/Skin2. This user script seems to have an accompanying .css page at User:DatRoot/Skins/Skin2.css. |
/*
* 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" ];
for(var i = 0; i < cactionsItems.length; i++)
DatRoot.addPortletLink(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"));
});});