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

Contenuto cancellato Contenuto aggiunto
wpajax -> mw.Api (1)
wpajax -> mw.Api (2)
Riga 808:
lrcDisableLink( "LiveTagReason" );
lrcDisableLink( "LiveTagLink" );
var EditParam = [];//XXX Questo dev'essere un oggetto!{
action: 'edit',
EditParam.token = LiveRC_Config.edittoken;
EditParam. summary =: lrcMakeText( "RESUMESTART" ) + lrcMakeText( "TAG_RESUME" ) + ' ' + data.template;,
if ( data.where == 'top' ) {
EditParam. title =: page;,
EditParam.prependtext = text + "\n";
EditParam. watchlist =: "preferences";,
} else if ( data.where == 'bottom' ) {
notminor: 1,
EditParam.appendtext = "\n" + text;
nocreate: 1
} else { //default = top
};
EditParam.prependtext = text + "\n";
 
var addText;
if ( data.where == 'topbottom' ) {
addText = "\n" + text;
EditParam.appendtext = "\n" + textaddText;
} else { // top or default = top
EditParam.prependtextaddText = text + "\n";
EditParam.prependtext = text + "\n"addText;
}
 
EditParam.summary = lrcMakeText( "RESUMESTART" ) + lrcMakeText( "TAG_RESUME" ) + ' ' + data.template;
EditParam.title = page;
EditParam.watchlist = "preferences";
EditParam.notminor = "1";
EditParam.nocreate = "1";
if ( lrcMakeParam( "BypassWatchdefault" ) ) {
EditParam.watchlist = "nochange";
}
var Params = [];
for ( var Param in EditParam ) {
Params.push( Param + "=" + encodeURIComponent( EditParam[ Param ] ) );
}
Params = Params.join( "&" );
var headers = [];//XXX Questo dev'essere un oggetto!
headers[ 'Content-Type' ] = 'application/x-www-form-urlencoded';
wpajax.http( {
url: mw.config.get( 'wgServer' ) + wgScriptPath + '/api.php?action=edit',
method: "POST",
headers: headers,
data: Params,
onSuccess: InserisciTemplate_PostTagPageDone,
params: EditParam,
where: data.where
} );
}
 
new mw.Api().postWithEditToken( EditParam )
function InserisciTemplate_PostTagPageDone( Req, data ) {
.done( function () {
var params = data.params;
var text = LiveRC_alert( "<b>" + params.titlepage + " : " + lrcMakeText( "TAG_DONE" ) + "</b> <small>(" + params[ textparam ]addText + ")</small>" );
var textparam = data.where === 'bottom' ? "appendtext" : "prependtext";
} );
var text = "<b>" + params.title + " : " + lrcMakeText( "TAG_DONE" ) + "</b> <small>(" + params[ textparam ] + ")</small>";
LiveRC_alert( text );
}