MediaWiki:Gadget-ProveIt.js: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
Update to latest version
Baris 3:
* Documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
*
* The gadget code is loaded directly from Wikimedia Commons,
* butThis herecode areis ajust fewthe conditionalsloader with some checks to minimize requests
* and somethe configuration options specific to this wiki
*/
 
// Only load on appropriatesome namespaces
var namespace = mw.config.get( 'wgNamespaceNumber' );
if ( namespace === 0 || namespace === 2 ) {
 
// Only load on wikitext pages (and not in common.js or common.css, for example)
// Only load when editing
var actioncontentModel = mw.config.get( 'wgActionwgPageContentModel' );
if ( actioncontentModel === 'edit' || action === 'submitwikitext' ) {
 
// Only load when editingon wikitext (and not in common.js or common.css, for example)editors
mw.hook( 'wikipage.editform' ).add( loadProveIt );
var contentModel = mw.config.get( 'wgPageContentModel' );
mw.hook( 've.activationComplete' ).add( function () {
if ( contentModel === 'wikitext' ) {
$( '#proveit' ).remove();
if ( ve.init.target.getSurface().getMode() === 'source' ) {
loadProveIt();
}
} );
mw.hook( 've.deactivationComplete' ).add( function () {
$( '#proveit' ).remove();
});
}
}
 
$( function loadProveIt() {
// Only load with the classic wikitext editors, not the new one
mw.config.set({
$( function () {
'proveit-tag': 'suntingan ProveIt edit', // Revision tag createddefined at Special:Tags (optional)
var textbox = $( '#wpTextbox1' );
'proveit-summary': 'ReferensiReference disuntingedited menggunakanwith [[Wikipedia:ProveIt|ProveIt]]', // Automatic edit summary (optional)
if ( textbox.length ) {
'proveit-templates': [ // TheseCitation templates shouldwith havetemplate theirdata TemplateData defined(recommended)
 
'Templat:Cite book',
// Configure the gadget (all options are optional)
'Templat:Cite encyclopedia',
mw.config.set({
'Templat:Cite journal',
'proveit-tag': 'suntingan ProveIt', // Revision tag created at Special:Tags
'Templat:Cite report',
'proveit-summary': 'Referensi disunting menggunakan ProveIt', // Automatic edit summary
'Templat:Cite web'
'proveit-templates': [ // These templates should have their TemplateData defined
}]
'Templat:Cite book',
});
'Templat:Cite encyclopedia',
mw.loader.load( 'https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-ProveIt2.js&action=raw&ctype=text/javascript' );
'Templat:Cite journal',
mw.loader.load( 'https://commons.wikimedia.org/w/loadindex.php?modulestitle=extMediaWiki:Gadget-ProveIt2.gadget.ProveItcss&onlyaction=stylesraw&ctype=text/css', 'text/css' );
'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' );
}
} );
}
}
}