User:Hat600/script/prefixmove.js
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-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 = $('.mw-prefixindex-list').children('li:nth-child(1)')
.children('a').attr('title');
var newtitle = title.replace('A-Chioh:User', 'User:A-Chioh');
var title2 = title;
alert(newtitle);
var movetoken = '';
$.ajax({
url: 'https://zh.wikisource.org/w/api.php?format=json&action=query&titles=' + title2
+ '&prop=info&intoken=move',
type: 'GET',
dataType: 'json',
success: function(json){
$.each(json.query.pages, function(idx, item){
movetoken = item.movetoken;
});
$.ajax({
url: 'https://zh.wikisource.org/w/api.php',
type: 'POST',
data: {
action: 'move',
from: title2,
to: newtitle,
reason: '',
movetalk: 1,
noredirect: 1,
token: movetoken,
format: 'json'
},
dataType: 'json',
success: function(json){
console.log('success');
}
});
}
});
$('.mw-prefixindex-list').children('li:nth-child(1)').remove();
}
})(jQuery);