User:Epicgenius/ajaxMove.js

/** * Ajax Move * * Creates a form to ajax move pages * * @author Epicgenius * @credits Ale_jrb (UI); Kangaroopower (original editor) * * Backlink to original: User:Kangaroopower/Scripts * */ $(function {	window.ajaxMove = {		version: '1.93.1',		active: false,		/* Create the pop-up form */		createPopUpForm: function  {			if (ajaxMove.active) return;			var popupHTML = ' Ajax Move Module   Move To:   -- Move --   ';			$('body').append(popupHTML);			ajaxMove.active = true;			$('#mv-close').click(function { ajaxMove.active = false; $( '#ajaxMoveUI' ).remove });			$('#ajaxMoveUI').draggable;		},		movePage: function (token) {			var newpage = $('#mv-new').val,				summary = "(using Ajax Move)";			if (newpage === "") {				$('#mv-error').html('Please enter the destination for the move.');			} else {				Flash('move').load({targ: mw.config.get('wgPageName'), to: encodeURIComponent(newpage), summary: encodeURIComponent(summary), mTalk: true, mSub: true}).wait(function (data) { if (data.error) $('#mv-error').html('Error:' + data.error.info + '. Please see here for more info'); else location.reload; }).run;			}		}	};	$(document).ready(function { if (typeof Flash === "undefined") { importScript('User:Kangaroopower/Flash.js').onload = function { startAJMove; };		} else { startAJMove; }		function startAJMove { if ($.inArray( mw.config.get('wgUserGroups'), "autoconfirmed" ) && document.getElementById('ca-move') && mw.config.get('wgCanonicalNamespace') !== "Special") { mw.util.addPortletLink('p-cactions', 'javascript:ajaxMove.createPopUpForm;', "Ajax Move", "ca-ajaxMove", "Ajax Move"); }		}	}); });