User:Kangaroopower/ajaxMove.js

/** * Ajax Move * * Creates a form to ajax move pages * * @author Kangaroopower * @credits Ale_jrb (UI) * * From: User:Kangaroopower/Scripts * * To Do (Since this now uses a real dialog, the following are relatively easy to do): * - More options * - Undo * */ $(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:  Reason:   -- 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 = newpage + " (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 mw.loader.moduleRegistry.Flash === "undefined") {			mw.loader.implement('Flash', [ mw.util.wikiScript('index') + '?title=User:Kangaroopower/Flash.js&action=raw&ctype=text/javascript' ], {}, {});		}		mw.loader.using(['Flash'], function { 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");			}		}	}); });