User:Kaganer/monobook.js

//**********************************************// // This will add an [edit top] link // at the top of all pages except preview pages //**********************************************// // by User:Pile0nades

addOnloadHook(function {  // if this is preview page or generated page, stop  if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return;

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

// create div and set innerHTML to link var divContainer = document.createElement("div"); divContainer.innerHTML = ' [edit top] ';

// insert divContainer into the DOM before the h1 if(window.location.href.indexOf("&action=edit") == -1) document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);

if(window.location.href.indexOf("&action=edit&section=0") != -1) document.getElementById("wpSummary").value = "/* Intro */ "; });

// Drop down box for the Special character menu in MediaWiki:Edittools // will be called from MediaWiki:Monobook.js. // Adapted from: // http://commons.wikimedia.org/wiki/MediaWiki:Edittools.js // -> for MediaWiki:Edittools.js

// string for Common.js var load_edittools = true;

// Switch for people that don't want it if (load_edittools == true) {

function addCharSubsetMenu { var specialchars = document.getElementById('specialchars'); if (specialchars) { var menu = ""; menu += " Standard "; menu += " Latin "; menu += " Greek "; menu += " Cyrillic "; menu += " IPA "; menu += " Arabic "; menu += " Catalan "; menu += " Czech "; menu += " Devanāgarī "; menu += " Esperanto "; menu += " Estonian "; menu += " French "; menu += " German "; menu += " Hawaiian "; menu += " Hebrew "; menu += " Hungarian "; menu += " Icelandic "; menu += " Italian "; menu += " Latvian "; menu += " Lithuanian "; menu += " Maltese "; menu += " Old English "; menu += " Pinyin "; menu += " Polish "; menu += " Portuguese "; menu += " Romaji "; menu += " Romanian "; menu += " Scandinavian "; menu += " Serbian "; menu += " Spanish "; menu += " Turkish "; menu += " Vietnamese "; menu += " Welsh "; menu += " Yiddish "; menu += " "; specialchars.innerHTML = menu + specialchars.innerHTML; // Standard-CharSubset chooseCharSubset(0); } } // CharSubset selection function chooseCharSubset(s) { var l = document.getElementById('specialchars').getElementsByTagName('p'); for (var i = 0; i < l.length ; i++) { l[i].style.display = i == s ? 'inline' : 'none'; // l[i].style.visibility = i == s ? 'visible' : 'hidden'; } } // Menu insertion if (window.addEventListener) window.addEventListener("load", addCharSubsetMenu, false); else if (window.attachEvent) window.attachEvent("onload", addCharSubsetMenu);

}