MediaWiki:Gadget-ProveIt.js: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
Update docs
 
(4 revisi perantara oleh pengguna yang sama tidak ditampilkan)
Baris 1:
/**
* ProveIt is a powerful reference manager for Wikipedia and any other MediaWiki wiki
* Documentation at https://commonswww.wikimediamediawiki.org/wiki/Help:Gadget-ProveIt
*
* andThis someinitialization script sets the configuration options specific to this wiki
* The gadget code is loaded directly from Wikimedia Commons,
* and then loads the ProveIt code directly from MediaWiki.org
* but here are a few conditionals to minimize requests
* and some configuration options specific to this wiki
*/
$( function loadProveIt() {
mw.config.set({
'proveit-tag': 'suntingan ProveIt', // Revision tag createddefined at Special:Tags (optional)
'proveit-summary': 'Referensi disunting menggunakan [[Wikipedia:ProveIt|ProveIt]]', // Automatic edit summary (optional)
'proveit-templates': [ // TheseCitation templates should(without have their TemplateData definednamespace)
'Citation',
'Cite arXiv',
'Cite AV media',
'Templat:Cite book',
'Cite bioRxiv',
'Cite comic',
'Templat:Cite encyclopedia',
'Cite episode',
'Cite interview',
'Templat:Cite journal',
'Cite magazine',
'Cite news',
'Cite paper',
'Cite press release',
'Templat:Cite report',
'Cite sign',
'Cite speech',
'Cite thesis',
'Cite tweet',
'Cite video',
'Cite video game',
'Templat:Cite web',
}],
'proveit-namespaces': [ // Supported namespaces (see https://www.mediawiki.org/wiki/Manual:Namespace_constants)
0, // Main namespace
2, // User namespace
]
});
mw.loader.load( '//commonswww.wikimediamediawiki.org/w/load.php?modules=ext.gadget.ProveIt&only=scripts' );
mw.loader.load( '//commonswww.wikimediamediawiki.org/w/load.php?modules=ext.gadget.ProveIt&only=styles', 'text/css' );
 
// Only load onwhen appropriate namespacesediting
mw.hook( 'wikipage.editform' ).add( loadProveIt );
var namespace = mw.config.get( 'wgNamespaceNumber' );
mw.hook( 've.activationComplete' ).add( loadProveIt );
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 with the classic wikitext editors, not the new one
$( function () {
var textbox = $( '#wpTextbox1' );
if ( textbox.length ) {
 
// Configure the gadget (all options are optional)
mw.config.set({
'proveit-tag': 'suntingan ProveIt', // Revision tag created at Special:Tags
'proveit-summary': 'Referensi disunting menggunakan ProveIt', // Automatic edit summary
'proveit-templates': [ // These templates should have their TemplateData defined
'Templat:Cite book',
'Templat:Cite encyclopedia',
'Templat:Cite journal',
'Templat:Cite report',
'Templat: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' );
}
} );
}
}