User:Bill Flanagan/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 document.write(''); 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 //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://openwetware.org/images/'; // 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',''], 'EE':['5/51/Button_LaTeX.png','LaTex Equation','','<\/math>','LaTex Expression'], '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=='Bill Flanagan')alert(msg); } var popupwindows = new Array;

function XEBPopupEquationEditor(e){ var windowname = 'equation'; var refocus = 1; var width = 700; var height = 459; var url = 'http://openwetware.org/owwequation/owwequation.php';

var latex = XEBGetSelectedText; if (latex){ url = url + '?latex=' + latex; }

if(typeof(popupwindows[windowname])!='undefined'){ newwindow = popupwindows[windowname]; }else{ newwindow=null; }

if (newwindow==null || newwindow.closed || !newwindow.location){ newwindow=window.open(url, windowname,'width='+width+',height='+height+',status=1,scrollbars=no,resizable=1'); if (!newwindow.opener){ newwindow.opener = self; }		popupwindows[windowname]=newwindow; }

if (window.focus) { newwindow.focus }	return false; }

//