MediaWiki:Common.js: Unterschied zwischen den Versionen
Aus RMG-Wiki
Admin (Diskussion | Beiträge) |
K (1 Version: UploadWizard) |
||
(20 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
− | /* | + | // |
− | /* | + | // * eingefügte Javascripts |
+ | // ** Force Preview - User müssen vor dem Speichern den Vorschauknopf drücken | ||
+ | // ** Die erweiterte Editierleiste | ||
+ | // ** Toogle für die Vorlage Hidden | ||
+ | // ** Automatisches Einfügen für Hochladen von Bildern | ||
+ | // ------------------------------------------------------------------------------- | ||
+ | |||
+ | // ------------------------------------------------------------------------------- | ||
+ | // Force Preview JavaScript code - Start | ||
+ | // | ||
+ | // To allow any group to bypass being forced to preview, | ||
+ | // enter the group name in the permittedGroups array. | ||
+ | // E.g. | ||
+ | // var permittedGroups = []; // force everyone | ||
+ | // var permittedGroups = [ "user"]; // permit logged-in users | ||
+ | // var permittedGroups = [ "sysop", "bureaucrat"]; // permit sysop, bureaucrat | ||
+ | // ------------------------------------------------------------------------------- | ||
+ | var permittedGroups = ["sysop", "bureaucrat"]; | ||
+ | |||
+ | Array.prototype.intersects = function() { | ||
+ | // -------------------------------------------------------- | ||
+ | // Returns true if any element in the argument array | ||
+ | // is the same as an element in this array | ||
+ | // -------------------------------------------------------- | ||
+ | if( !arguments.length ){ | ||
+ | return false; | ||
+ | } | ||
+ | var array2 = arguments[0]; | ||
+ | |||
+ | var len1 = this.length; | ||
+ | var len2 = array2.length; | ||
+ | if( len2 == 0 ){ | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | for(var i=0; i<len1; i++){ | ||
+ | for(var j=0; j<len2; j++) { | ||
+ | if( this[i] === array2[j] ) { | ||
+ | return true; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | return false; | ||
+ | }; | ||
+ | |||
+ | function forcePreview() | ||
+ | { | ||
+ | if( wgAction != "edit") return; | ||
+ | if( wgUserGroups === null) { | ||
+ | wgUserGroups = []; | ||
+ | } | ||
+ | if( wgUserGroups.intersects(permittedGroups) ) { | ||
+ | return; | ||
+ | } | ||
+ | var saveButton = document.getElementById("wpSave"); | ||
+ | if( !saveButton ) | ||
+ | return; | ||
+ | saveButton.disabled = true; | ||
+ | saveButton.value = "Speichern (Vorschau benützen)"; | ||
+ | saveButton.style.fontWeight = "normal"; | ||
+ | document.getElementById("wpPreview").style.fontWeight = "bold"; | ||
+ | } | ||
+ | |||
+ | addOnloadHook(forcePreview); | ||
+ | // ----------------------------------------------------- | ||
+ | // Force Preview JavaScript code - End | ||
+ | // ----------------------------------------------------- | ||
//============================================================ | //============================================================ | ||
Zeile 6: | Zeile 72: | ||
// de: FÜGE NEUE BUTTON IN DIE WERKZEUGLEISTE [[:de:Benutzer:Olliminatore/Extra-Editbuttons]] | // de: FÜGE NEUE BUTTON IN DIE WERKZEUGLEISTE [[:de:Benutzer:Olliminatore/Extra-Editbuttons]] | ||
// Converted by [[User:Olliminatore]] 25.09.2006 | // Converted by [[User:Olliminatore]] 25.09.2006 | ||
+ | // A.Burgermeister 26.11.09, | ||
//============================================================ | //============================================================ | ||
// de: Die Reihenfolge und Anzahl der Buttons ist über die (alphabetische) Variable customEditButtons wählbar. | // de: Die Reihenfolge und Anzahl der Buttons ist über die (alphabetische) Variable customEditButtons wählbar. | ||
− | // | + | // 28.11.09 Erweiterte Tabelle eingefügt, eigene Signatur gelöscht |
+ | // 22.01.10 Korrektur wegen der beiden Icons am Anfang | ||
+ | // 01.02.12 Liste und Nummerierung verbessert | ||
var XEBOrder=[]; | var XEBOrder=[]; | ||
Zeile 26: | Zeile 95: | ||
var BDict={ | var BDict={ | ||
'A':['e/e9/Button_headline2.png','Sekundäre Überschrift','\n=== ',' ===','Sekundäre Überschrift'], | 'A':['e/e9/Button_headline2.png','Sekundäre Überschrift','\n=== ',' ===','Sekundäre Überschrift'], | ||
− | |||
'A3':['/3/3a/Button_headline3.png','Untergeordnete Überschrift','\n==== ',' ====','Untergeordnete Überschrift'], | 'A3':['/3/3a/Button_headline3.png','Untergeordnete Überschrift','\n==== ',' ====','Untergeordnete Überschrift'], | ||
'B':['1/13/Button_enter.png','Zeilenumbruch','<br />','',''], | 'B':['1/13/Button_enter.png','Zeilenumbruch','<br />','',''], | ||
Zeile 36: | Zeile 104: | ||
'CO':['6/6c/Button_commons.png','Commons','{{Commons|Category:','}}','Seitenname'], | 'CO':['6/6c/Button_commons.png','Commons','{{Commons|Category:','}}','Seitenname'], | ||
'D':['e/ea/Button_align_left.png','Left-Align','<div style="text-align: left; direction: ltr; margin-left: 1em;">\n','\n<\/div>','Left-aligned Text'], | 'D':['e/ea/Button_align_left.png','Left-Align','<div style="text-align: left; direction: ltr; margin-left: 1em;">\n','\n<\/div>','Left-aligned Text'], | ||
− | 'DS':['4/4e/Button_romain.png',' | + | 'DS':['4/4e/Button_romain.png','SORTIERUNG','{{SORTIERUNG:','}}','Sortierbegriff'], |
'DO':['e/e9/Button_done.png','Erledigt (kurz)','{{Erl.}}','',''], | 'DO':['e/e9/Button_done.png','Erledigt (kurz)','{{Erl.}}','',''], | ||
'ER':['9/9d/Button_fait.png','Erledigt (lang)','{{Erledigt|1=' + usersignature,'}}',''], | 'ER':['9/9d/Button_fait.png','Erledigt (lang)','{{Erledigt|1=' + usersignature,'}}',''], | ||
− | 'E':['0/04/Button_array.png','Tabelle','\n{| class="wikitable" \n|- \n | + | 'E':['0/04/Button_array.png','Tabelle','\n{| class="wikitable" \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n',''], |
+ | 'E1':['6/60/Button_insert_table.png','erweiterte Tabelle','\n{| class="wikitable" \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n',''], | ||
'F':['8/8f/Button_poeme.png','Farbiger Text','<span style="color: color">','<\/span>','Farbig'], | 'F':['8/8f/Button_poeme.png','Farbiger Text','<span style="color: color">','<\/span>','Farbig'], | ||
− | 'FS':['1/1b/Button_miss_signature.png','Fehlende Signatur','\{\{ | + | 'FS':['1/1b/Button_miss_signature.png','Fehlende Signatur','\{\{ers\:Unsigned|','}}','BENUTZER'], |
− | 'G':['9/9e/Btn_toolbar_gallery.png','Bildergalerie',"\n<gallery>\ | + | 'G':['9/9e/Btn_toolbar_gallery.png','Bildergalerie',"\n<gallery>\nDatei:M63.jpg|[[M63]]\nDatei:Mona Lisa.jpg|[[Mona Lisa]]\nDatei:Truite arc-en-ciel.jpg|Eine [[Forelle ]]\n<\/gallery>","",''], |
'H':['7/74/Button_comment.png','Versteckter Kommentar',"<!--","-->",'Versteckt'], | 'H':['7/74/Button_comment.png','Versteckter Kommentar',"<!--","-->",'Versteckt'], | ||
'I':['4/41/Button_hr_halfwidth.png','Gedankenstrich','–','',''], | 'I':['4/41/Button_hr_halfwidth.png','Gedankenstrich','–','',''], | ||
Zeile 68: | Zeile 137: | ||
'R1':['c/c4/Button_ref.png','Referenz mit Name','<ref name="">','<\/ref>','Bezugsangabe'], | 'R1':['c/c4/Button_ref.png','Referenz mit Name','<ref name="">','<\/ref>','Bezugsangabe'], | ||
'R2':['f/fe/Button_refs.png','Wiederholungs-Referenz','<ref name="','"/>','Referenzname'], | 'R2':['f/fe/Button_refs.png','Wiederholungs-Referenz','<ref name="','"/>','Referenzname'], | ||
− | 'R3':['9/9a/Button_references.png','Referenz-Footer','\n== Einzelnachweise ==\n<references/>\n','',''], | + | 'R3':['9/9a/Button_references.png','Referenz-Footer','\n== Einzelnachweise ==\n<references />\n','',''], |
− | 'RD':['7/70/Button_fusion.png','Redundanz','{{ | + | 'RD':['7/70/Button_fusion.png','Redundanz','{{ers:Redundanz|','}}','Artikel1|Artikel2|Artikel3…'], |
'S':['c/c9/Button_strike.png','Durchgestrichener Text',"<s>","<\/s>",'Durchgestrichen'], | 'S':['c/c9/Button_strike.png','Durchgestrichener Text',"<s>","<\/s>",'Durchgestrichen'], | ||
'SA':['b/bb/Seealso.png','Siehe auch','\n== Siehe auch ==\n','',''], | 'SA':['b/bb/Seealso.png','Siehe auch','\n== Siehe auch ==\n','',''], | ||
Zeile 81: | Zeile 150: | ||
'UR':['e/ec/Button_aviso.png','Urheberrecht ungeklärt',"{{Urheberrecht ungeklärt}}","",''], | 'UR':['e/ec/Button_aviso.png','Urheberrecht ungeklärt',"{{Urheberrecht ungeklärt}}","",''], | ||
'URV':['9/9d/Button_halt.png','Urheberrechtsverletzung',"{{URV}} [","] " + usersignature,'Url'], | 'URV':['9/9d/Button_halt.png','Urheberrechtsverletzung',"{{URV}} [","] " + usersignature,'Url'], | ||
− | 'V':['c/c8/Button_redirect.png','Weiterleitung (Redirect)',"# | + | 'V':['c/c8/Button_redirect.png','Weiterleitung (Redirect)',"#WEITERLEITUNG [[","]]",'Ziel einfügen'], |
'VP':['b/ba/Button_conserver.png','Vote *pro*',"# {{pro}} " + usersignature,"",''], | 'VP':['b/ba/Button_conserver.png','Vote *pro*',"# {{pro}} " + usersignature,"",''], | ||
'VC':['f/fc/Button_supp.png','Vote *contra*',"# {{contra}} " + usersignature,"",''], | 'VC':['f/fc/Button_supp.png','Vote *contra*',"# {{contra}} " + usersignature,"",''], | ||
Zeile 89: | Zeile 158: | ||
'WT':['b/bf/WP-icon.png','Wiktionary',"{{Wiktionary","}}",'|Seitenname'], | 'WT':['b/bf/WP-icon.png','Wiktionary',"{{Wiktionary","}}",'|Seitenname'], | ||
'WV':['b/b5/Button_wikiversity.png','Wikiversity',"{{Wikiversity","}}",'|Seitenname'], | 'WV':['b/b5/Button_wikiversity.png','Wikiversity',"{{Wikiversity","}}",'|Seitenname'], | ||
− | 'W':['8/88/Btn_toolbar_enum.png','Nummerierung',"\n# | + | 'W':['8/88/Btn_toolbar_enum.png','Nummerierung',"\n# ","",'Element 1'], |
− | 'X':['1/11/Btn_toolbar_liste.png','Liste',"\n* | + | 'X':['1/11/Btn_toolbar_liste.png','Liste',"\n* ","",'Element A'], |
'Y1':['c/ce/Button_no_include.png','No Include',"<noinclude>","<\/noinclude>",'Text'], | 'Y1':['c/ce/Button_no_include.png','No Include',"<noinclude>","<\/noinclude>",'Text'], | ||
'Y2':['7/79/Button_include.png','Include only',"<includeonly>","<\/includeonly>",'Text'], | 'Y2':['7/79/Button_include.png','Include only',"<includeonly>","<\/includeonly>",'Text'], | ||
− | 'Z':['3/35/Button_substitute.png',' | + | 'Z':['3/35/Button_substitute.png','Ersetzen',"{{ers:","}}",'Vorlage'], |
'ZI':['8/83/Button_biocitas.png','Zitat',"{{Zitat|","}}",'Text|Autor (optional)|Quelle (optional)'], | 'ZI':['8/83/Button_biocitas.png','Zitat',"{{Zitat|","}}",'Text|Autor (optional)|Quelle (optional)'], | ||
'T1':['c/c6/Blending_blue_button_background.png','Spacer (no function)','','',''] | 'T1':['c/c6/Blending_blue_button_background.png','Spacer (no function)','','',''] | ||
}; | }; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
function initButtons(){ | function initButtons(){ | ||
var bc,d; | var bc,d; | ||
+ | if (typeof customEditButtons!='string') // can be modified | ||
+ | XEBOrder="A,A3,B,E,E1,F,G,H,I1,I2,J1,K,M,Q,R,R1,R2,R3,S,T,U,TT,W,X".split(","); | ||
+ | |||
+ | // eingebaute Icons: | ||
+ | // Sekundäre A=Überschrift, A3=Untergeordnete Überschrift, B=Zeilenumbruch, E=Prettytable, F=Farbiger Text, G=Bildergallerie | ||
+ | // H=Versteckter Kommentar, I1=Hochgestellt, I2=Tiefgestellt, J1=Kleingeschrieben, K=Name der Kategorie, M=Zitat mit Absatz, | ||
+ | // Q=Definitionsliste , R=Markiere eine Referenz , R1=Referenz mit Name , R2=Wiederholungsreferenz , R3=Referenzfooter | ||
+ | // T=Vorlagenname ,U=Unterstreichen , V=Weiterleitung , W=Nummerierung , X=Liste | ||
+ | |||
+ | else if (customEditButtons.toLowerCase()=='all') | ||
+ | for (b in BDict) XEBOrder.push(b); | ||
+ | else XEBOrder=customEditButtons.split(","); | ||
+ | |||
for (b in BDict) BDict[b][0] = Isrc+BDict[b][0]; // // Add the start of the URL (Isrc) to the XEB buttons | for (b in BDict) BDict[b][0] = Isrc+BDict[b][0]; // // Add the start of the URL (Isrc) to the XEB buttons | ||
// If the user has defined any buttons then add them into the available button lists | // If the user has defined any buttons then add them into the available button lists | ||
Zeile 136: | Zeile 212: | ||
* @author: originally from fr:user:dake | * @author: originally from fr:user:dake | ||
* @version: 0.2 */ | * @version: 0.2 */ | ||
− | function generateTable(caption, exhead, nbCol, nbRow, exfield, align){ | + | function generateTable(caption, exhead, nbCol, nbRow, exfield, align, sortable){ |
var code = "\n"; | var code = "\n"; | ||
− | code += '{| class="wikitable | + | |
+ | code += '{| class="wikitable ' + align + sortable+ '"\n' | ||
+ caption + exhead; | + caption + exhead; | ||
if (exfield) code += '!\n'; | if (exfield) code += '!\n'; | ||
Zeile 169: | Zeile 246: | ||
+'var col = parseInt(document.paramForm.inputCol.value); ' | +'var col = parseInt(document.paramForm.inputCol.value); ' | ||
+'var exfield = document.paramForm.inputItems.checked; ' | +'var exfield = document.paramForm.inputItems.checked; ' | ||
− | +'var align = (document.paramForm.inputAlign.checked)?\' | + | +'var align = (document.paramForm.inputAlign.checked)?\'center\':""; ' |
− | +'window.opener.generateTable(caption,exhead,col,row,exfield,align); ' | + | +'var sortable = (document.paramForm.inputSortable.checked)?\'sortable\':""; ' |
+ | +'window.opener.generateTable(caption,exhead,col,row,exfield,align,sortable); ' | ||
+'window.close()}<\/script>'; | +'window.close()}<\/script>'; | ||
− | popup.document.write('<html><head><title> | + | popup.document.write('<html><head><title>Erweiterte Tabelleneinstellungen<\/title>' |
// +'<script type="text\/javascript" src="\/skins-1.5\/common\/wikibits.js"><\/script>' | // +'<script type="text\/javascript" src="\/skins-1.5\/common\/wikibits.js"><\/script>' | ||
//+'<style type="text\/css" media="screen,projection">/*<![CDATA[*/ @import "\/skins-1.5\/monobook\/main.css?5"; /*]]>*/<\/style>' | //+'<style type="text\/css" media="screen,projection">/*<![CDATA[*/ @import "\/skins-1.5\/monobook\/main.css?5"; /*]]>*/<\/style>' | ||
+ javaCode +'<\/head><body>' | + javaCode +'<\/head><body>' | ||
− | +'<p> | + | +'<Font size="2" color="#33386D" face="Verdana">' |
+ | +'<p><b>Gib die Parameter ein: <\/b><\/p>' | ||
+'<form name="paramForm">' | +'<form name="paramForm">' | ||
− | + | +'Titel: <input type="checkbox" name="inputCaption"><p\/>' | |
− | +' | + | +'Ausrichtung: auf Breite zentriert <input type="checkbox" name="inputAlign"><p\/>' |
− | + | +'Tabellenkopfzeilen: farbig <input type="checkbox" name="inputHead"><p\/>' | |
− | +' | + | +'Anzahl der Reihen: <input type="text" name="inputRow" value="3" size="2"><p\/>' |
− | +' | + | +'Anzahl der Spalten: <input type="text" name="inputCol" value="3" size="2"><p\/>' |
//+'Alternating grey lines: <input type="checkbox" name="inputLine" checked="1" ><p\/>' | //+'Alternating grey lines: <input type="checkbox" name="inputLine" checked="1" ><p\/>' | ||
− | +' | + | +'Definitionsspalte: <input type="checkbox" name="inputItems" ><p\/>' |
+ | +'Sortierbar: <input type="checkbox" name="inputSortable" ><p\/>' | ||
+'<\/form">' | +'<\/form">' | ||
− | +'<i | + | +'<i>' |
− | +' | + | +'Wähle "Definitionsspalte", wenn die 1. Spalte Definitionen enthalten soll.<\/i><p\/>' |
− | +'<p><a href="javascript:insertCode()"> | + | +'<p><a href="javascript:insertCode()"> Einfügen der Tabelle<\/a> |' |
+' <a href="javascript:self.close()">Cancel<\/a><\/p>' | +' <a href="javascript:self.close()">Cancel<\/a><\/p>' | ||
− | +'<\/body><\/html>'); | + | +'<\/font><\/body><\/html>'); |
popup.document.close(); | popup.document.close(); | ||
return false | return false | ||
}; | }; | ||
− | |||
/** en: Removes arbitrary standard buttons from the toolbar | /** en: Removes arbitrary standard buttons from the toolbar | ||
Zeile 218: | Zeile 297: | ||
} | } | ||
}; | }; | ||
− | |||
− | |||
// Adds extended onclick-function to some buttons | // Adds extended onclick-function to some buttons | ||
Zeile 239: | Zeile 316: | ||
var bu_len = mwEditButtons.length; | var bu_len = mwEditButtons.length; | ||
− | |||
if(!allEditButtons.length) return false; | if(!allEditButtons.length) return false; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
// table | // table | ||
− | + | c=XEBOrder.getIndex('E1'); | |
+ | if(c != -1) allEditButtons[bu_len+c+2].onclick=popupTable; | ||
// redirect | // redirect | ||
c=XEBOrder.getIndex('V'); | c=XEBOrder.getIndex('V'); | ||
if(c != -1) | if(c != -1) | ||
− | allEditButtons[bu_len+c].onclick=function(){ | + | allEditButtons[bu_len+c+2].onclick=function(){ |
if (a = window.prompt("Wohin soll der Redirect\?", "")) { | if (a = window.prompt("Wohin soll der Redirect\?", "")) { | ||
− | a = '\# | + | a = '\#WEITERLEITUNG \[\[' + a + '\]\]'; |
editform.wpTextbox1.value=a; | editform.wpTextbox1.value=a; | ||
editform.wpSummary.value=a; // not more needed? | editform.wpSummary.value=a; // not more needed? | ||
Zeile 269: | Zeile 338: | ||
if((c = XEBOrder.getIndex('T1')) != -1) allEditButtons[bu_len+c].width = 6; | if((c = XEBOrder.getIndex('T1')) != -1) allEditButtons[bu_len+c].width = 6; | ||
}; | }; | ||
+ | |||
+ | if ((wgAction=="edit") || (wgAction=="submit")) | ||
+ | addOnloadHook(initButtons); | ||
if(!wgIsArticle) // only if edit | if(!wgIsArticle) // only if edit | ||
hookEvent("load", extendButtons); | hookEvent("load", extendButtons); | ||
− | |||
− | /** | + | //================================================================================ |
+ | |||
+ | //*** Dynamic Navigation Bars aus Wikipedia.org am 9.3.09 | ||
+ | |||
+ | // set up the words in your language | ||
+ | var NavigationBarHide = 'Einklappen'; | ||
+ | var NavigationBarShow = 'Ausklappen'; | ||
+ | |||
+ | // set up max count of Navigation Bars on page, | ||
+ | // if there are more, all will be hidden | ||
+ | // NavigationBarShowDefault = 0; // all bars will be hidden | ||
+ | // NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden | ||
+ | if (typeof NavigationBarShowDefault == 'undefined' ) { | ||
+ | var NavigationBarShowDefault = 1; | ||
+ | } | ||
+ | |||
+ | // adds show/hide-button to navigation bars | ||
+ | addOnloadHook(function() { | ||
+ | // shows and hides content and picture (if available) of navigation bars | ||
+ | // Parameters: | ||
+ | // indexNavigationBar: the index of navigation bar to be toggled | ||
+ | function toggleNavigationBar(indexNavigationBar) | ||
+ | { | ||
+ | var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); | ||
+ | var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); | ||
+ | |||
+ | if (!NavFrame || !NavToggle) { | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | // if shown now | ||
+ | if (NavToggle.firstChild.data == NavigationBarHide) { | ||
+ | for ( | ||
+ | var NavChild = NavFrame.firstChild; | ||
+ | NavChild != null; | ||
+ | NavChild = NavChild.nextSibling | ||
+ | ) { | ||
+ | if (NavChild.className == 'NavPic') { | ||
+ | NavChild.style.display = 'none'; | ||
+ | } | ||
+ | if (NavChild.className == 'NavContent') { | ||
+ | NavChild.style.display = 'none'; | ||
+ | } | ||
+ | if (NavChild.className == 'NavToggle') { | ||
+ | NavChild.firstChild.data = NavigationBarShow; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // if hidden now | ||
+ | } else if (NavToggle.firstChild.data == NavigationBarShow) { | ||
+ | for ( | ||
+ | var NavChild = NavFrame.firstChild; | ||
+ | NavChild != null; | ||
+ | NavChild = NavChild.nextSibling | ||
+ | ) { | ||
+ | if (NavChild.className == 'NavPic') { | ||
+ | NavChild.style.display = 'block'; | ||
+ | } | ||
+ | if (NavChild.className == 'NavContent') { | ||
+ | NavChild.style.display = 'block'; | ||
+ | } | ||
+ | if (NavChild.className == 'NavToggle') { | ||
+ | NavChild.firstChild.data = NavigationBarHide; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function toggleNavigationBarFunction(indexNavigationBar) { | ||
+ | return function() { | ||
+ | toggleNavigationBar(indexNavigationBar); | ||
+ | return false; | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | var indexNavigationBar = 0; | ||
+ | // iterate over all < div >-elements | ||
+ | var divs = document.getElementsByTagName("div"); | ||
+ | for (var i=0; i<divs.length; i++) { | ||
+ | var NavFrame = divs[i]; | ||
+ | // if found a navigation bar | ||
+ | if (NavFrame.className == "NavFrame") { | ||
+ | |||
+ | indexNavigationBar++; | ||
+ | var NavToggle = document.createElement("a"); | ||
+ | NavToggle.className = 'NavToggle'; | ||
+ | NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); | ||
+ | NavToggle.setAttribute('href', '#'); | ||
+ | NavToggle.onclick = toggleNavigationBarFunction(indexNavigationBar); | ||
+ | |||
+ | var NavToggleText = document.createTextNode(NavigationBarHide); | ||
+ | NavToggle.appendChild(NavToggleText); | ||
+ | |||
+ | // add NavToggle-Button as first div-element | ||
+ | // in < div class="NavFrame" > | ||
+ | NavFrame.insertBefore( | ||
+ | NavToggle, | ||
+ | NavFrame.firstChild | ||
+ | ); | ||
+ | NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); | ||
+ | } | ||
+ | } | ||
+ | // if more Navigation Bars found than Default: hide all | ||
+ | if (NavigationBarShowDefault < indexNavigationBar) { | ||
+ | for( | ||
+ | var i=1; | ||
+ | i<=indexNavigationBar; | ||
+ | i++ | ||
+ | ) { | ||
+ | toggleNavigationBar(i); | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | |||
+ | |||
+ | //================================================================================ | ||
+ | /** | ||
Toggles the display of elements on a page | Toggles the display of elements on a page | ||
Author/contact: Austin Che http://openwetware.org/wiki/User:Austin_J._Che | Author/contact: Austin Che http://openwetware.org/wiki/User:Austin_J._Che | ||
See http://openwetware.org/wiki/OpenWetWare:Toggle for examples and documentation | See http://openwetware.org/wiki/OpenWetWare:Toggle for examples and documentation | ||
− | + | */ | |
// indexed array of toggler ids to array of associated toggle operations | // indexed array of toggler ids to array of associated toggle operations | ||
Zeile 432: | Zeile 620: | ||
addOnloadHook(toggleInit); | addOnloadHook(toggleInit); | ||
+ | |||
+ | //================================================================================ | ||
+ | // fügt für Hochladen automatisch die entsprechende Beschreibung ein. | ||
+ | // aus : http://de.wiktionary.org/wiki/MediaWiki:Common.js/Archiv_2008-04-28 | ||
+ | // editbox.value = "{"+"{Information\n" geändert in: editbox.value = "{"+"{Information ohne UploadWizard\n" (idea-sketch, 08.01.2014) | ||
+ | if ( wgCanonicalSpecialPageName == "Upload" ) { | ||
+ | function setSpecialUploadTemplate() { | ||
+ | var editbox = document.getElementById('wpUploadDescription'); | ||
+ | if (!editbox) return; | ||
+ | if (editbox.value != '') return; | ||
+ | editbox.value = "{"+"{Information ohne UploadWizard\n" | ||
+ | + "|Beschreibung = \n" | ||
+ | + "|Quelle = \n" | ||
+ | + "|Urheber = \n" | ||
+ | + "|Datum = \n" | ||
+ | + "|Genehmigung = \n" | ||
+ | + "|Andere Versionen = \n" | ||
+ | + "|Anmerkungen = \n" | ||
+ | + "}"+"}"; | ||
+ | } | ||
+ | addOnloadHook(setSpecialUploadTemplate); | ||
+ | } | ||
+ | |||
// </syntax> | // </syntax> |
Aktuelle Version vom 8. Januar 2014, 19:45 Uhr
// // * eingefügte Javascripts // ** Force Preview - User müssen vor dem Speichern den Vorschauknopf drücken // ** Die erweiterte Editierleiste // ** Toogle für die Vorlage Hidden // ** Automatisches Einfügen für Hochladen von Bildern // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- // Force Preview JavaScript code - Start // // To allow any group to bypass being forced to preview, // enter the group name in the permittedGroups array. // E.g. // var permittedGroups = []; // force everyone // var permittedGroups = [ "user"]; // permit logged-in users // var permittedGroups = [ "sysop", "bureaucrat"]; // permit sysop, bureaucrat // ------------------------------------------------------------------------------- var permittedGroups = ["sysop", "bureaucrat"]; Array.prototype.intersects = function() { // -------------------------------------------------------- // Returns true if any element in the argument array // is the same as an element in this array // -------------------------------------------------------- if( !arguments.length ){ return false; } var array2 = arguments[0]; var len1 = this.length; var len2 = array2.length; if( len2 == 0 ){ return false; } for(var i=0; i<len1; i++){ for(var j=0; j<len2; j++) { if( this[i] === array2[j] ) { return true; } } } return false; }; function forcePreview() { if( wgAction != "edit") return; if( wgUserGroups === null) { wgUserGroups = []; } if( wgUserGroups.intersects(permittedGroups) ) { return; } var saveButton = document.getElementById("wpSave"); if( !saveButton ) return; saveButton.disabled = true; saveButton.value = "Speichern (Vorschau benützen)"; saveButton.style.fontWeight = "normal"; document.getElementById("wpPreview").style.fontWeight = "bold"; } addOnloadHook(forcePreview); // ----------------------------------------------------- // Force Preview JavaScript code - End // ----------------------------------------------------- //============================================================ // en: ADD SOME EXTRA BUTTONS TO THE EDITPANEL [[:en:User:MarkS/Extra edit buttons]] // de: FÜGE NEUE BUTTON IN DIE WERKZEUGLEISTE [[:de:Benutzer:Olliminatore/Extra-Editbuttons]] // Converted by [[User:Olliminatore]] 25.09.2006 // A.Burgermeister 26.11.09, //============================================================ // de: Die Reihenfolge und Anzahl der Buttons ist über die (alphabetische) Variable customEditButtons wählbar. // 28.11.09 Erweiterte Tabelle eingefügt, eigene Signatur gelöscht // 22.01.10 Korrektur wegen der beiden Icons am Anfang // 01.02.12 Liste und Nummerierung verbessert var XEBOrder=[]; var attributes = ["imageFile","speedTip","tagOpen","tagClose","sampleText"]; // isMSIE55 //fills the variable mwCustomEditButtons (s. function in /wikibits.js), with buttons for the toolbar function addCustomButton(){ var a = {}; for (d in attributes) a[attributes[d]] = arguments[d]; mwCustomEditButtons.push(a); }; if (typeof usersignature == 'undefined') var usersignature = '-- \~\~\~\~'; var Isrc='http://upload.wikimedia.org/wikipedia/commons/'; var BDict={ 'A':['e/e9/Button_headline2.png','Sekundäre Überschrift','\n=== ',' ===','Sekundäre Überschrift'], 'A3':['/3/3a/Button_headline3.png','Untergeordnete Überschrift','\n==== ',' ====','Untergeordnete Überschrift'], 'B':['1/13/Button_enter.png','Zeilenumbruch','<br />','',''], 'B1':['6/62/Button_desambig.png','Begriffsklärungseite','{{Begriffsklärung}}','',''], 'B2':['5/5e/Button_disambig_small.png','Dieser Artikel erläutert…','{{Dieser Artikel|','}}','erläutert den Buchstaben X, zu anderen Bedeutungen siehe [[X (Begriffsklärung)]].'], 'B3':['5/5e/Button_disambig_small.png','Begriffsklärungshinweis','{{Begriffsklärungshinweis}}','',''], 'C':['5/5f/Button_center.png','Zentriert','<div style="text-align: center;">\n','\n<\/div>','Zentriert'], 'CF':['3/37/Btn_toolbar_commentaire.png','Chemische Formel',':<math>\u005Cmathrm{','}</math>',''], 'CO':['6/6c/Button_commons.png','Commons','{{Commons|Category:','}}','Seitenname'], 'D':['e/ea/Button_align_left.png','Left-Align','<div style="text-align: left; direction: ltr; margin-left: 1em;">\n','\n<\/div>','Left-aligned Text'], 'DS':['4/4e/Button_romain.png','SORTIERUNG','{{SORTIERUNG:','}}','Sortierbegriff'], 'DO':['e/e9/Button_done.png','Erledigt (kurz)','{{Erl.}}','',''], 'ER':['9/9d/Button_fait.png','Erledigt (lang)','{{Erledigt|1=' + usersignature,'}}',''], 'E':['0/04/Button_array.png','Tabelle','\n{| class="wikitable" \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n',''], 'E1':['6/60/Button_insert_table.png','erweiterte Tabelle','\n{| class="wikitable" \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n',''], 'F':['8/8f/Button_poeme.png','Farbiger Text','<span style="color: color">','<\/span>','Farbig'], 'FS':['1/1b/Button_miss_signature.png','Fehlende Signatur','\{\{ers\:Unsigned|','}}','BENUTZER'], 'G':['9/9e/Btn_toolbar_gallery.png','Bildergalerie',"\n<gallery>\nDatei:M63.jpg|[[M63]]\nDatei:Mona Lisa.jpg|[[Mona Lisa]]\nDatei:Truite arc-en-ciel.jpg|Eine [[Forelle ]]\n<\/gallery>","",''], 'H':['7/74/Button_comment.png','Versteckter Kommentar',"<!--","-->",'Versteckt'], 'I':['4/41/Button_hr_halfwidth.png','Gedankenstrich','–','',''], 'I1':['6/6a/Button_sup_letter.png','Hochgestellter Text (superscript)','<sup>','<\/sup>','Hochgestellt'], 'I2':['a/aa/Button_sub_letter.png','Tiefgestellter Text (subscript)','<sub>','<\/sub>','Tiefgestellt'], 'J1':['5/58/Button_small.png','Kleingeschriebener Text (small)','<small>','<\/small>','Klein'], 'J2':['5/56/Button_big.png','Größerer Text (big)','<big>','<\/big>','Groß'], 'K':['b/b4/Button_category03.png','Kategorie',"[[Kategorie:","]]",'Name der Kategorie'], 'KR':['b/b1/Button_dagger.png','Kreuz','†','',''], 'L':['8/8e/Button_shifting.png','Setze Tab(s)',':','',':'], 'M':['f/fd/Button_blockquote.png','Markiert ein Zitat mit Absatz','<blockquote style="border: 1px solid blue; padding: 2em;">\n','\n<\/blockquote>','Text'], 'N':['4/4b/Button_nbsp.png','Geschütztes Leerzeichen (nonbreaking space)',' ','',''], 'NT':['b/bf/Button_thinsp.png','Schmales geschütztes Leerzeichen',' ','',''], 'O':['2/23/Button_code.png','Code einfügen','<code>','<\/code>','Code'], 'P':['3/3c/Button_pre.png','Vorformatierter Text','<pre>','<\/pre>','Präformatierter Text'], 'P1':['9/93/Button_sub_link.png','Link zu einem Seiten-Abschnitt','[[Seite#',']]','Abschnitt'], 'PF':['f/ff/Button_arrow_right.png','Pfeil nach rechts','\u2192','',''], 'PD':['e/ee/Button_vote_biblio.png','Personendaten','{{Personendaten\n|NAME=\n|ALTERNATIVNAMEN=','\n|KURZBESCHREIBUNG=\n|GEBURTSDATUM=\n|GEBURTSORT=\n|STERBEDATUM=\n|STERBEORT=\n}}',''], 'PO':['c/c7/Button_polytonique.png','Unicode-Sonderzeichen der altgriechischen Schrift','{{Polytonisch|','}}','Text'], 'Q':['d/d3/Button_definition_list.png','Definitionsliste','\n; ',' : ','Text'], 'Q1':['0/05/Button_Anf%C3%BChrung.png','Anführungszeichen',"„","“",'Text'], 'Q2':['2/26/Button_latinas.png','Latinas',"«","»",'Text'], 'Q3':['b/bc/Button_guillemet.png','Guillemets',"»","«",'Text'], 'R':['7/79/Button_reflink.png','Markiere eine Referenz','<ref>','<\/ref>','Bezugsangabe'], 'R1':['c/c4/Button_ref.png','Referenz mit Name','<ref name="">','<\/ref>','Bezugsangabe'], 'R2':['f/fe/Button_refs.png','Wiederholungs-Referenz','<ref name="','"/>','Referenzname'], 'R3':['9/9a/Button_references.png','Referenz-Footer','\n== Einzelnachweise ==\n<references />\n','',''], 'RD':['7/70/Button_fusion.png','Redundanz','{{ers:Redundanz|','}}','Artikel1|Artikel2|Artikel3…'], 'S':['c/c9/Button_strike.png','Durchgestrichener Text',"<s>","<\/s>",'Durchgestrichen'], 'SA':['b/bb/Seealso.png','Siehe auch','\n== Siehe auch ==\n','',''], 'SC':['0/02/Button_S_yellow.png','SourceCode hervorheben','<source lang="javascript">',"<\/source>",'Quelltext'], 'SM':['7/74/Button_oeil.png','Smiley','<tt style="background:#FE3">','</tt>',':D'], 'ST':['7/72/Button_span_2.png','span-tag mit CSS-Angabe','<span style="">','<\/span>','Markierter Inhalt'], 'T':['e/eb/Button_plantilla.png','Vorlage','{{','}}','Vorlagenname'], 'TL':['e/eb/Button_templatelink.png','Vorlagenlink','{{[[Vorlage:','|]]}}','Vorlagenname'], 'TT':['3/30/Tt_icon.png','Schreibmaschinenstil','<tt>','<\/tt>','Teletyper Text'], 'U':['f/fd/Button_underline.png','Unterstreichen',"<u>","<\/u>",'Unterstrichener Text'], 'UR':['e/ec/Button_aviso.png','Urheberrecht ungeklärt',"{{Urheberrecht ungeklärt}}","",''], 'URV':['9/9d/Button_halt.png','Urheberrechtsverletzung',"{{URV}} [","] " + usersignature,'Url'], 'V':['c/c8/Button_redirect.png','Weiterleitung (Redirect)',"#WEITERLEITUNG [[","]]",'Ziel einfügen'], 'VP':['b/ba/Button_conserver.png','Vote *pro*',"# {{pro}} " + usersignature,"",''], 'VC':['f/fc/Button_supp.png','Vote *contra*',"# {{contra}} " + usersignature,"",''], 'VN':['4/4e/Button_neutre.png','Vote *neutral*',"# {{neutral}} " + usersignature,"",''], 'WB':['6/61/Button_wikibooks.png','Wikibooks',"{{Wikibooks","}}",'|Seitenname'], 'WS':['e/eb/Button_wikisource.png','Wikisource',"{{Wikisource","}}",'|Seitenname'], 'WT':['b/bf/WP-icon.png','Wiktionary',"{{Wiktionary","}}",'|Seitenname'], 'WV':['b/b5/Button_wikiversity.png','Wikiversity',"{{Wikiversity","}}",'|Seitenname'], 'W':['8/88/Btn_toolbar_enum.png','Nummerierung',"\n# ","",'Element 1'], 'X':['1/11/Btn_toolbar_liste.png','Liste',"\n* ","",'Element A'], 'Y1':['c/ce/Button_no_include.png','No Include',"<noinclude>","<\/noinclude>",'Text'], 'Y2':['7/79/Button_include.png','Include only',"<includeonly>","<\/includeonly>",'Text'], 'Z':['3/35/Button_substitute.png','Ersetzen',"{{ers:","}}",'Vorlage'], 'ZI':['8/83/Button_biocitas.png','Zitat',"{{Zitat|","}}",'Text|Autor (optional)|Quelle (optional)'], 'T1':['c/c6/Blending_blue_button_background.png','Spacer (no function)','','',''] }; function initButtons(){ var bc,d; if (typeof customEditButtons!='string') // can be modified XEBOrder="A,A3,B,E,E1,F,G,H,I1,I2,J1,K,M,Q,R,R1,R2,R3,S,T,U,TT,W,X".split(","); // eingebaute Icons: // Sekundäre A=Überschrift, A3=Untergeordnete Überschrift, B=Zeilenumbruch, E=Prettytable, F=Farbiger Text, G=Bildergallerie // H=Versteckter Kommentar, I1=Hochgestellt, I2=Tiefgestellt, J1=Kleingeschrieben, K=Name der Kategorie, M=Zitat mit Absatz, // Q=Definitionsliste , R=Markiere eine Referenz , R1=Referenz mit Name , R2=Wiederholungsreferenz , R3=Referenzfooter // T=Vorlagenname ,U=Unterstreichen , V=Weiterleitung , W=Nummerierung , X=Liste else if (customEditButtons.toLowerCase()=='all') for (b in BDict) XEBOrder.push(b); else XEBOrder=customEditButtons.split(","); for (b in BDict) BDict[b][0] = Isrc+BDict[b][0]; // // Add the start of the URL (Isrc) to the XEB buttons // If the user has defined any buttons then add them into the available button lists if (typeof myButtons=='object') for (b in myButtons) BDict[b] = myButtons[b]; // custom user buttons // Add the media wiki standard buttons into the available buttons for (b in mwEditButtons) { // add standard buttons for full XEB order changing BDict[b]=[]; // for (d in mwEditButtons[b]) for (d in attributes) BDict[b].push(mwEditButtons[b][attributes[d]]); } // Build the new buttons for (i=0;i<XEBOrder.length;i++) { bc = BDict[XEBOrder[i]]; //try { // catch not existing button names addCustomButton(bc[0],bc[1],bc[2],bc[3],bc[4]); //} // catch(e) {continue} } // Remove the default buttons (if requested by the user) eraseButtons(); }; //============================================================ // Table generator //============================================================ /** en: Generate an array using Mediawiki syntax * @author: originally from fr:user:dake * @version: 0.2 */ function generateTable(caption, exhead, nbCol, nbRow, exfield, align, sortable){ var code = "\n"; code += '{| class="wikitable ' + align + sortable+ '"\n' + caption + exhead; if (exfield) code += '!\n'; for (i=1;i<nbCol+1;i++) code += '! FELD ' + i + '\n'; var items = 0; for (var j=0;j<nbRow;j++){ if (exfield) { items++; code += '|-\n! style="background: #FFDDDD;"|ITEM ' + items + '\n'; } else code += '|-\n'; for (i=0;i<nbCol;i++) code += '| Element\n'; } code += '|}\n'; insertTags('','', code); editform.elements['wpSummary'].value+=' table+'; return false }; /** en: Open a popup with parameters to generate an array. * The number of rows/columns can be modified. * @author: originally fr:user:dake * @version: 0.2 */ function popupTable(){ var popup = window.open('about:blank','WPtable','height=400,width=400,scrollbars=yes'); var javaCode = '<script type="text\/javascript">function insertCode(){' +'var caption = (document.paramForm.inputCaption.checked)?"\|\+ TABLE CAPTION \\n":""; ' +'var exhead = (document.paramForm.inputHead.checked)?\'\|\- style=\"background: #DDFFDD;\"\\n\':""; ' +'var row = parseInt(document.paramForm.inputRow.value); ' +'var col = parseInt(document.paramForm.inputCol.value); ' +'var exfield = document.paramForm.inputItems.checked; ' +'var align = (document.paramForm.inputAlign.checked)?\'center\':""; ' +'var sortable = (document.paramForm.inputSortable.checked)?\'sortable\':""; ' +'window.opener.generateTable(caption,exhead,col,row,exfield,align,sortable); ' +'window.close()}<\/script>'; popup.document.write('<html><head><title>Erweiterte Tabelleneinstellungen<\/title>' // +'<script type="text\/javascript" src="\/skins-1.5\/common\/wikibits.js"><\/script>' //+'<style type="text\/css" media="screen,projection">/*<![CDATA[*/ @import "\/skins-1.5\/monobook\/main.css?5"; /*]]>*/<\/style>' + javaCode +'<\/head><body>' +'<Font size="2" color="#33386D" face="Verdana">' +'<p><b>Gib die Parameter ein: <\/b><\/p>' +'<form name="paramForm">' +'Titel: <input type="checkbox" name="inputCaption"><p\/>' +'Ausrichtung: auf Breite zentriert <input type="checkbox" name="inputAlign"><p\/>' +'Tabellenkopfzeilen: farbig <input type="checkbox" name="inputHead"><p\/>' +'Anzahl der Reihen: <input type="text" name="inputRow" value="3" size="2"><p\/>' +'Anzahl der Spalten: <input type="text" name="inputCol" value="3" size="2"><p\/>' //+'Alternating grey lines: <input type="checkbox" name="inputLine" checked="1" ><p\/>' +'Definitionsspalte: <input type="checkbox" name="inputItems" ><p\/>' +'Sortierbar: <input type="checkbox" name="inputSortable" ><p\/>' +'<\/form">' +'<i>' +'Wähle "Definitionsspalte", wenn die 1. Spalte Definitionen enthalten soll.<\/i><p\/>' +'<p><a href="javascript:insertCode()"> Einfügen der Tabelle<\/a> |' +' <a href="javascript:self.close()">Cancel<\/a><\/p>' +'<\/font><\/body><\/html>'); popup.document.close(); return false }; /** en: Removes arbitrary standard buttons from the toolbar * @author: [[:de:User:Olliminatore]] * @version: 0.2 (01.10.2006) **/ function eraseButtons(){ if(typeof rmEditButtons!='object') return; if (typeof rmEditButtons[0] == 'string' && rmEditButtons[0].toLowerCase() == 'all') return mwEditButtons=[]; //Remove the buttons the user doesn't want for(i=0;i<rmEditButtons.length;i++){ var n=rmEditButtons[i]-i; if(n>=0 && n<mwEditButtons.length){ if(n<mwEditButtons.length){ var x = -1; while((++x)<mwEditButtons.length) if(x>=n) mwEditButtons[x] = mwEditButtons[x+1]; } mwEditButtons.pop(); } } }; // Adds extended onclick-function to some buttons function extendButtons(){ if(!(allEditButtons = document.getElementById('toolbar'))) return false; if(typeof editform == 'undefined') if(!(window.editform = document.editform)) return false; XEBOrder.getIndex = function (item){ if(is_gecko) return this.indexOf(item); else //is IE (Opera < 9) for (var i=0;i < this.length;i++) if (this[i]==item) return Number(i); return -1 } var searchbox = allEditButtons.getElementsByTagName('span')[0]; if (searchbox) allEditButtons.appendChild(searchbox) // pay Zocky/Search Box allEditButtons = allEditButtons.getElementsByTagName('img'); var bu_len = mwEditButtons.length; if(!allEditButtons.length) return false; // table c=XEBOrder.getIndex('E1'); if(c != -1) allEditButtons[bu_len+c+2].onclick=popupTable; // redirect c=XEBOrder.getIndex('V'); if(c != -1) allEditButtons[bu_len+c+2].onclick=function(){ if (a = window.prompt("Wohin soll der Redirect\?", "")) { a = '\#WEITERLEITUNG \[\[' + a + '\]\]'; editform.wpTextbox1.value=a; editform.wpSummary.value=a; // not more needed? editform.wpWatchthis.checked=false } }; // spacer width if((c = XEBOrder.getIndex('T1')) != -1) allEditButtons[bu_len+c].width = 6; }; if ((wgAction=="edit") || (wgAction=="submit")) addOnloadHook(initButtons); if(!wgIsArticle) // only if edit hookEvent("load", extendButtons); //================================================================================ //*** Dynamic Navigation Bars aus Wikipedia.org am 9.3.09 // set up the words in your language var NavigationBarHide = 'Einklappen'; var NavigationBarShow = 'Ausklappen'; // set up max count of Navigation Bars on page, // if there are more, all will be hidden // NavigationBarShowDefault = 0; // all bars will be hidden // NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden if (typeof NavigationBarShowDefault == 'undefined' ) { var NavigationBarShowDefault = 1; } // adds show/hide-button to navigation bars addOnloadHook(function() { // shows and hides content and picture (if available) of navigation bars // Parameters: // indexNavigationBar: the index of navigation bar to be toggled function toggleNavigationBar(indexNavigationBar) { var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); if (!NavFrame || !NavToggle) { return false; } // if shown now if (NavToggle.firstChild.data == NavigationBarHide) { for ( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) { if (NavChild.className == 'NavPic') { NavChild.style.display = 'none'; } if (NavChild.className == 'NavContent') { NavChild.style.display = 'none'; } if (NavChild.className == 'NavToggle') { NavChild.firstChild.data = NavigationBarShow; } } // if hidden now } else if (NavToggle.firstChild.data == NavigationBarShow) { for ( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) { if (NavChild.className == 'NavPic') { NavChild.style.display = 'block'; } if (NavChild.className == 'NavContent') { NavChild.style.display = 'block'; } if (NavChild.className == 'NavToggle') { NavChild.firstChild.data = NavigationBarHide; } } } } function toggleNavigationBarFunction(indexNavigationBar) { return function() { toggleNavigationBar(indexNavigationBar); return false; }; } var indexNavigationBar = 0; // iterate over all < div >-elements var divs = document.getElementsByTagName("div"); for (var i=0; i<divs.length; i++) { var NavFrame = divs[i]; // if found a navigation bar if (NavFrame.className == "NavFrame") { indexNavigationBar++; var NavToggle = document.createElement("a"); NavToggle.className = 'NavToggle'; NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); NavToggle.setAttribute('href', '#'); NavToggle.onclick = toggleNavigationBarFunction(indexNavigationBar); var NavToggleText = document.createTextNode(NavigationBarHide); NavToggle.appendChild(NavToggleText); // add NavToggle-Button as first div-element // in < div class="NavFrame" > NavFrame.insertBefore( NavToggle, NavFrame.firstChild ); NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); } } // if more Navigation Bars found than Default: hide all if (NavigationBarShowDefault < indexNavigationBar) { for( var i=1; i<=indexNavigationBar; i++ ) { toggleNavigationBar(i); } } }); //================================================================================ /** Toggles the display of elements on a page Author/contact: Austin Che http://openwetware.org/wiki/User:Austin_J._Che See http://openwetware.org/wiki/OpenWetWare:Toggle for examples and documentation */ // indexed array of toggler ids to array of associated toggle operations // each operation is a two element array, the first being the type, the second a class name or array of elements // operation types are strings like "_reset" or "" for the default toggle operation var togglers = new Array(); var allClasses = new Object(); // associative map of class names to page elements function toggler(id) { var toBeToggled = togglers[id]; if (!toBeToggled) return; // if some element is in list more than once, it will be toggled multiple times for (var i = 0; i < toBeToggled.length; i++) { // get array of elements to operate on var toggles = toBeToggled[i][1]; if (typeof(toggles) == "string") { if (toggles.charAt(0) == '-') { // treat as an element ID, not as class toggles = document.getElementById(toggles.substring(1)); if (toggles) toggles = new Array(toggles); } else toggles = allClasses[toggles]; } if (!toggles || !toggles.length) continue; var op = toBeToggled[i][0]; // what the operation will be switch (op) { case "_reset": for (var j in toggles) toggles[j].style.display = toggles[j]._toggle_original_display; break; case "_show": for (var j in toggles) toggles[j].style.display = ''; break; case "_hide": for (var j in toggles) toggles[j].style.display = 'none'; break; case "": default: // Toggle for (var j in toggles) toggles[j].style.display = ((toggles[j].style.display == 'none') ? '' : 'none'); break; } } } function createTogglerLink(toggler, id) { var toggle = document.createElement("a"); toggle.className = 'toggler-link'; toggle.setAttribute('id', 'toggler' + id); toggle.setAttribute('href', 'javascript:toggler("' + id + '");'); var child = toggler.firstChild; toggler.removeChild(child); toggle.appendChild(child); toggler.insertBefore(toggle, toggler.firstChild); } function toggleInit() { var togglerElems = new Array(); var toggleGroup = new Array(); // initialize/clear any old information togglers = new Array(); allClasses = new Object(); // make list of all document classes var elems = document.getElementsByTagName("*"); var numelems = elems.length; for (var i = 0; i < elems.length; i++) { var elem = elems[i]; if (!elem.className) continue; elem._toggle_original_display = elem.style.display; var togglerID = -1; var elemClasses = elem.className.split(' '); // get list of classes for (var j = 0; j < elemClasses.length; j++) { var elemClass = elemClasses[j]; if (! allClasses[elemClass]) allClasses[elemClass] = new Array(); allClasses[elemClass].push(elem); // all the special classes begin with _toggle if (elemClass.substring(0, 7) != "_toggle") continue; if (elemClass == "_togglegroup") toggleGroup = new Array(); else if (elemClass == "_toggle") toggleGroup.push(elem); else if (elemClass.substring(0, 12) == "_toggle_init") { // set initial value for display (ignore the original CSS set value) // understands _toggle_initshow and _toggle_inithide var disp = elemClass.substring(12); if (disp == "show") elem.style.display = ''; else if (disp == "hide") elem.style.display = 'none'; elem._toggle_original_display = disp; } else if (elemClass.substring(0, 8) == "_toggler") { if (togglerID == -1) { togglerID = togglers.length; togglers[togglerID] = new Array(); togglerElems[togglerID] = elem; } // all classes are of form _toggler_op-CLASS // figure out what class we're toggling // if none is specified, then we use the current toggle group var toBeToggled; var hyphen = elemClass.indexOf('-'); if (hyphen != -1) toBeToggled = elemClass.substring(hyphen+1); else { toBeToggled = toggleGroup; hyphen = elemClass.length; } var op = elemClass.substring(8, hyphen); togglers[togglerID].push(new Array(op, toBeToggled)); } } } // add javascript links to all toggler elements for (var i = 0; i < togglerElems.length; i++) createTogglerLink(togglerElems[i], i); } addOnloadHook(toggleInit); //================================================================================ // fügt für Hochladen automatisch die entsprechende Beschreibung ein. // aus : http://de.wiktionary.org/wiki/MediaWiki:Common.js/Archiv_2008-04-28 // editbox.value = "{"+"{Information\n" geändert in: editbox.value = "{"+"{Information ohne UploadWizard\n" (idea-sketch, 08.01.2014) if ( wgCanonicalSpecialPageName == "Upload" ) { function setSpecialUploadTemplate() { var editbox = document.getElementById('wpUploadDescription'); if (!editbox) return; if (editbox.value != '') return; editbox.value = "{"+"{Information ohne UploadWizard\n" + "|Beschreibung = \n" + "|Quelle = \n" + "|Urheber = \n" + "|Datum = \n" + "|Genehmigung = \n" + "|Andere Versionen = \n" + "|Anmerkungen = \n" + "}"+"}"; } addOnloadHook(setSpecialUploadTemplate); } // </syntax>