MediaWiki:Gadget-rollbackconfirmable.js
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 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;
}
});
});
});