User:Jackmcbarn/applyPST.js

(function {	'use strict';	var button = $('Apply PST ');	button.click(function(e) { button.prop('disabled', true); var wpTextbox1 = $('#wpTextbox1'); wpTextbox1.prop('disabled', true); var val = wpTextbox1.val; wpTextbox1.val('Please wait. PST in progress'); new mw.Api.post({			action: 'parse',			title: mw.config.get('wgPageName'),			text: val,			prop: 'text',			onlypst: true		}).done(function(data) {			wpTextbox1.val(data.parse.text['*']);		}).fail(function {			console.log.apply(console, arguments);			alert('PST failed. Technical details have been logged to the console.');			wpTextbox1.val(val);		}).always(function {			wpTextbox1.prop('disabled', false);			button.prop('disabled', false);		}); e.preventDefault; });	var span = $(' ');	span.append(button);	$('#wpDiffWidget').after(' ', span); });