User:Kaster/WiktionaryOnlyifediting.js

alert('hello from en:wiki!');

// Grundfunktion für weitere Editbuttons über dem Bearbeitungsfenster (aus q:bs:MediaWiki:Monobook.js) function addEditButton(imageFile, tagOpen, sampleText, tagClose, speedTip) {       mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/" + imageFile, "tagOpen": tagOpen, "sampleText": sampleText, "tagClose": tagClose, "speedTip": speedTip };   }

// Weitere Editbuttons (teils aus q:bs:MediaWiki:Monobook.js, teils nach w:en:MediaWiki:Common.js) addEditButton( 'commons/8/88/Btn_toolbar_enum.png',        '# ', '1', '\n# 2\n# 3', 'Бројеви'); addEditButton( 'commons/1/11/Btn_toolbar_liste.png',        '* ', 'A', '\n* B\n* C', 'Тачке'); addEditButton( 'en/c/c8/Button_redirect.png',        '#REDIRECT ', ,         , 'Преусмјерење'); addEditButton( 'en/5/58/Button_small.png', ' ',        'малим словима', ' ', 'мало'); addEditButton( 'en/8/80/Button_upper_letter.png', ' ',        'мала слова горе', ' ', 'горе'); addEditButton( 'en/7/70/Button_lower_letter.png', ' ',        'мала слова доле', ' ', 'доле'); addEditButton( 'en/1/13/Button_enter.png',        ' ', '', 'Нови ред');

// Cookie function SetCookie(cookieName, cookieValue) { var today = new Date; var expire = new Date; var nDays = 30; expire.setTime( today.getTime + (3600000 * 24 * nDays) ); document.cookie = cookieName + "=" + escape(cookieValue) + ";expires="+expire.toGMTString; } function GetCookie(name) { var i =0; while (i < document.cookie.length) { if (document.cookie.substr(i,name.length) == name) { var valend = document.cookie.indexOf(";",i+name.length+1); if (valend == -1) { valend = document.cookie.length; }                       return unescape(document.cookie.substring(i+name.length+1,valend)); }               i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } }

// Auswahl Charsubset function chooseCharSubset(ss) { s = parseInt( ss ); if ( isNaN(s) ) s = 0; if (SpecCharsAccesskeys.length==0) { if (is_opera) SpecCharsAccesskeys = new Array("!","\"","§","$","%","&","/","(",")","=");                else SpecCharsAccesskeys = new  Array("1","2","3","4","5","6","7","8","9","0","!","\"","§","$","%","&","/","(",")","="); }       if (s>=0) { var l = document.getElementById('specialchars').getElementsByTagName('p'); for (var i = 0; i < l.length ; i++) { if (i==s) { l[i].style.display = 'inline'; SetArrayAccessKeys(l[i].getElementsByTagName('a'),SpecCharsAccesskeys); } else l[i].style.display = 'none'; }         SetCookie('CharSubset', s); } }

// Accesskeys function SetArrayAccessKeys(elements, keys) { for (var i =0; i < elements.length;i++) { if (i < keys.length) { elements[i].setAttribute("accessKey",keys[i]); elements[i].setAttribute("title","alt-"+keys[i]); } else { elements[i].setAttribute("accessKey",""); elements[i].setAttribute("title",""); }       } } // Combined cross-browser features of zh:MediaWiki:Monobook.js... SpecCharsAccesskeys = new Array; function addCharSubsetMenu { var SpecCharsMove = true; var edittools = document.getElementById('specialchars'); if (edittools) { var name; var menu=document.createElement("select"); menu.style.display="inline"; var line = edittools.getElementsByTagName('p'); for (var i = 0; i < line.length ; i++) { if (line[i].className == "specialbasic" || line[i].className == "speciallang") { if (line[i].title) name=line[i].title; else name = line[i].id; menu.options[menu.options.length]=new Option(name); }                }

menu.onchange=function {chooseCharSubset(this.selectedIndex);} ; if (SpecCharsMove) { edittools.insertBefore(menu,edittools.firstChild); } else { edittools.insertAfter(menu,edittools.firstChild); }               var stdsubset = 0; if (GetCookie ("CharSubset")) stdsubset = parseInt( GetCookie ("CharSubset") ); if ( isNaN(stdsubset) ) stdsubset = 0; menu.options[stdsubset].selected = true; chooseCharSubset(stdsubset);

// Gleicher Tabindex für alle Elemente der Toolbar var charlinks = document.getElementById('specialchars').getElementsByTagName('a'); for (var i=0; i < charlinks.length; i++) { charlinks[i].setAttribute("tabindex",8); }     } //end if (edittools) } addOnloadHook(addCharSubsetMenu); // Move to function elementMoveto(node, refNode, pos) { if(node && refNode) { var parent = refNode.parentNode; if (pos && pos == 'after') refNode=refNode.nextSibling; try { parent.insertBefore(node, refNode); } catch (DOMException) {}; } }

// Fix für Toolbar function fixToolbar{ if ($("toolbar")) { var wpEditToolbar = document.getElementById("toolbar"); var dropdownListEditTools = document.getElementById("dropdownListEditTools"); elementMoveto(dropdownListEditTools, wpEditToolbar , 'after' ); if (dropdownListEditTools) dropdownListEditTools.style.display="block"; var editspecialchars = document.getElementById("specialchars"); elementMoveto( editspecialchars, wpEditToolbar, 'after' ); } } addOnloadHook(fixToolbar);