Manual:Custom edit buttons

From MediaWiki.org

(Redirected from Wikipedia buttons)
Jump to: navigation, search

You can add custom edit buttons to the edit window easily with JavaScript.

[edit] JavaScript code needed

To add custom edit buttons, edit either User:Your username/skinname.js or MediaWiki:Common.js on your wiki. If you edit the former, the buttons will only show up for yourself and if the latter, they will show to all wiki users.

 if (mwCustomEditButtons) {
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/central/images/7/74/Button_comment.png",
     "speedTip": "Comment visible only for editors",
     "tagOpen": "<!-- ",
     "tagClose": " -->",
     "sampleText": "Insert comment here"}
  }

imageFile is the full URL to the edit button image. Please do not hotlink images from Wikimedia Commons or Wikipedia! Upload them to your web host instead.
. See next section if you want to use a script for downloading images from english wikipedia tagOpen is simply the opening tag, e.g. <!--
tagClose is the opposite of the above, the closing tag, for example, -->.
sampleText is the sample text that will appear between the opening and closing tags. The editor should replace this sample text with his or her own text.

[edit] Script for downloading icon images from english wikipedia

Create a file with the URLs:

$ sudo cat urls
http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png
http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png
http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png
http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png
http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png
http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png
http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png
http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png
http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png
http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png

Download images with wget

$ wget -N -i urls

[edit] See also