MediaWiki:Common.js/edit.js

/*global mw */ /*jshint strict: false, browser: true, jquery: true */ /** * Extra toolbar options *  *  Description: Adds extra buttons to the editing toolbar. *  *  Maintainers: User:Quasar (derived from https://en.wikipedia.org/wiki/MediaWiki:Common.js/edit.js) */ function addExtraButtons { mw.toolbar.addButtons(  // Generic editing tasks   {      imageId: 'button-add-category',      imageFile: '//doomwiki.org/w/images/1/11/Button_category.png',      speedTip: 'Add a category',      tagOpen: '[[Category:',      tagClose: ']]',      sampleText: 'categoryname'   },   {      imageId: 'button-code-tag',      imageFile: '//doomwiki.org/w/images/2/23/Button_code.png',      speedTip: 'Insert inline code',      tagOpen: ,      sampleText: 'code'   },   {      imageId: 'button-timeline-link',      imageFile: '//doomwiki.org/w/images/4/40/Button_timeline.png',      speedTip: 'Create a Timeline link',      tagOpen: ,      sampleText: 'year'   },   {      imageId: 'button-link-wikipedia',      imageFile: '//doomwiki.org/w/images/8/8a/Button_wikipedia_link.png',      speedTip: 'Link to an article on Wikipedia',      tagOpen: '',      sampleText: 'article|linktext'   },   // Image and video buttons {     imageId: 'button-image-right', imageFile: '//doomwiki.org/w/images/2/29/Button_image_right.png', speedTip: 'Insert a right-aligned thumbnail', tagOpen: ,     tagClose: , sampleText: 'Example.png' },  {      imageId: 'button-gallery', imageFile: '//doomwiki.org/w/images/c/cc/Button_gallery_silk.png', speedTip: 'Insert a picture gallery', tagOpen: '\n', sampleText: 'Example.png|Caption1' },  {      imageId: 'button-movie', imageFile: '//doomwiki.org/w/images/c/c1/Button_movie.png', speedTip: 'Embed a YouTube video', tagOpen: '', sampleText: 'videoid' },  // Table buttons {     imageId: 'button-pretty-table', imageFile: '//doomwiki.org/w/images/0/04/Button_array.png', speedTip: 'Insert a pretty table', tagOpen: '{| \n|-\n|', tagClose: '\n|}', sampleText: '' },  {      imageId: 'button-pretty-sortable', imageFile: '//doomwiki.org/w/images/b/b5/Button_tablesort.png', speedTip: 'Insert a sortable table', tagOpen: '{| \n|-\n|', tagClose: '\n|}', sampleText: '' },  // Citations and references {     imageId: 'button-insert-reflink', imageFile: '//doomwiki.org/w/images/2/2b/Button_ref_inscription.png', speedTip: 'Insert a generic reference', tagOpen: ' ', sampleText: 'footnote' },  {      imageId: 'button-cite-web', imageFile: '//doomwiki.org/w/images/9/91/Button_cite_web.png', speedTip: 'Insert a webpage reference', tagOpen: '', sampleText: '' },  {      imageId: 'button-insert-references', imageFile: '//doomwiki.org/w/images/9/9a/Button_references.png', speedTip: 'Create a References section', tagOpen: '==References==\n ', tagClose: '\n', sampleText: '' },  // Magic words and stuff {     imageId: 'button-redirect', imageFile: '//doomwiki.org/w/images/c/c8/Button_redirect.png', speedTip: 'Redirect this article to another', tagOpen: '#REDIRECT ',     tagClose: '', sampleText: 'pagename' }  ); }

mw.loader.using('user.options', function {   // This can be the string "0" if the user disabled the preference (52542)   if(mw.user.options.get('usebetatoolbar') != 1 && mw.user.options.get('showtoolbar') == 1) {      $.when( mw.loader.using('mediawiki.toolbar'), $.ready ).then(addExtraButtons);  } });