Benutzer:DieBuche/customToolbar.js

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
 //============================================================
 // en: ADD SOME EXTRA BUTTONS TO THE EDITPANEL
 // de: FÜGE NEUE BUTTON IN DIE WERKZEUGLEISTE [[Benutzer:Olliminatore/Extra-Editbuttons]]
 //   Converted by [[User:Olliminatore]] 25.09.2006 
 //============================================================
 // Die Reihenfolge und Anzahl der Buttons ist über die (alphabetische) Variable customEditButtons wählbar.
  //<pre><nowiki>
  var XEBOrder=[];
 // isMSIE55

 //fills the variable mwCustomEditButtons (s. function in /wikibits.js), with buttons for the Toolbar  
function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText){
 mwCustomEditButtons.push({
  "imageFile": imageFile,
  "speedTip": speedTip,
  "tagOpen": tagOpen,
  "tagClose": tagClose,
  "sampleText": sampleText});
};

if (typeof usersignature == 'undefined') var usersignature = '-- \~\~\~\~';

var Isrc='http://upload.wikimedia.org/wikipedia/commons/';
var BDict={
'A':['5/50/Bold_edi.png','Bowld','<4>','<\/4>',],
'B':['1/13/Button_enter.png','Zeilenumbruch','<br />','',''],
'C':['5/5f/Button_center.png','Center','<div style="text-align: center;">\n','\n<\/div>','Zentrierter 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'],
'E':['0/04/Button_array.png','Tabelle','\n{| border="1" \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n',''],
'F':['8/8f/Button_poeme.png','Farbigen Text','<span style="color: ColorName">','<\/span>','Text'],
 'FS':['1/1b/Button_miss_signature.png','Fehlende Signatur','\{\{subst\:Unsigned|','3='+usersignature+'}}','Text'],
'G':['9/9e/Btn_toolbar_gallery.png','Bildergalerie',"\n<gallery>\nImage:M63.jpg|[[M63]]\nImage:Mona Lisa.jpg|[[Mona Lisa]]\nImage:Truite arc-en-ciel.jpg|Eine [[Forelle ]]\n<\/gallery>","",''],
'H':['7/74/Button_comment.png','Versteckter Kommentar',"<!--","-->",''],
 'I':['b/bc/Button_guillemet.png','Guillemets',"»","«",'Text'],
'I1':['6/6a/Button_sup_letter.png','Superscript','<sup>','<\/sup>','Superscript Text'],
'I2':['a/aa/Button_sub_letter.png','Subscript','<sub>','<\/sub>','Subscript Text'],
'J1':['5/58/Button_small.png','Small','<small>','<\/small>','Small Text'],
 'J2':['5/56/Button_big.png','Größerer Text','<big>','<\/big>','Großer Text'],
'K':['b/b4/Button_category03.png','Kategorie',"[[Kategorie:","]]",'Name der Kategorie'],
 'L':['8/8e/Button_shifting.png','Insert tab(s)',':','',':'],
'M':['f/fd/Button_blockquote.png','Insert block of quoted Text','<blockquote style="border: 1px solid blue; padding: 2em;">\n','\n<\/blockquote>','Block quote'],
 'N':['4/4b/Button_nbsp.png','nonbreaking space - Leerzeichen ohne Umbruch','&nbsp;','',''],
 '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','[[Page#',']]','Abschnitt'],
'Q':['d/d3/Button_definition_list.png','Definitionsliste','\n; ',' : ','Insert Text'],
'R':['7/79/Button_reflink.png','\‹ref\›','<ref>','<\/ref>','Insert reference material'],
'R3':['9/9a/Button_references.png','Reference footer','<references/>','',''],
'S':['c/c9/Button_strike.png','Streichen',"<s>","<\/s>",'Durchgestrichener Text'],
 'SM':['7/74/Button_oeil.png','Smiley','<code style="background:#FE3">','</code>',':D'],
'T':['e/eb/Button_plantilla.png','Vorlage','{{','}}','Vorlagenname'],
 'T1':['3/30/Tt_icon.png','Schreibmaschinenstil','<code>','<\/code>','Teletyper Text'],
'U':['f/fd/Button_underline.png','Unterstreichen',"<u>","<\/u>",'Unterstrichener Text'],
'V':['c/c8/Button_redirect.png','Redirect',"#REDIRECT [[","]]",'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,"",''],
 'W':['8/88/Btn_toolbar_enum.png','Nummerierung',"\n# Element 1\n# Element 2\n# Element 3","",''],
 'X':['1/11/Btn_toolbar_liste.png','Liste',"\n* Element A\n* Element B\n* Element C","",''],
 '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','Substitute',"{{subst:","}}",'Vorlage']
};

if (typeof customEditButtons!='string') // can be modified
	XEBOrder="A,B,C,E,F,G,H,I1,I2,J1,K,M,Q,R,R3,S,T,U,V,W,X".split(",");
else if (customEditButtons.toLowerCase()=='all') 
	for (b in BDict) XEBOrder.push(b);
else XEBOrder=customEditButtons.split(",");



/** 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();
		}
	}
};


function initButtons(){
  var bc,d;
	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]) BDict[b].push(mwEditButtons[b][d]);
	}
	// Build the new buttons 
	for (i=0;i<XEBOrder.length;i++) {
		bc = BDict[XEBOrder[i]];
		addCustomButton(bc[0],bc[1],bc[2],bc[3],bc[4]);
	}
	// Remove the default buttons (if requested by the user)
	eraseButtons();
};

addOnloadHook(initButtons);



if(!wgIsArticle) // only if edit
	hookEvent("load", extendButtons);
//</nowiki></pre>