Difference between revisions of "User:CRLF/common.js"
(ugh) |
(try) |
||
| Line 1: | Line 1: | ||
| − | + | function rvt( undop, undoafterp ) { | |
| + | $.ajax({ | ||
| + | url: mw.util.wikiScript( 'api' ), | ||
| + | data: { | ||
| + | format: 'json', | ||
| + | action: 'edit', | ||
| + | title: mw.config.get( 'wgPageName' ), | ||
| + | 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+')'); | ||
Revision as of 01:43, 21 May 2022
function rvt( undop, undoafterp ) {
$.ajax({
url: mw.util.wikiScript( 'api' ),
data: {
format: 'json',
action: 'edit',
title: mw.config.get( 'wgPageName' ),
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+')');
