-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditsame.js
48 lines (43 loc) · 1015 Bytes
/
editsame.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
importScriptURI( 'http://prototype.wikimedia.org/mwe-gadget/mwEmbed/mwEmbed.js?uselang=' + wgUserLanguage );
mw.ready(function()
{
mw.getJSON({
action: "query",
list: "allpages",
apnamespace: 8,
aplimit: 500
}, function(pagelist)
{
for(var j in pagelist.query.allpages)
{
var title = pagelist.query.allpages[j].title;
mw.getJSON({
action: "query",
prop: "revisions",
titles: title,
rvprop: "content"
},function(revision)
{
for(var i in revision.query.pages)
{
var text = revision.query.pages[i].revisions[0]["*"];
var title2 = revision.query.pages[i].title;
mw.getToken(title2, function(token)
{
mw.log(title2 + "(" + token + ") -> " + text);
mw.getJSON({
action: "edit",
title: title2,
text: text,
token: token
},function(editresult)
{
mw.log(editresult.edit.title + " : " + editresult.edit.result);
mw.log(editresult);
});
});
}
});
}
});
});