User:Antandrus/Standard.js

//

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

/* add menu for selecting subsets of secial characters */ /***** must match MediaWiki:Edittools *****/ function addCharSubsetMenu { var specialchars = document.getElementById('specialchars');

if (specialchars) { var menu = ""; menu += " Wiki "; 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 += " Korean "; menu += " Latvian "; menu += " Lithuanian "; menu += " Maltese "; menu += " Navajo & Apache "; menu += " Old English "; menu += " Pinyin "; menu += " Polish "; menu += " Portuguese "; menu += " Rō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('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'; } }

addLoadEvent(addCharSubsetMenu);

//