MediaWiki:Gadget-ajaxpatrol.js

De Pikmin FR

Note : après avoir publié 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 appuyez sur Ctrl + F5 ou Ctrl + R (⌘ + R sur un Mac).
  • Google Chrome : appuyez sur Ctrl + Maj + R (⌘ + Shift + R sur un Mac).
  •  Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
/**
 * AJAX patrol feature version 3.0
 * by Ryan Schmidt < http://strategywiki.org/wiki/User:Ryan_Schmidt >
 */

/*
 * CONFIGURATION
 * You may set whether or not to automatically browse to the next diff
 * by inserting the following into your user js page.
 * var AjaxPatrolAutoNext = true; (default true)
 */

function AjaxPatrol(autoNext) {
	$('.patrollink a').click(function() {
		var origtitle = document.title;
		var parent = $(this).parent();
		$.get($(this).attr('href'), function() {
			document.title = origtitle;
			if (autoNext && $('#differences-nextlink').length > 0) {
				parent.text('[Done. Loading next diff]');
				window.location = $('#differences-nextlink').attr('href');
			} else {
				parent.text('[Done. You may now browse away from the page]');
			}
		});
		document.title = '(' + origtitle + ')';
		parent.text('[Patrolling edit...]');
		return false;
	});
}

// set it to run on load
$(function() {
	if( typeof AjaxPatrolAutoNext == 'undefined' ) {
		AjaxPatrolAutoNext = true;
	}
	new AjaxPatrol( AjaxPatrolAutoNext );
});