MediaWiki:Gadget-MultiDiffConsecutive.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica
action controllata dal ResourceLoader
 
(5 versioni intermedie di 2 utenti non mostrate)
Riga 1:
/**
* View the next/ previous edit of a revision in MediaWiki multi diffs.
* Uses the localization provided by MediaWiki, requires mediawiki.util to work.
* and mediawiki.api to work.
*
* This program is free software; you can redistribute it and/or modify
Riga 20 ⟶ 21:
* @author Marius Hoch < hoo@online.de >
*/
 
( function( mw, $ ) {
function show() {
'use strict';
 
var oldRevision, newRevision, nextRevisionText, prevRevisionText;
 
/**
* Load missing messages needed by this script
* Get an interface message
*
* @param {string} msg Message key (without MediaWiki:)
*
* @return {jQuery.promise}
*/
function getMessageloadMessages( msg ) {
return $new mw.Api().ajaxloadMessagesIfMissing( {[
getMessage( 'previousdiff' ),
url: mw.util.wikiScript( 'index' ),
data: {'nextdiff'
}] );
title: 'MediaWiki:' + msg,
action: 'raw',
usemsgcache: true
},
dataType: 'text',
cache: true
} );
}
 
if ( mw.config.get( 'wgAction' ) !== 'view' ) {
// Diffs have action=view
return;
}
if ( !$( '.diff-multi' ).length ) {
// No multi diff
Riga 69 ⟶ 60:
getPrevRevisionText();
} else {
loadMessages()
getMessage( 'nextdiff' )
.done( function( textnextDiff () {
nextRevisionText = textmw.msg( 'nextdiff' );
} )
.done( getPrevRevisionText );
}
Riga 85 ⟶ 76:
doLink();
} else {
loadMessages()
getMessage( 'previousdiff' )
.done( function( textpreviousDiff () {
prevRevisionText = textmw.msg( 'previousdiff' );
} )
.done( doLink );
}
Riga 123 ⟶ 114:
// Only add a separator if we already have a visible link
$( '#mw-diff-ntitle4' )
.find( 'a#differences-nextlink' )
.before(
prevLink,
Riga 135 ⟶ 126:
}
}
}
 
$( document ).ready( show );
} )( mediaWiki, jQuery );