User:Peak/Charset.js

//

//* MediaWiki:Charset.js //** add menu for selecting subsets of secial characters //** must match MediaWiki:Edittools //*/

function addCharSubsetMenu {

var specialchars = document.getElementById('editpage-specialchars'); if (specialchars) { alert("NOTE: User:Peak/Charset.js is executing... "); var menu = ""; menu += " More characters "; menu += " Latin/Roman "; menu += " Greek "; menu += " Cyrillic "; menu += " Arabic "; menu += " Catalan "; menu += " Croatian "; menu += " Czech & Slovak "; menu += " Dutch/Frisian "; menu += " Esperanto "; menu += " Estonian "; menu += " French "; menu += " German "; menu += " Hawaiian "; menu += " Hebrew "; menu += " Hieroglyph "; menu += " Hungarian "; menu += " Icelandic "; menu += " Indo-European "; menu += " Irish "; menu += " Italian "; menu += " Latvian "; menu += " Lithuanian "; menu += " Maltese "; menu += " Navajo & Apache "; menu += " Old English "; menu += " Pinyin "; menu += " Polish "; menu += " Portuguese "; menu += " Ro-maji "; menu += " Romanian "; menu += " Scandinavian "; menu += " Sorbian "; menu += " Spanish "; menu += " Thai "; menu += " Turkic "; menu += " Vietnamese "; menu += " Welsh "; menu += " Yiddish "; menu += " IPA "; menu += " Math/TeX "; menu += " "; specialchars.innerHTML = menu + specialchars.innerHTML;

/* default subset - try to use a cookie some day */ chooseCharSubset(0); } }

/* select subsection of special characters */ function chooseCharSubset(s) { var l = document.getElementById('editpage-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'; } }

function addLoadEvent(func) { if (window.addEventListener) window.addEventListener("load", func, false); else if (window.attachEvent) window.attachEvent("onload", func); }

addLoadEvent(addCharSubsetMenu); //