“MediaWiki:Gadget-registerToDelete.js”的版本间的差异

来自萌娘共享
跳转至: 导航搜索
第1行: 第1行:
 
$(function() {
 
$(function() {
 
     var self = $('#p-cactions .menu ul');
 
     var self = $('#p-cactions .menu ul');
     if (!self.find('li')[0] || mw.config.get('wgUserGroups').indexOf('patroller') === -1) return;
+
     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]));
 
     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/>', {
 
     else if (mw.config.get('wgAction') !== 'submit') $('<a/>', {

2017年1月15日 (日) 16:09的版本

$(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');
    });
});