跳转到内容

User:Hat600/script/botmovehx10jul19.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
;(function($){
    var $object = $('div#mw-content-text').children('ul').children('li:eq(0)');

    var x = '<div style="position: fixed; z-index: 27; left: 0; bottom: 0; height: 10%; width: 100%; background: #FFFFFF; border:1px solid black; padding: 4em;"><button id="BMbutton1">Move</button><button id="BMbutton2">Skip</button></div>';

    $('#bodyContent').append(x);
    $object.css('background', '#FFFF00');


    $('#BMbutton1').bind('click', function(){
        var title = $object.children('a').eq(-1).text();
        var title2 = 'User:AddisWang/' + title;
        
        var moveToken = '';
        $.ajax({
            url: 'https://wikicn.playgoteam.workers.dev/w/api.php?format=json&action=query&titles=' + title + '&prop=info&intoken=move',
            type: 'POST',
            dataType: 'json',
            success: function(json){
                $.each(json.query.pages, function(idx, item){
                    movetoken = item.movetoken;
                });
                console.log(movetoken);
                $.ajax({
                    url: 'https://wikicn.playgoteam.workers.dev/w/api.php',
                    type: 'POST',
                    data: {
                        action: 'move',
                        from: title,
                        to: title2,
                        reason: 'Per User Request',
                        movetalk: 1,
                        token: movetoken,
                        format: 'json'
                    },
                    dataType: 'json',
                    success: function(json){
                        console.log('success');
                    }
                });
            }
        });
        $object = $object.next();
        $object.css('background', '#FFFF00');
        $object.prev().remove();
    });

    $('#BMbutton2').bind('click', function(){
        $object = $object.next();
        $object.css('background', '#FFFF00');
        $object.prev().remove();
    });

})(jQuery);