MediaWiki:Gadget-registerToDelete.js

来自萌娘共享
AnnAngela讨论 | 贡献2017年1月15日 (日) 16:12的版本
跳转至: 导航搜索

注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:前往菜单 → 设置(Mac为Opera → Preferences),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件
$(function() {
    var self = $('#p-cactions .menu ul');
    if (!self.find('li')[0]/* || mw.config.get('wgUserGroups').indexOf('patroller') === -1*/) return;
    if (mw.config.get('wgAction') === 'edit' && decodeURIComponent((/preloadText=[^\&]+/.exec(location.search) || [''])[0])) $('#wpTextbox1').val(decodeURIComponent((/preloadText=[^\&]+/.exec(location.search) || [''])[0]));
    else if (mw.config.get('wgAction') !== 'submit') $('<a/>', {
        attr: {
            href: "#",
            title: "挂删本页[alt-shift-d]",
            accesskey: 'd'
        },
        text: '挂删'
    }).on('click', function() {
        var reason = prompt('挂删的理由【将会替换全文内容】\n【空白则使用默认理由(不在收录范围内或潜在价值较低)】\n【取消则不进行挂删】:'),
            self = $(this);
        if (reason === null) return;
        windows.open(location.origin + location.pathname + (location.search || '?action=edit') + '&preloadText={{即将删除|' + reason + '}}', '_blank');
    }).appendTo($('<li/>').attr('id', 'ca-registerToDelete').prependTo(self));
});