MediaWiki:Common.js/edit.js

/*global mw, importScriptURI, importScript */ /*jshint strict: false, browser: true, jquery: true */ /** * Extra toolbar options *  *  Description: Adds extra buttons to the old (non-enhanced) editing toolbar. *  *  Maintainers: User:MarkS, User:Voice of All, User:R. Koot */

mw.loader.using( 'mediawiki.action.edit', function {    var buttons, i, len;

buttons = ; for ( i = 0, len = buttons.length; i < len; i++ ) { mw.toolbar.addButton( buttons[i] ); }

});

/** * Fix edit summary prompt for undo * * Fixes the fact that the undo function combined with the "no edit summary prompter" * causes problems if leaving the edit summary unchanged. * Added by User:Deskana, code by User:Tra. * See also 8912. */ $(function {    if (document.location.search.indexOf('undo=') !== -1 && document.getElementsByName('wpAutoSummary')[0]) {        document.getElementsByName('wpAutoSummary')[0].value = '1';    } });

/** * RefToolbar * * Description: Adds tools for citing references to the edit toolbar. * See RefToolbar/2.0 for further documentation. * * To disable this script, add *     refToolbarInstalled = 'bypass'; * to Special:Mypage/vector.js. * * Current maintainers: none * Former maintainers: User:Mr.Z-man, User:Kaldari */

function initializeRefTools { if ( window.refToolbarInstalled === undefined ) { importScriptURI('//www.wikiqueer.org/w/index.php?title=MediaWiki:RefToolbarBase.js&action=raw&ctype=text/javascript');

if( mw.user.options.get('usebetatoolbar') && mw.user.options.get('usebetatoolbar-cgd') ) { // Enhanced editing toolbar is on with dialogs. Load standard refToolbar. mw.loader.using( 'ext.wikiEditor.toolbar', function {                importScript('MediaWiki:RefToolbar.js');            }); } else if( mw.user.options.get('usebetatoolbar') ) { // Dialogs are off. Load refToolbar 2.0 without dialogs. mw.loader.using( 'ext.wikiEditor.toolbar', function {                importScript('MediaWiki:RefToolbarNoDialogs.js');            }); } else { // Enhanced editing toolbar is off. Load legacy refToolbar 1.0. importScript('MediaWiki:RefToolbarLegacy.js'); }       window.refToolbarInstalled = true; } }

$( initializeRefTools );