User:Doc Taxon/review.js

(function {	'use strict';	if (mw.config.get('wgUserName') == 'IvaBerlin' || mw.config.get('wgUserName') == 'Doc Taxon') {		var title = mw.util.getParamValue('title');		var oldid = mw.util.getParamValue('oldid');		var currevid = mw.config.get('wgCurRevisionId');		var diff = mw.util.getParamValue('diff');		if (diff != currevid && diff !== 'cur') {			return;		}		if (currevid !== 0) {			diff = currevid;		}		var undoedit = function {			mw.loader.using(['mediawiki.api'])				.then(function { var p = { action:		'edit', title:		title, undo:		diff, undoafter:	oldid, summary:	reviewsummary };					var q = new mw.Api; return q.postWithEditToken(p); })				.then(function { location.href = mw.util.getUrl(title); });		};		var $button3 = $(' ')			.attr({ type:	'button', title:	'Diese Textänderungen mit spezieller Zusammenfassungszeile verwerfen', value:	'Änderungen verwerfen (speziell)' })			.on('click', undoedit);		$('#mw-fr-confirmreview').append($button3); 	} });