|
|
(31 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt) |
Zeile 1: |
Zeile 1: |
− | var XEBOrder=[];
| + | 'F':['color.png','Farbiger Text','<span style="color: Farbe">','<\/span>','Farbiger Text'], |
− | var attributes = ["imageFile","speedTip","tagOpen","tagClose","sampleText"];
| + | 'PRE':['pre.png','Vorformatierter Text','<pre>','<\/pre>','Vorformatierter Text'], |
− | var usersignature = '--\~\~\~\~';
| + | 'COD':['code.png','Code einfügen','<code>','<\/code>','Code'], |
− | var Isrc='http://upload.wikimedia.org/wikipedia/commons/';
| + | 'TT':['tt.png','Schreibmaschinenstil','<tt>','<\/tt>','Teletyper Text'], |
− | var BDict={
| + | |
− | //'ID':['Bild','Tooltip','Vor Text','Nach Text','Beispiel'],
| + | |
− | 'A2':['e/e9/Button_headline2.png','Sekundäre Überschrift','\n=== ',' ===','Sekundäre Überschrift'],
| + | |
− | 'A3':['/3/3a/Button_headline3.png','Untergeordnete Überschrift','\n==== ',' ====','Untergeordnete Überschrift'],
| + | |
− | //Textformatierung
| + | |
− | 'U':['f/fd/Button_underline.png','Unterstrichener Text',"<u>","<\/u>",'Unterstrichener Text'],
| + | |
− | 'S':['c/c9/Button_strike.png','Durchgestrichener Text',"<s>","<\/s>",'Durchgestrichen'],
| + | |
− | 'SML':['5/58/Button_small.png','Kleingeschriebener Text (small)','<small>','<\/small>','Klein'],
| + | |
− | 'BIG':['5/56/Button_big.png','Größerer Text (big)','<big>','<\/big>','Groß'],
| + | |
− | 'C':['5/5f/Button_center.png','Zentriert','<div style="text-align: center;">\n','\n<\/div>','Zentriert'],
| + | |
− | 'F':['8/8f/Button_poeme.png','Farbiger Text','<span style="color: Farbe">','<\/span>','Farbiger Text'], | + | |
− | 'SUP':['6/6a/Button_sup_letter.png','Hochgestellter Text','<sup>','<\/sup>','Hochgestellter Text'],
| + | |
− | 'SUB':['a/aa/Button_sub_letter.png','Tiefgestellter Text','<sub>','<\/sub>','Tiefgestellter Text'],
| + | |
− | 'PRE':['3/3c/Button_pre.png','Vorformatierter Text','<pre>','<\/pre>','Vorformatierter Text'], | + | |
− | 'COD':['2/23/Button_code.png','Code einfügen','<code>','<\/code>','Code'], | + | |
− | 'TT':['3/30/Tt_icon.png','Schreibmaschinenstil','<tt>','<\/tt>','Teletyper Text'], | + | |
− | //
| + | |
− | 'G':['9/9e/Btn_toolbar_gallery.png','Bildergalerie',"\n<gallery>\nDatei:55a SpongeBob.jpg|[[SpongeBob Schwammkopf]]\nDatei:PatrickStar.jpg|[[Patrick Star]]\nDatei:56b Thaddäus.jpg|[[Thaddäus Tentakel]]\n<\/gallery>","",''],
| + | |
− | 'T':['0/04/Button_array.png','Tabelle','\n{| class="wikitable" border="1" \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n',''],
| + | |
− | //
| + | |
− | 'K':['b/b4/Button_category03.png','Kategorie',"[[Kategorie:","]]",'Name der Kategorie'],
| + | |
− | 'V':['e/eb/Button_plantilla.png','Vorlage','{{','}}','Vorlagenname'],
| + | |
− | //Liste
| + | |
− | 'L1':['1/11/Btn_toolbar_liste.png','Liste',"\n* Element A\n* Element B\n* Element C","",''],
| + | |
− | 'L2':['8/88/Btn_toolbar_enum.png','Nummerierte Liste',"\n# Element 1\n# Element 2\n# Element 3","",''],
| + | |
− | //
| + | |
− | 'BR':['1/13/Button_enter.png','Zeilenumbruch','<br />','',''],
| + | |
− | 'KO':['7/74/Button_comment.png','Versteckter Kommentar',"<!--","-->",'Kommentar'],
| + | |
− | 'ST':['7/72/Button_span_2.png','span-Tag mit CSS-Angabe','<span style="">','<\/span>','Markierter Inhalt'],
| + | |
− | 'NBS':['4/4b/Button_nbsp.png','Geschütztes Leerzeichen (nonbreaking space)',' ','',''],
| + | |
− | //
| + | |
− | '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'],
| + | |
− | //
| + | |
− | 'W':['c/c8/Button_redirect.png','Weiterleitung (Redirect)',"#WEITERLEITUNG [[","]]",'Ziel einfügen'],
| + | |
− | 'P':['9/93/Button_sub_link.png','Link zu einem Seiten-Abschnitt','[[Seite#',']]','Abschnitt'],
| + | |
− | //Zeichen
| + | |
− | 'AZ':['0/05/Button_Anf%C3%BChrung.png','Anführungszeichen',"„","“",'Text'],
| + | |
− | 'GS':['4/41/Button_hr_halfwidth.png','Gedankenstrich','–','',''],
| + | |
− | //Vorlagen
| + | |
− | 'BK':['6/62/Button_desambig.png','Begriffsklärungseite','{{Begriffsklärung}}','',''],
| + | |
− | 'ZI':['8/83/Button_biocitas.png','Zitat',"{{Zitat|","}}",'Text|Autor|Quelle'],
| + | |
− | 'FS':['1/1b/Button_miss_signature.png','Fehlende Signatur','\{\{Unsigniert|','}}','Benutzername|Zeitpunkt|' + usersignature,],
| + | |
− | 'Y1':['c/ce/Button_no_include.png','No Include',"<noinclude>","<\/noinclude>",'Text'],
| + | |
− | 'Y2':['7/79/Button_include.png','Include only',"<includeonly>","<\/includeonly>",'Text'],
| + | |
− | //Abstimmungen
| + | |
− | 'VP':['b/ba/Button_conserver.png','Pro',"# {{pro}} " + usersignature,"",''],
| + | |
− | 'VC':['f/fc/Button_supp.png','Kontra',"# {{contra}} " + usersignature,"",''],
| + | |
− | //
| + | |
− | 'X0':['c/c6/Blending_blue_button_background.png','','','',''],
| + | |
− | 'X1':['c/c6/Blending_blue_button_background.png','','','',''],
| + | |
− | 'X2':['c/c6/Blending_blue_button_background.png','','','',''],
| + | |
− | 'X3':['c/c6/Blending_blue_button_background.png','','','',''],
| + | |
− | 'X4':['c/c6/Blending_blue_button_background.png','','','',''],
| + | |
− | 'X5':['c/c6/Blending_blue_button_background.png','','','',''],
| + | |
− | 'X6':['c/c6/Blending_blue_button_background.png','','','',''],
| + | |
− | 'X7':['c/c6/Blending_blue_button_background.png','','','',''],
| + | |
− | };
| + | |
| | | |
− | function addCustomButton(){
| + | *'K':['category.png','Kategorie','[[Kategorie:',']]','Name der Kategorie'], |
− | var a = {};
| + | *'V':['template.png','Vorlage','{{','}}','Vorlagenname'], |
− | for (d in attributes) a[attributes[d]] = arguments[d];
| + | |
− | mwCustomEditButtons.push(a);
| + | |
− | }; | + | |
| | | |
− | function initButtons(){
| + | 'ST':['span.png','span-Tag mit CSS-Angabe','<span style="">','<\/span>','Markierter Inhalt'], |
− | var bc,d;
| + | *'NBS':['nbsp.png','Geschütztes Leerzeichen (nonbreaking space)',' ','',''], |
− | if (typeof customEditButtons!='string') // can be modified
| + | |
− | XEBOrder="X0,A2,A3,U,S,SML,BIG,C,F,SUP,SUB,PRE,COD,TT,X1,G,T,X2,K,V,L1,L2,X3,BR,KO,ST,NBS,X4,L,M,X5,W,P,X6,AZ,GS,X7,BK,ZI,FS,Y1,Y2,VP,VC".split(",");
| + | |
− | 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
| + | 'M':['blockquote.png','Markiert ein Zitat mit Absatz','<blockquote style="border: 1px solid blue; padding: 2em;">\n','\n<\/blockquote>','Text'], |
− | // 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
| + | 'P':['sublink.png','Link zu einem Seiten-Abschnitt','[[Seite#',']]','Abschnitt'], |
− | 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();
| + | |
− | };
| + | |
| | | |
| + | *'CR':['copyright.png','Copyright','©','',''], |
| + | *'AZ':['quotes.png','Anführungszeichen','„','“','Text'], |
| + | *'AP':['apostrophe.png','Apostroph','’','',''], |
| + | *'GS':['dash.png','Gedankenstrich','–','',''], |
| | | |
− | // Table generator
| + | 'BK':['disambig.png','Begriffsklärungseite','{{Begriffsklärung}}','',''], |
− | /** @author: originally from fr:user:dake
| + | 'ZI':['cite.png','Zitat','{{Zitat|','}}','Text|Autor|Quelle'], |
− | * @version: 0.2 */ | + | 'FS':['signature.png','Fehlende Signatur','\{\{Unsigniert|','}}','Benutzername|Zeitpunkt|' + usersignature,], |
| + | *'Y1':['noinclude.png','No Include','<noinclude>','<\/noinclude>','Text'], |
| + | *'Y2':['includeonly.png','Include only','<includeonly>','<\/includeonly>','Text'], |
| | | |
− | function generateTable(caption, exhead, nbCol, nbRow, exfield, align){
| + | 'VP':['pro.png','Pro','#{{pro}} ' + usersignature,'',''], |
− | var code = "\n";
| + | 'VC':['contra.png','Kontra','#{{contra}} ' + usersignature,'',''], |
− | code += '{| class="wikitable" ' + align + '\n';
| + | |
− | 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
| + | |
− | };
| + | |
− | | + | |
− | function popupTable(){
| + | |
− | var popup = window.open('about:blank','WPtable','height=200,width=300,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)?\'align="center"\':""; '
| + | |
− | +'window.opener.generateTable(caption,exhead,col,row,exfield,align); '
| + | |
− | +'window.close()}<\/script>';
| + | |
− | | + | |
− | popup.document.write('<html><head><title>Tabelle erstellen<\/title>'
| + | |
− | + javaCode +'<\/head><body>'
| + | |
− | +'<form name="paramForm">'
| + | |
− | +'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\/>'
| + | |
− | +'Tabelle zentrieren <input type="checkbox" name="inputAlign"><p\/>'
| + | |
− | +'<\/form">'
| + | |
− | +'<p><a href="javascript:insertCode()">Tabelle einfügen<\/a> |'
| + | |
− | +' <a href="javascript:self.close()">Schließen<\/a><\/p>'
| + | |
− | +'<\/body><\/html>');
| + | |
− | popup.document.close();
| + | |
− | return false
| + | |
− | };
| + | |
− | | + | |
− | 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;
| + | |
− | var c=0;
| + | |
− | | + | |
− | if(!allEditButtons.length) return false;
| + | |
− |
| + | |
− | // Tabelle
| + | |
− | if((c=XEBOrder.getIndex('T')) != -1) allEditButtons[bu_len+c].onclick=popupTable;
| + | |
− | | + | |
− | // Weiterleitung
| + | |
− | c=XEBOrder.getIndex('W');
| + | |
− | if(c != -1)
| + | |
− | allEditButtons[bu_len+c].onclick=function(){
| + | |
− | if (a = window.prompt("Wohin soll der Redirect\?", "")) {
| + | |
− | a = '\#WEITERLEITUNG \[\[' + a + '\]\]';
| + | |
− | }
| + | |
− | };
| + | |
− | | + | |
− | if((c = XEBOrder.getIndex('X0')) != -1) allEditButtons[bu_len+c].width = 3;
| + | |
− | if((c = XEBOrder.getIndex('X1')) != -1) allEditButtons[bu_len+c].width = 3;
| + | |
− | if((c = XEBOrder.getIndex('X2')) != -1) allEditButtons[bu_len+c].width = 3;
| + | |
− | if((c = XEBOrder.getIndex('X3')) != -1) allEditButtons[bu_len+c].width = 3;
| + | |
− | if((c = XEBOrder.getIndex('X4')) != -1) allEditButtons[bu_len+c].width = 3;
| + | |
− | if((c = XEBOrder.getIndex('X5')) != -1) allEditButtons[bu_len+c].width = 3;
| + | |
− | if((c = XEBOrder.getIndex('X6')) != -1) allEditButtons[bu_len+c].width = 3;
| + | |
− | if((c = XEBOrder.getIndex('X7')) != -1) allEditButtons[bu_len+c].width = 3;
| + | |
− | if((c = XEBOrder.getIndex('X8')) != -1) allEditButtons[bu_len+c].width = 3;
| + | |
− | if((c = XEBOrder.getIndex('X9')) != -1) allEditButtons[bu_len+c].width = 3;
| + | |
− | };
| + | |
− | | + | |
− | if ((wgAction=="edit") || (wgAction=="submit"))
| + | |
− | addOnloadHook(initButtons);
| + | |
− | | + | |
− | if(!wgIsArticle) // only if edit
| + | |
− | hookEvent("load", extendButtons);
| + | |