MediaWiki:Gadget-LiveRC 1x.js/InserisciTemplate.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
fix vari
wpajax -> mw.Api (1)
Riga 665:
}
var message = TemplateList[ option.value ];
wpajax.http( {
url: mw.config.get( 'wgServer' ) + wgScriptPath + '/api.php?format=xml' +
new mw.Api().get( {
'&action=query&prop=info&intoken=edit' +
format: 'json',
'&inprop=protection' +
action: 'query',
'&titles=' + encodeURIComponent( page ),
prop: 'info',
onSuccess: InserisciTemplate_PostTagPage,
pageintoken: page'edit',
'&inprop=: 'protection' +,
message: message
titles: page
} );
.done( function ( res ) {
onSuccess: InserisciTemplate_PostTagPage( res, page, message );
} );
return false;
};
Riga 679 ⟶ 683:
// Get page edit token and protection status
 
function InserisciTemplate_PostTagPage( xmlreqres, datapage, message ) {
var resPage = Object.values( res.query.pages )[0];
var page = data.page;
var message = data.message;
ObjetXML = xmlreq.responseXML;
var Isprotected = false;
for ( var prEntry in resPage.protection ) {
var PR = ObjetXML.getElementsByTagName( "pr" );
if ( TypeprEntry.type == "edit" && mw.config.get( 'wgUserGroups' ).indexOf( LevelprEntry.level ) == -1 ) {
for ( var a = 0, l = PR.length; a < l; a++ ) {
var Type = PR[ a ].getAttribute( "type" );
var Level = PR[ a ].getAttribute( "level" );
if ( Type == "edit" && mw.config.get( 'wgUserGroups' ).indexOf( Level ) == -1 ) {
Isprotected = true;
break;
}
}
 
if ( Isprotected ) {
LiveRC_alert( "<b>" + lrcMakeText( "PROTECTEDPAGE" ).split( "$1" ).join( page ) + "</b>" );
return;
}
 
var Page = ObjetXML.getElementsByTagName( "page" )[ 0 ];
LiveRC_Config.edittoken = PageresPage.getAttribute( "edittoken" );
var tpl = InserisciTemplate_showDialog( message, page );
}