Utente:Titore/Gadget-MultiDiffConsecutive.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
uso direttamente le api
sposto api in funzione
 
Riga 20:
* @author Marius Hoch < hoo@online.de >
*/
mw.loader.using( [ 'mediawiki.util', 'mediawiki.api' ], function() {
 
$( document ).ready( function() {
'use strict';
var oldRevision, newRevision, nextRevisionText, prevRevisionText;
 
/**
// Loading* Gets the needed interface messagemessages intoto the client, so itthey can be accessed by mw.msg.
*
* @return {jQuery.promise}
*/
function getMessages() {
return new mw.Api().loadMessagesIfMissing( ['nextdiff'] );
'previousdiff',
'nextdiff'
}] );
}
 
if ( mw.config.get( 'wgAction' ) !== 'view' ) {
Riga 51 ⟶ 63:
getPrevRevisionText();
} else {
getMessages()
// Loading the interface message into the client, so it can be accessed by mw.msg
mw.loader.using( 'mediawiki.api' ).thendone( function () {
return new mw.Api().loadMessagesIfMissing( ['nextdiff'] );
} )
.then( function() {
nextRevisionText = mw.msg( 'nextdiff' );
} )
.thendone( getPrevRevisionText );
}
 
Riga 70 ⟶ 79:
doLink();
} else {
getMessages()
// Loading the interface message into the client, so it can be accessed by mw.msg
mw .loader.using( 'mediawiki.api' ).thendone( function () {
return prevRevisionText new= mw.Api().loadMessagesIfMissingmsg( ['previousdiff'] );
} )
.thendone( function(doLink ) {;
prevRevisionText = mw.msg( 'previousdiff' );
} )
.then( doLink );
}
}