MediaWiki:Gadget-ProveIt.js

From Eurovision Wiki
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/**
 * ProveIt is a reference manager for Wikipedia and any other MediaWiki wiki
 * Documentation: https://www.mediawiki.org/wiki/ProveIt
 * Source code: https://www.mediawiki.org/wiki/MediaWiki:Gadget-Global-ProveIt.js
 */
function loadProveIt() {
	mw.config.set( {

		// Citation templates (without namespace)
		'proveit-templates': [
			'Citation',
			'Cite arXiv',
			'Cite AV media',
			'Cite AV media notes',
			'Cite book',
			'Cite bioRxiv',
			'Cite conference',
			'Cite comic',
			'Cite encyclopedia',
			'Cite episode',
			'Cite Hansard',
			'Cite Instagram',
			'Cite interview',
			'Cite journal',
			'Cite magazine',
			'Cite mailing list',
			'Cite map',
			'Cite Metacritic',
			'Cite news',
			'Cite newsgroup',
			'Cite newspaper The Times',
			'Cite ODNB',
			'Cite paper',
			'Cite podcast',
			'Cite press release',
			'Cite report',
			'Cite Rotten Tomatoes',
			'Cite serial',
			'Cite sign',
			'Cite speech',
			'Cite techreport',
			'Cite thesis',
			'Cite tweet',
			'Cite video',
			'Cite video game',
			'Cite ssrn',
			'Cite wikisource',
			'Cite web',
			'Cite Q',
			'R',
			'Sfn',
			'Sfnm'
		],

		// Citation templates that shouldn't go inside <ref> tags
		'proveit-templates-noref': [ 'R', 'Sfn', 'Sfnm' ],

		// Preferred date format, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options
		'proveit-date-format': { year: 'numeric', month: 'long', day: 'numeric' },

		// Revision tag defined at Special:Tags
		'proveit-tag': 'ProveIt edit',

		// Automatic edit summary
		'proveit-summary': 'Reference edited with [[Wikipedia:ProveIt|ProveIt]]',
	} );

	// Load from the central, global version at MediaWiki.org
	mw.loader.load( '//www.mediawiki.org/w/load.php?modules=ext.gadget.Global-ProveIt' );
}

// Only load when editing
mw.hook( 'wikipage.editform' ).add( () => window.ProveIt || loadProveIt() );
mw.hook( 've.newTarget' ).add( target => target.constructor.static.name === 'article' && target.on( 'surfaceReady', loadProveIt ) );