User talk:MarkS/extraeditbuttons.js

From Wikipedia, the free encyclopedia

//

function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText){
 mwCustomEditButtons.push({
  "imageFile": imageFile,
  "speedTip": speedTip,
  "tagOpen": tagOpen,
  "tagClose": tagClose,
  "sampleText": sampleText});
}

Isrc='http://upload.wikimedia.org/wikipedia/';
addCustomButton(Isrc+'en/c/c9/Button_strike.png','Strike','<s>','</s>','Strike-through text');
addCustomButton(Isrc+'en/e/ea/Button_align_left.png','Left-Align','<div style="text-align: left; direction: ltr; margin-left: 1em;">\n','\n</div>','Left-aligned text');
addCustomButton(Isrc+'en/5/5f/Button_center.png','Center','<div style="text-align: center;">\n','\n</div>','Centered text');
addCustomButton(Isrc+'en/6/60/Button_insert_table.png','Table','\n{| border=1 \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n','');
addCustomButton(Isrc+'en/1/13/Button_enter.png','Line break','<br />','','');
addCustomButton(Isrc+'en/8/80/Button_upper_letter.png','Superscript','<sup>','</sup>','Superscript text');
addCustomButton(Isrc+'en/7/70/Button_lower_letter.png','Subscript','<sub>','</sub>','Subscript text');
addCustomButton(Isrc+'en/5/58/Button_small.png','Small','<small>','</small>','Small Text');
addCustomButton(Isrc+'en/3/34/Button_hide_comment.png','Insert hidden Comment','<!-- ',' -->','Comment');
addCustomButton(Isrc+'en/1/12/Button_gallery.png','Insert a picture gallery','\n<gallery>\n','\n</gallery>','Image:FileName.jpg|Caption1\Image:FileName2.jpg|Caption2');
addCustomButton(Isrc+'en/e/e9/Button_headline2.png','Secondary headline','\n===','===','Secondary headline');
addCustomButton(Isrc+'en/8/8e/Button_shifting.png','Insert tab(s)',':','',':');
addCustomButton(Isrc+'en/f/fd/Button_blockquote.png','Insert block of quoted text','<blockquote style="border: 1px solid blue; padding: 2em;">\n','\n</blockquote>','Block quote');
addCustomButton(Isrc+'en/1/1e/Button_font_color.png','Insert colored text','<span style="color: ColorName">','</span>','Span of text');
addCustomButton(Isrc+'en/2/23/Button_code.png','Insert code','<code>','</code>','Code');
addCustomButton(Isrc+'en/9/93/Button_sub_link.png','Insert link to sub-page','[[Page#',']]','Sub_page');
addCustomButton(Isrc+'en/d/d3/Button_definition_list.png','Insert definition list','\n; ',' : ','Insert text');
addCustomButton(Isrc+'commons/3/3b/Button_template_alt.png','Template','{{','}}','Template name');
addCustomButton(Isrc+'commons/5/5a/Button_category_alt.png','Category','[[Category:',']]','Category title');
addCustomButton(Isrc+'commons/7/79/Button_reflink.png','<ref>','<ref>','</ref>','Insert reference material');
addCustomButton(Isrc+'commons/a/a0/Button_references_alt.png','Reference footer','<references/>','','');

//

This a bit optimized code does the same as your code. —Olliminatore 12:28, 13 September 2006 (UTC)

Does anyone know how to get this code suitable for use as an extension for other wikis?--Robnock 09:38, 8 November 2006 (UTC)