User:Stewbasic/quickpreview.js

if (wgAction == 'edit' || wgAction == 'submit') { $(document).ready(function {		var attrs = {			tabindex: 6,			accesskey: 'g',			id: 'dlQuickPreview',			title: 'Preview your changes'		};		var $button = $(' ').val('Quick preview').attr(attrs).click(function { $(this).val('Getting preview').attr('disabled', 'disabled'); var f = document.editform; $.ajax({				data: {					'wpMinoredit': f.wpMinoredit.checked,					'wpWatchthis': f.wpWatchthis.checked,					'wpStarttime': f.wpStarttime.value,					'wpEdittime': f.wpEdittime.value,					'wpAutoSummary': f.wpAutoSummary.value,					'wpEditToken': f.wpEditToken.value,					'wpSummary': 'Quick preview',					'wpTextbox1': f.wpTextbox1.value				},				dataType: 'text',				type: 'POST',				url: wgScript + document.location.search.replace('&action=edit', '&action=submit') + '&wpPreview=true&live=true',				success: function(response) {					$('#wikiPreview').css('display', 'block').html(response.replace(/&gt;/g, '>').replace(/&lt;/g, '<').replace(/&amp;/g, '&').replace(/&quot;/g, '"'));					var holder = loadedScripts;					loadedScripts = {};					if ($('.jcInput').length||$('[class*="jcPane"]').length) {						importScript('User:Stewbasic/calc.js');					}					loadedScripts = holder;					$('#dlQuickPreview').val('Quick preview').removeAttr('disabled'); }			});		});		if (skin == 'monobook') { // Monobook $('#wpPreview').after($button); } else { // Monaco/Oasis/Wikia $('#wpSave').before($button); $('body').append($(' ').attr('id','wikiPreview').toggle(false)); }			}); }