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

Contenuto cancellato Contenuto aggiunto
 
uso direttamente le api
Riga 1:
/**
* View the next/ previous edit of a revision in MediaWiki multi diffs.
* Uses the localization provided by MediaWiki, requires mediawiki.util and mediawiki.api to work.
*
* This program is free software; you can redistribute it and/or modify
Riga 25:
'use strict';
var oldRevision, newRevision, nextRevisionText, prevRevisionText;
 
/**
* Get an interface message
*
* @param {string} msg Message key (without MediaWiki:)
*
* @return {jQuery.promise}
*/
function getMessage( msg ) {
return $.ajax( {
url: mw.util.wikiScript( 'index' ),
data: {
title: 'MediaWiki:' + msg,
action: 'raw',
usemsgcache: true
},
dataType: 'text',
cache: true
} );
}
 
if ( mw.config.get( 'wgAction' ) !== 'view' ) {
Riga 71 ⟶ 51:
getPrevRevisionText();
} else {
// Loading the interface message into the client, so it can be accessed by mw.msg
getMessage( 'nextdiff' )
mw.doneloader.using( function'mediawiki.api' ).then( textfunction () {
return new mw.Api().loadMessagesIfMissing( ['nextdiff'] );
nextRevisionText = text;
} )
.donethen( getPrevRevisionText function(); {
nextRevisionText = textmw.msg( 'nextdiff' );
}, )
.then( getPrevRevisionText );
}
 
Riga 87 ⟶ 70:
doLink();
} else {
// Loading the interface message into the client, so it can be accessed by mw.msg
getMessage( 'previousdiff' )
mw.doneloader.using( function'mediawiki.api' ).then( textfunction () {
return new mw.Api().loadMessagesIfMissing( ['previousdiff'] );
prevRevisionText = text;
} )
.donethen( doLink function(); {
getMessage prevRevisionText = mw.msg( 'previousdiff' );
} );
.then( doLink );
}
}