User:Kraftlos/extraeditbuttons.js

// //Version: 3.1 //============================================================ // en: ADD SOME EXTRA BUTTONS TO THE EDITPANEL // de: FÜGE NEUE BUTTON IN DIE WERKZEUGLEISTE //============================================================ // Vorschläge für neue Buttons werden gerne entgegengenommen // Die Reihenfolge und Anzahl der Buttons ist über die (alphabetische) Variable XEBOrder wählbar.

//================================ //Control Variables // //rmEditButtons - Removes standard toolbar buttons //XEBOrder - The order in which the buttons are displayed

mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:MarkS/XEB/live.css&action=raw&ctype=text/css', 'text/css' );

if(typeof XEBPopups== 'undefined')XEBPopups=true; if(typeof XEBHideDelay== 'undefined')XEBHideDelay=0.5; //Time before the popup disappears after the mouse moves out if(typeof XEBExtendEditSummary == 'undefined')XEBExtendEditSummary=true; // Is the edit summary extended after a popup

var mwCustomEditButtons = window.mwCustomEditButtons || [];

//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/';

// English Wikipedia creates 11 extra buttons which are stored in mwCustomEditButtons // rather than mwEditButtons. However, there is no guarantee it will always be 11 // so we count them here. var enExtraButtons=mwCustomEditButtons.length;

var BDict={ 'A':['e/e9/Button_headline2.png','Secondary headline','\n===','===','Secondary headline'], 'B':['1/13/Button_enter.png','Line break',' ',,], 'C':['5/5f/Button_center.png','Center',' \n','\n<\/div>','Centred text'], 'D':['e/ea/Button_align_left.png','Left-Align',' \n','\n<\/div>','Left-aligned text'], 'D1':['a/a5/Button_align_right.png','Right-Align',' \n','\n<\/div>','Right-aligned text'], 'E':['0/04/Button_array.png','Table','\n{| class="wikitable" \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n',''], 'F':['1/1e/Button_font_color.png','Insert coloured text','Coloured text<\/span>','ColourName'], 'FS':['1/1b/Button_miss_signature.png','Unsigned post',,,'user name or IP'], 'G':, 'H':['7/74/Button_comment.png','Comment',"",'Comment'], 'I1':['6/6a/Button_sup_letter.png','Superscript',' ','<\/sup>','Superscript text'], 'I2':['a/aa/Button_sub_letter.png','Subscript',' ','<\/sub>','Subscript text'], 'J1':['5/58/Button_small.png','Small',' ','<\/small>','Small Text'], 'J2':['5/56/Button_big.png','Big text',' ','<\/big>','Big text'], 'K':['b/b4/Button_category03.png','Category',"",'Category name'], 'L':['8/8e/Button_shifting.png','Insert tab(s)',':','',':'], 'M':['f/fd/Button_blockquote.png','Insert block of quoted text','\n','\n<\/blockquote>','Block quote'], 'N':['4/4b/Button_nbsp.png','nonbreaking space',' ',,], 'O':['2/23/Button_code.png','Insert code',' ' +'Size:' +'small' +'[Normal]' +'big' +' <\/td><\/tr>' +'<\/form>' +'Sample:' +' Text "'		+' Insert '		+'Cancel ';

curPopup.setInnerHTML(mt);

return true; }

function XEBUpdateSampleText {	f=document.XEBPopupImageForm; }

//====================

function XEBMenuMouseOut(e) {	var targ; if (!e) var e = window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement;

targ.style.color='black'; }

function XEBMenuMouseOver(e) {	var targ; if (!e) var e = window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement;

targ.style.color='red'; }

//======================================================================= // Other functions //=======================================================================

function XEBgetElementsByClassName(parent,clsName,htmltag){ var arr = new Array; var elems = parent.getElementsByTagName(htmltag); for ( var cls, i = 0; ( elem = elems[i] ); i++ ){ if ( elem.className == clsName ){ arr[arr.length] = elem; }	}	return arr; }

function extendSummary(newText) {	if(!XEBExtendEditSummary)return; s=document.editform.elements['wpSummary'].value; s+=(s=='')?newText:' +'+newText; document.editform.elements['wpSummary'].value=s; }

function bug(msg) {	if(wgUserName=='MarkS')alert(msg); }

//