Järjestelmäviesti:Gadget-ProveIt.js

Wikiuutisista

Huomautus: Selaimen välimuisti pitää tyhjentää asetusten tallentamisen jälkeen, jotta muutokset tulisivat voimaan.

  • Firefox ja Safari: Napsauta Shift-näppäin pohjassa Päivitä, tai paina Ctrl-F5 tai Ctrl-R (⌘-R Macilla)
  • Google Chrome: Paina Ctrl-Shift-R (⌘-Shift-R Macilla)
  • Internet Explorer ja Edge: Napsauta Ctrl-näppäin pohjassa Päivitä tai paina Ctrl-F5
  • Opera: Paina Ctrl-F5.
/**
 * ProveIt is a powerful reference manager for Wikipedia
 * Documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
 *
 * The gadget code is loaded directly from Wikimedia Commons,
 * but here are a few conditionals to minimize requests
 * and some configuration options specific to this wiki
 */

// Only load when the document is ready
$( function () {

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

	    // 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' ) {

			    // Only load on the classic wikitext editors, not the new one
				var textbox = $( '#wpTextbox1' );
				if ( textbox.length ) {

					// Configure the gadget (all options are optional but recommended)
					mw.config.set({
						'proveit-tag': 'ProveIt', // Revision tag created at Special:Tags
						//'proveit-summary': 'Viitetietoja muokattu ProveIt-pienoisohjelmalla.'
						'proveit-summary': null, // Automatic edit summary
						'proveit-templates': [ // These templates should have their TemplateData defined
							'Malline:Lehtiviite',
							'Malline:Verkkoviite'
						]
					});

					// 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' );
				}
		    }
	    }
    }
});