MediaWiki:Gadget-MoveUtil.js: Difference between revisions

From Elwiki
mNo edit summary
mNo edit summary
Line 16: Line 16:
     }, 'json');
     }, 'json');
     edittoken = $('input[name=wpEditToken]').first().val();
     edittoken = $('input[name=wpEditToken]').first().val();
    $.post('/wiki/api.php?action=edit&title=User:Boxsnake/MoveList&text=\ntest1&summary=Bot Adding From Page Move. --[[Special:Gadgets|Move Util]]&minor&bot', {
        'token': edittoken
    }, function(){
        $('#movepage').submit();
    });
//});
//});

Revision as of 18:55, 6 May 2015

if(wgNamespaceNumber == -1 && /MovePage\/.+/.test(wgTitle)){
    $('#wpMovetalk').attr('checked', 'checked');
    $('#wpLeaveRedirect').removeAttr('checked');
    $('#wpMovesubpages').attr('checked', 'checked');
}
//$('#movepage').submit(function(){
    var wiki, edittoken;
    $.get('/wiki/api.php?action=query&titles=User:Boxsnake/MoveList&prop=revisions&rvprop=content&format=json', function(data){
        if(data.query.pages['-1']){
            wiki = '';
        }
        else{
            data = data.query.pages;
            wiki = data[Object.keys(data)[0]].revisions[0]['*'];
        }
    }, 'json');
    edittoken = $('input[name=wpEditToken]').first().val();
    $.post('/wiki/api.php?action=edit&title=User:Boxsnake/MoveList&text=\ntest1&summary=Bot Adding From Page Move. --[[Special:Gadgets|Move Util]]&minor&bot', {
        'token': edittoken
    }, function(){
        $('#movepage').submit();
    });
//});