MediaWiki:Gadget-refToolbar.js

Poznámka: Po uložení musíte vyprázdnit mezipaměť vašeho prohlížeče, jinak změny neuvidíte.

/**
 * RefToolbar
 *
 * Adds tools for citing references to the edit toolbar.
 *
 * @author: [[User:Mr.Z-man]]
 * @author: [[User:Kaldari]]
 */
/*jshint browser: true, camelcase: true, curly: true, eqeqeq: true */
/*global jQuery, mediaWiki, importScript */
( function ( mw, $ ) {
'use strict';
function initializeRefTools2() {
	if ( window.refToolbarInstalled2 || $( '#wpTextbox1[readonly]' ).length ){
		return;
	}
	// using weak comparison because ("0") is true, but ("0" == true) is false 
	if ( mw.user.options.get( 'usebetatoolbar' ) == true ) {
			mw.loader.using( [ 'ext.gadget.refToolbarBase', 'ext.wikiEditor' ], function () {
				importScript( 'MediaWiki:RefToolbar2B.js' );
			} );
	} else {
		return;
	}
	window.refToolbarInstalled2 = true;
}

if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
	// Double check if user.options is loaded, to prevent errors when copy pasted accross installations
	$.when( mw.loader.using( ['user.options'] ), $.ready ).done( initializeRefTools2 );
}

}( mediaWiki, jQuery ) );