मीडियाविकि:Gadget-ProveIt.js: रिवीजन सभ के बीचा में अंतर

Content deleted Content added
Update to latest
Update to latest version
लाइन 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' ) {
// Only load with the classic wikitext editors, not the new one
loadProveIt();
var textbox = document.getElementById( 'wpTextbox1' );
if ( textbox ) {
 
// Configure the gadget (all options are optional)
mw.config.set({
'proveit-tag': 'ProveIt edit', // Revision tag created at Special:Tags
'proveit-summary': 'Reference edited with ProveIt', // Automatic edit summary
'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' );
}
});
mw.hook( 've.deactivationComplete' ).add( function () {
$( '#proveit' ).remove();
});
}
}
 
function loadProveIt() {
mw.config.set({
'proveit-tag': 'ProveIt edit', // Revision tag createddefined at Special:Tags (optional)
'proveit-summary': 'Reference edited with [[Wikipedia:ProveIt|ProveIt]]', // Automatic edit summary (optional)
'proveit-templates': [ // TheseCitation templates shouldwith havetemplate theirdata TemplateData defined(recommended)
'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'
]
});
mw.loader.load( 'https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-ProveIt2.js&action=raw&ctype=text/javascript' );
mw.loader.load( 'https://commons.wikimedia.org/w/loadindex.php?modulestitle=extMediaWiki:Gadget-ProveIt2.gadget.ProveItcss&onlyaction=stylesraw&ctype=text/css', 'text/css' );
}