MediaWiki:Gadget-rollbackconfirmable.js

Fonte: wikishia

Nota: Depois de publicar, poderá ter de contornar a cache do seu navegador para ver as alterações.

  • Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
  • Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
  • Internet Explorer / Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5
  • Opera: Pressione Ctrl-F5.
/**
 * Prevent immediate rollback action with https://gerrit.wikimedia.org/r/90729 help
 * Author: User:Ebraminio
 */
/*jslint browser: true, white: true*/
/*global $, mw*/
$.when($.ready, mw.loader.using('jquery.confirmable')).then(function () {
	'use strict';
	var rollbackLinks = $('.mw-rollback-link a');
	if (rollbackLinks.length === 0) { return; }
	mw.util.addCSS('.mw-rollback-link, .mw-rollback-link a { white-space: nowrap; display: inline-block; vertical-align: bottom; }');
	rollbackLinks.each(function () {
		var from = new mw.Uri(this.href).query.from;
		if (!$(this).confirmable) { return; }
		$(this).confirmable({
			i18n: { confirm: 'واگردانی ویرایش ' + from + '؟' },
			buttonCallback: function (button, which) {
				if (which === 'no') {
					// Remove misleading attributes
					return button.attr({
						title: null,
						href: '#'
					});
				}
				return button;
			}
		});
	});
});