User:Hat600/script/prefixmove.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
;(function($){
var i = 3;
while(1){
var title = $('#mw-prefixindex-list-table tbody').children('tr:nth-child(1)')
.children('td:nth-child(1)').children('a').attr('title');
var newtitle = title.replace(' (', '/');
newtitle = newtitle.replace(')', '');
var title2 = title;
alert('hi');
var movetoken = '';
$.ajax({
url: 'https://wiki.zwnes.eu.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://wiki.zwnes.eu.org/w/api.php',
type: 'POST',
data: {
action: 'move',
from: title2,
to: newtitle,
reason: '',
movetalk: 1,
token: movetoken,
format: 'json'
},
dataType: 'json',
success: function(json){
console.log('success');
}
});
}
});
$('#mw-prefixindex-list-table tbody').children('tr:nth-child(1)')
.children('td:nth-child(1)').remove();
i--;
if ( i == 0 ) {
$('#mw-prefixindex-list-table tbody').children('tr:nth-child(1)').remove();
i = 3;
}
}
})(jQuery);