MediaWiki:Gadget-refToolbar.js

In today's article we are going to talk about MediaWiki:Gadget-refToolbar.js. It is a topic that has aroused great interest in recent years, and MediaWiki:Gadget-refToolbar.js has been the subject of debate and discussion in different areas. From a historical point of view, MediaWiki:Gadget-refToolbar.js has played a crucial role in the evolution of society. Likewise, MediaWiki:Gadget-refToolbar.js has generated conflicting opinions among experts and specialists, who have analyzed its impact in different contexts. In this article, we will take an in-depth look at the meaning and importance of MediaWiki:Gadget-refToolbar.js, as well as its implications today. Do not miss it!
/**
 * RefToolbar
 *
 * Adds tools for citing references to the edit toolbar.
 * See ] for further documentation. One of two
 * possible versions will load (Reftoolbar 1.0 or Reftoolbar 2.0)
 * depending on the user preferences (the usebetatoolbar preference).
 *
 * @see: ]
 * @see: ]
 * @see: ]
 * @see: ]
 * @see: ]
 * @see: ]
 * @see: ]
 * @author: ]
 * @author: ]
 */
/*jshint browser: true, camelcase: true, curly: true, eqeqeq: true */
/*global $, mw */
( function () {
'use strict';
function initializeRefTools() {
	if ( window.refToolbarInstalled || $( '#wpTextbox1' ).length ) {
		return;
	}
        // cast to number, support both 1 and "1" 
	if ( +mw.user.options.get( 'usebetatoolbar' ) === 1 ) {
		// Enhanced editing toolbar is on. Going to load RefToolbar 2.0.
		// TODO:
		// * Explicitly declare global variables from ] using window.*
		// * Move ] to ]
		// * Create the module 'ext.gadget.refToolbarDialogs' depending on 'ext.gadget.refToolbarBase' and 'ext.wikiEditor'
		// * Replace the code below by mw.loader.load( 'ext.gadget.refToolbarDialogs' );
		mw.loader.using( , function () {
			mw.loader.load( '/w/index.php?title=MediaWiki:RefToolbar.js&action=raw&ctype=text/javascript' );
		} );
	} else if ( +mw.user.options.get( 'gadget-legacyToolbar' ) === 1 ) {
		// Enhanced editing toolbar is off. Loading RefToolbar 1.0. (legacy)
		mw.loader.load( '/w/index.php?title=MediaWiki:RefToolbarLegacy.js&action=raw&ctype=text/javascript' );
	} else {
		return;
	}
	window.refToolbarInstalled = true;
}

if ( /^(edit|submit)$/.test( mw.config.get( 'wgAction' ) ) ) {
	// Double check if user.options is loaded, to prevent errors when copy pasted accross installations
	$.when( mw.loader.using(  ), $.ready ).then( initializeRefTools );
}

}() );