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

来自萌娘共享
跳转至: 导航搜索
第15行: 第15行:
 
         if (reason === null) return;
 
         if (reason === null) return;
 
         windows.open(location.origin + location.pathname + (location.search || '?action=edit') + '&preloadText={{即将删除|' + reason + '}}', '_blank');
 
         windows.open(location.origin + location.pathname + (location.search || '?action=edit') + '&preloadText={{即将删除|' + reason + '}}', '_blank');
     });
+
     }).appendTo($('<li/>').attr('id', 'ca-registerToDelete').prependTo(self));
 
});
 
});

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

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