MediaWiki:Gadget-robot.js
Note : après avoir enregistré vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
- Firefox / Safari : Maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou pressez Ctrl-F5 ou Ctrl-R (⌘-R sur un Mac) ;
- Google Chrome : Appuyez sur Ctrl-Maj-R (⌘-Shift-R sur un Mac) ;
- Internet Explorer : Maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5 ;
- Opera : Allez dans Menu → Settings (Opera → Préférences sur un Mac) et ensuite à Confidentialité & sécurité → Effacer les données d'exploration → Images et fichiers en cache.
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:MatchSplit.js&action=raw&ctype=text/javascript');
/*
* Author: w:fr:Phe
*
* Add a diff button to compare the text layer and the current text in Page:, useful after a M&S to check
* if the scan and splitted text are of the same edition.
*
* TODO : open a jquery ui and get some feedback from the server to display a progress bar.
* Change the title of the Diff button if the Diff already exist and ask a confirmation in
* this case. Red tab, diff doesn't exist, blue tab diff exists + confirmation.
*/
window.verify_match = {
callback : function (data) {
if (data['error'] == 0) {
$('#wpRobot-verify-match > a').text('ok')
$('#wpRobot-verify-match > a').attr('href', '/w/index.php?title=' + encodeURIComponent("Discussion " + mw.config.get('wgPageName')) + '/Diff');
} else {
$('#wpRobot-verify-match > a').text(data['text']);
}
},
do_verify_match : function () {
var url = '//tools.wmflabs.org/phetools/verify_match.php?cmd=verify&title='
+ encodeURIComponent(mw.config.get('wgPageName')) + '&lang=' + mw.config.get('wgContentLanguage') + '&user=' + mw.config.get('wgUserName');
$.getJSON(url, function(data) { verify_match.callback(data); } );
},
add_verify_match_button : function () {
var id_name = self.skin == "vector" ? '#p-namespaces' : '#p-cactions';
var $a = $(id_name + ' ul');
if (!$a.length)
return false;
$a[0].innerHTML = $a[0].innerHTML + '<li id="ca-verify-match">' + '<span id="wpRobot-verify-match"><a href="javascript:window.verify_match.do_verify_match();"><span>Diff</span></a></span></li>';
},
setup : function () {
verify_match.add_verify_match_button();
},
};
if (mw.config.get("wgNamespaceNumber") == 'Index')
$(document).ready(window.verify_match.setup);