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)
[edit] This script in other wiki
Hi, This is good script. How I can use it in ar.wp?--OsamaK 10:25, 14 June 2007 (UTC)
- 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?
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)
-
- 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)
-
-
- 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)
-
[edit] Statusbar tooltip
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)