User:Hat600/script/massdelete.js

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

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
;(function($){
    while(1){
        var title = $('#tem').children('ul').children('li:eq(0)')
            .children('a').attr('title');
        if(title === undefined) return 0;
        alert(title);
        var token = '';
        $.ajax({
            url: 'https://zh.wikisource.org/w/api.php?format=json&action=query&meta=tokens',
            type: 'GET',
            dataType: 'json',
            success: function(json){
                token = json.query.tokens.csrftoken;
                $.ajax({
                    url: 'https://zh.wikisource.org/w/api.php',
                    type: 'POST',
                    data: {
                        action: 'delete',
                        title: title,
                        reason: 'per req, see [[WS:DEL]]',
                        token: token,
                        format: 'json'
                    },
                    dataType: 'json',
                    success: function(json){
                        console.log('success');
                    }
                });
            }
        });
        $('#tem').children('ul').children('li:eq(0)').remove();
    }
})(jQuery);