Difference between revisions of "User:CRLF/common.js"
(grr) |
(works) |
||
| Line 12: | Line 12: | ||
}, | }, | ||
dataType: 'json', | dataType: 'json', | ||
| − | type: 'POST' | + | type: 'POST' |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
}}); | }}); | ||
} | } | ||
Revision as of 01:48, 21 May 2022
function rvt( undop, undoafterp ) {
$.ajax({
url: 'https://www.explainxkcd.com/wiki/api.php',
data: {
format: 'json',
action: 'edit',
title: $("#firstHeading").text().substr(33,$("#firstHeading").text().length-34),
undo: undop,
undoafter: undoafterp,
summary: "Reverted vandalism with [[User:CRLF/common.js]]",
token: mw.user.tokens.get( 'csrfToken' )
},
dataType: 'json',
type: 'POST'
}});
}
var href = $('.mw-diff-undo > a').attr('href').split("=");
var undop = href[4];
var undoafterp = href[3].substr(0,href[3].length-5);
$('.mw-diff-undo > a').removeAttr('href');
$('.mw-diff-undo > a').attr('onclick','rvt('+undop+','+undoafterp+')');
