Jump to content

User:Kaniivel/RefConsolidate start.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Kaniivel (talk | contribs) at 04:20, 4 February 2017. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Make sure the document is ready and dependencies are loaded
$.when (
	$.ready,
	mw.loader.using(['mediawiki.util'])
	).done(function () {
		// Only load on appropriate namespaces
		var namespace = mw.config.get( 'wgNamespaceNumber' );
		if ( namespace === 0 || namespace === 2 ) {
			// Only load when editing wikitext (and not in common.js or common.css, for example)
			var contentModel = mw.config.get( 'wgPageContentModel' );
			if ( contentModel === 'wikitext' ) {
				// Configure the gadget for this particular wiki
				mw.config.set({
					'refcon-summary': 'Converted references to list-defined format with [[User:Cumbril/References Consolidator|References Consolidator]]', // Edit summary automatically added by RefCon
					'refcon-linkname': 'Consolidate refs', //Portlet link name
					'refcon-linkhover': 'Consolidate references', //Text that is displayed when hovering above the link; link title
					'refcon-reftemplatenames': [ //List template {{reflist}} name and aliases that are used in wiki. Put main first
						'reflist'
					],
					'refcon-reftemplategroupnames': [ //List template {{reflist}} 'group' parameter aliases that are used in wiki. Put main first
						'group'
					],
					'refcon-reftemplaterefsnames': [ //List template {{reflist}} 'refs' parameter aliases that are used in wiki. Put main first
						'refs'
					]
				});
				mw.loader.load( '/w/index.php?title=User:Cumbril/RefConsolidate.js&action=raw&ctype=text/javascript', 'text/javascript' );
			}
		}
	}
);