User talk:MarkS/extraeditbuttons.js

Page contents not supported in other languages.
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)[reply]

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

This script in other wiki[edit]

Hi, This is good script. How I can use it in ar.wp?--OsamaK 10:25, 14 June 2007 (UTC)[reply]

To use the code as is then simply enter the following into monobook.js on any other wikimedia project:
    • but I don't find this monobook.js, where is it please?
      • monobook.js can be found under User:XXXX/monobook.js If you don't have this file then create it and paste the code into it. --MarkS(talk) 20:20, 23 July 2007 (UTC)[reply]
document.write('<script type="text/javascript" src="' 
           + 'http://en.wikipedia.org/w/index.php?title=User:MarkS/extraeditbuttons.js' 
           + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
This should get XEB to work fine in the other project. I have just tested this on my Wiki Commons account. However, doing this would result in the English language version being used in the other project. If you want to change the language then you will need to copy the XEB code and the CSS file which goes with it (details of where to find the files are at the bottom of the XEB home page). Once copied you can amend the code to use the appropriate language. If you are copying between wikimedia projects then there is no need to move the button images as they are in commons and not English wikipedia. Any problems let me know. --MarkS(talk) 19:52, 14 June 2007 (UTC)[reply]
Well, I try it in ar.wp. It's good! ,But which file I copy and edit to edit language? (give me like ,Please). Thank you!--OsamaK 14:22, 15 June 2007 (UTC)[reply]
To change the language you will need to copy the script itself from User:MarkS/extraeditbuttons.js in en.wp to a subpage of your ID in ar.wp (I'd suggest you give the subpage the same name as I'm using). You can then edit the text in the script to update the language as required. I would suggest if you copy the script you also copy the CSS file (User:MarkS/XEB/live.css) to ar.wp at the same time. Copying the XEB script will give you an entirely separate copy. This allows you to change the language or any other part of the script as you wish. However, it would also mean you didn't get any updates to the script.
The alternative if you don't want an entirely separate version of the script would be for me to move the parts of the script containing text to display into a separate language file. The script could then be told to use different language files according to user preference. The weakness of this approach is that the language files would need to be updated when the script is changed. I'd be happy to do the english language file but would need other people to update the other language files as necessary.
If you have any problems copying the script to ar.wp or want to discuss the second option then let me know. --MarkS(talk) 20:00, 17 June 2007 (UTC)[reply]

Statusbar tooltip[edit]

How can I get the tooltip ("speedTip") to appear in the status bar? Firefox doesn't seem to be able to display the tooltip more than once if the mouse cursor is moved over multiple icons, requiring right-clicking and cancelling the popup menu to get another tooltip to display. I'd rather have the tooltip display in the status bar. —Remag Kee 08:33, 8 September 2007 (UTC)[reply]

Updates[edit]

Hi!

As reported on

this script is broken since the recent MediaWiki update.

Could someone copy the version of this script which is at de:MediaWiki:Gadget-Extra-Editbuttons.js and than copy its translation to English? This way will (hopefully) work again. Helder 13:50, 21 October 2011 (UTC)[reply]

I've synched it with the sandbox version you linked but it still don't seem to be working. Perhaps work on getting a working version in your own userspace and then I can synch it with this one? –xenotalk 14:46, 21 October 2011 (UTC)[reply]
Sorry for that. I missed part of the syntax. This will fix the JS errors. Helder 14:50, 21 October 2011 (UTC)[reply]
Why is it so much smaller than the current version? –xenotalk 16:48, 21 October 2011 (UTC)[reply]

Disabled request as no response from OP. — Martin (MSGJ · talk) 11:00, 25 October 2011 (UTC)[reply]

Migration and compatibility with the Enhanced toolbar[edit]

Hi!

Could someone do this update to the script to backport some updates which were made on Portuguese Wikipedia? This will make it more compatible with the new version of MediaWiki, fix some errors detected by JSHint and also allows the inclusion of buttons to the enhanced toolbar. Helder 20:29, 22 February 2012 (UTC)[reply]

There's a lot of changes there so I'll hold off changing the live version for now. Instead, I've put the update into User:MarkS/XEB/dev.js. If you could confirm that you've tested the updates with the browsers required in User:MarkS/Extra_edit_buttons#Supported_Browsers we can then look at making the changes live. Tra (Talk) 06:44, 23 February 2012 (UTC)[reply]