Wužiwar:Tlustulimu/monobook.js
z Kitakija
< Wužiwar:Tlustulimu
Wersija z 15:38, 21. jan 2008 wužiwarja Tlustulimu (diskusija)
Kedźbu: Po składowanju dyrbiš snano pufrowak swojeho wobhladowaka wuprózdnić, Mozilla/Firefox/Safari: tłóč na Umsch kliknjo na Znowa abo tłóč Strg-Umsch-R (Cmd-Shift-R na Apple Mac); IE: tłóč Strg kliknjo na symbol Aktualisieren abo tłóč Strg-F5; Konqueror:: Klikń jenož na tłóčatko Erneut laden abo tłoč F5; Wužiwarjo Opery móža swój pufrowak dospołnje w Tools→Preferences wuprózdnić.
//<source lang="Javascript"> /* zdźěla wot mojeje němskeje strony */ /* Einige link-Tags hinzufügen */ head = document.getElementsByTagName('head')[0] function verlinke(rel, href, title) { link = document.createElement('link') link.rel = rel link.href = '/wiki/' + href link.title = title head.appendChild(link) } if (head) /* sollte immer true ergeben, aber sicher ist sicher */ { verlinke('start', 'Hłowna strona', 'Hłowna strona') verlinke('help', 'Wikipedija:Pomoc', 'Pomoc') verlinke('index', 'Special:Alle Seiten', 'Index') } /* decodiere UTF8 (aus Selfhtml) */ function decode_utf8(utftext) { var plaintext = ""; var i=0; var c=c1=c2=0; // while-Schleife, weil einige Zeichen uebersprungen werden while(i<utftext.length) { c = utftext.charCodeAt(i); if (c<128) { plaintext += String.fromCharCode(c); i++;} else if((c>191) && (c<224)) { c2 = utftext.charCodeAt(i+1); plaintext += String.fromCharCode(((c&31)<<6) | (c2&63)); i+=2;} else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63)); i+=3;} } return plaintext; } /* decodiere die codierten UTF8-Zeichen in Kapitel-Ankern */ function decodeanchor(anchorname) { var escaped = anchorname.replace(/\.([0-9A-F][0-9A-F])/g,"%$1"); return decode_utf8(unescape(escaped)).replace(/_/g,' '); } /* Füge Link-Tags fürs Inhaltsverzeichnis hinzu */ function addcontents() { var head = document.getElementsByTagName('head')[0]; var len = document.anchors.length for (i = 0; i < len; ++i) { anchor = document.anchors[i]; link = document.createElement('link') link.rel = 'chapter' link.href = '#' + anchor.name; link.title = decodeanchor(anchor.name); head.appendChild(link) } } addOnloadHook(addcontents); //Bei Dschwen gefunden // [[Benutzer:Dschwen/wikiminiatlas2.js]] - diese Zeile bitte mitkopieren document.write('<script type="text/javascript" src="' + 'http://de.wikipedia.org/w/index.php?title=User:Dschwen/wikiminiatlas2.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //Aus der englischen Wikipedia von User:Cacycle // install [[User:Cacycle/wikEd]] in-browser text editor document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //Po ideju w němskej Wikipediji [[:de:Wikipedia Diskussion:Skin#Freigeben rot]] if (document.getElementById("ca-unprotect")) { document.getElementById("ca-unprotect").style.borderColor = "#FF0000"; document.getElementById("ca-unprotect").style.borderWidth = "4px"; } // z wužiwarja Zacke w němskej wikipediji // vom Benutzer:Zacke in dewp function addlilink(tabs, url, name, id) { var na = document.createElement('a'); na.href = url; na.id = id; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.appendChild(na); tabs.appendChild(li); return li; } function addtoolboxlinks() { var tb = document.getElementById('p-navigation').getElementsByTagName('ul')[0]; addlilink(tb, '/wiki/Wikipedija:Projekt_za_předłohi', 'Projekt za předłohi', ''); addlilink(tb, '/wiki/Wikipedija:Požadane_přełožki', 'Požadane přełožki', ''); addlilink(tb, '/wiki/Kategorija:Strony_k_spěšnemu_wušmórnjenju', 'SW', ''); addlilink(tb, '/wiki/Kategorija:Kandidaty_za_šmórnjenje', 'Kat. Kand. šm.', ''); addlilink(tb, '/wiki/Wikipedija:Kandidaty_za_šmórnjenje', 'Wik. Kand. šm.', ''); addlilink(tb, '/wiki/Specialnje:Prefiksindeks', 'Strony', ''); addlilink(tb, '/wiki/Wužiwar:Tlustulimu/Nawi', 'Nawi', ''); addlilink(tb, '/wiki/Wužiwar:Tlustulimu/Nawi2', 'Nawi2', ''); addlilink(tb, '/wiki/Wužiwar:Tlustulimu/Babel', 'Babel', ''); } if (window.addEventListener) window.addEventListener("load", addtoolboxlinks, false); else if (window.attachEvent) window.attachEvent("onload", addtoolboxlinks); // Testy //Z desource, monobook.js //-------------------------------------------------------------------------------- //## Cookies function SetCookie(name,value) { document.cookie = name + "=" + escape(value); } 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; } } //-------------------------------------------------------------------------------- //-------------------------------------------------------------------------------- //Vordefinition für eigene Sonderzeichenleiste MyChar = new Array(); MyCharText = new Array(); MyCharEnd = new Array(); MyCharDefault = new Array(); //Z desource, onlyifediting.js //================================================================================ // Optionen für das Sonderzeichenmenü in [[MediaWiki:Edittools]] // Diese Variablen können in den Benutzer-Javascripts angepasst werden var SpecCharsMove = true; SpecCharsAccesskeys = new Array(); function addCharSubsetMenu() { // var toolbar = document.getElementById('toolbar'); var toolbar = document.getElementById('wpSummaryLabel'); var specialchars = document.getElementById('specialchars'); if (specialchars) { var menu = "\n\r<select id=\"CharSelect\" name=\"CharSelect\" tabindex=\"8\" accesskey=\"a\" style=\"display:inline; vertical-align:middle\" onChange=\"chooseCharSubset(selectedIndex)\">"; var l = document.getElementById('specialchars').getElementsByTagName('p'); for(var i=0; i < l.length; i++) { if(l[i].className == "specialbasic" || l[i].className == "speciallang") { var charname = l[i].title; menu += "<option>" + charname + "</option>"; } } menu += "</select>"; specialchars.innerHTML = menu + specialchars.innerHTML; // Standard-CharSubset oder aus Cookie var stdsubset = 0; if (GetCookie ("CharSubset")) stdsubset = GetCookie ("CharSubset"); document.editform.CharSelect.options[stdsubset].selected = true; chooseCharSubset(stdsubset); //Umhängen von Specialchars in die Toolbar if (SpecCharsMove) { if (toolbar) { toolbar.appendChild(specialchars.parentNode.removeChild(specialchars)); toolbar.className='toolbar'; } } } //Gleicher Tabindex für alle Elemente der Toolbar if (toolbar) { var charlinks = toolbar.getElementsByTagName('a'); for (var i=0; i < charlinks.length; i++) { charlinks[i].setAttribute("tabindex",8); } } } // CharSubset-Auswahl function chooseCharSubset(s) { 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'; } } if (GetCookie ("CharSubset") && (i = GetCookie ("CharSubset")) != s) { SetArrayAccessKeys(l[i].getElementsByTagName('a'),""); } SetCookie ("CharSubset",s); } } // Ein Array von Accesskeys an ein Array von Elementen 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",""); } } } // Menü-Einfügung function customizeWikipedia() { AddMyChars(); addCharSubsetMenu(); } // Vorfunktion für eigene Sonderzeichenleiste, nutzt globale Variablen function AddMyChars() { if (MyChar[0]) AddMyCharsDo(MyChar, MyCharEnd, MyCharText, MyCharDefault); } // Eigene Sonderzeichenliste function AddMyCharsDo(thechar, thecharend, thechartext, thechardefault) { var specialcharslist = document.getElementById('specialchars'); var addtext = "<p class=\"specialbasic\" id=\"Eigene\" title=\"Eigene\" style=\"display: none;\">\n\r"; addtext += "Eigene Zeichen:\n\r"; addtext += "<font style=\"text-decoration: none;\" face=\"Arial Unicode MS,Lucida Sans Unicode,MS Mincho,Arial,sans-serif\">"; for (var i = 0; i < thechar.length; i++) { if (!thecharend[i]) thecharend[i]=""; if (!thechardefault[i]) thechardefault[i]=""; jsfunction ="insertTags('" + thechar[i] + "','" + thecharend[i] + "','" + thechardefault[i] +"')"; //Autoinkrement-Funktion einsetzen if (thechardefault[i].charAt(0) == "+" && !isNaN(parseInt(thechardefault[i].substr(1)))) { jsfunction = "insertTagsValue('" + thechar[i] + "','" + thecharend[i] + "','" + thechardefault[i] + "','" + i +"')"; } if (!thechartext[i]) thechartext[i] = thechar[i]+" "+thecharend[i]; addtext += "<a href=\"javascript:" +jsfunction +"\">" + thechartext[i] + "</a>\n\r"; } addtext += "</font></p>"; specialcharslist.innerHTML = addtext+specialcharslist.innerHTML; } // Autoinkrement-Tags function insertTagsValue(uchar, ucharend, uchardefault, ucharnr) { var txtarea = document.editform.wpTextbox1; if (document.selection && !is_gecko) { // IE var theSelection = document.selection.createRange().text; } else if(txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla var replaced = false; var startPos = txtarea.selectionStart; var endPos = txtarea.selectionEnd; if (endPos-startPos) replaced = true; var scrollTop = txtarea.scrollTop; var theSelection = (txtarea.value).substring(startPos, endPos); } if (theSelection == "") { if (!(lastVal = GetCookie("CharDefaultValue-"+ ucharnr))) lastVal ="0"; theSelection= parseInt(lastVal) + parseInt(uchardefault.substr(1)); theSelection= theSelection.toString(); } SetCookie("CharDefaultValue-"+ ucharnr,theSelection); insertTags(uchar,ucharend,theSelection); } // onload einbinden addLoadEvent(customizeWikipedia); //================================================================================ // přidawk za moju css-dataju document.write('<link rel="stylesheet" type="text/css" href="http://hsb.wikipedia.org/wiki/Wužiwar:Tlustulimu/rq1.css" />'); //</source>