MediaWiki:Gadget-ProveIt.js

Bilgibanka, Hoşgeldiniz
Şuraya atla: kullan, ara
/**
 * ProveIt is a powerful GUI tool to find, edit, add and cite references in any MediaWiki wiki
 * Full documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
 *
 * The gadget itself is loaded directly from Commons, but here are a few conditions to minimize requests
 * and a few configuration options specific to this wiki
 */

// Only load on appropriate namespaces
var namespace = mw.config.get( 'wgNamespaceNumber' );
if ( namespace === 0 || namespace === 2 || namespace === 118 ) {

	// Only load when editing 
	var action = mw.config.get( 'wgAction' );
	if ( action === 'edit' || action === 'submit' ) {

		// Only load when editing wikitext (and not in common.js or common.css, for example)
		var contentModel = mw.config.get( 'wgPageContentModel' );
		if ( contentModel === 'wikitext' ) {

			// Set the wiki-specific options (all options are optional and can be set to null)
			mw.config.set({
				'proveit-tag': 'ProveIt edit', // Revision tag created at Special:Tags
				'proveit-summary': 'Reference edited with [[Wikipedia:ProveIt|ProveIt]]', // Edit summary automatically added by ProveIt
				'proveit-templates': [ // These templates should have their TemplateData defined
					'Template:Citation',
					'Template:Cite AV media',
					'Template:Cite book',
					'Template:Cite encyclopedia',
					'Template:Cite episode',
					'Template:Cite journal',
					'Template:Cite magazine',
					'Template:Cite news',
					'Template:Cite paper',
					'Template:Cite press release',
					'Template:Cite sign',
					'Template:Cite thesis',
					'Template:Cite tweet',
					'Template:Cite video',
					'Template:Cite web'
				]
			});
	
			// Load the latest code directly from Commons
			mw.loader.load( '//commons.wikimedia.org/w/load.php?modules=ext.gadget.ProveIt&only=scripts' );
			mw.loader.load( '//commons.wikimedia.org/w/load.php?modules=ext.gadget.ProveIt&only=styles', 'text/css' );
		}
	}
}