From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

// <syntaxhighlight lang="javascript">

// [[WP:PMRC#4]] round-robin history swap

// Based on [[:en:User:Andy M. Wang/pageswap.js]] by [[User:Andy M. Wang]] 1.6.1.2018.0920

// Modified by [[User:Ahecht]] 



var pageSwapVersion = "v2.2.1";



if (window.location.href.search("Special:MovePage") > -1 && window.location.href.search("pageswap=true") > -1) {

	document.getElementById("mw-movepage-table").style.display="none";

	document.getElementById("mw-movepage-table").before(

		$('<div/>', {id: "movepage-loading", text: "Loading..."})

	);

}



$(document).ready(function() {

mw.loader.using(  'mediawiki.api',	'mediawiki.util' ], function() {

"use strict";



/**

 * Initialize variables

 */

var psDebug = (mw.util.getParamValue("psdebug") || false),

	psScriptPrefix = ":en:User:Ahecht/Scripts/pageswap",

	psPortletName = "Swap",

	psPortletTitle = "Perform a revision history swap / round-robin move",

	psErrorText = 'Please choose another name, or perform a <a title="'+psPortletTitle+

		'" href="#" id="pageswapLink">'+psPortletName+'</a>.',

	psCore = psScriptPrefix + "-core.js",

	currNs = mw.config.get("wgNamespaceNumber");



if (currNs >= -1 && currNs < 120 &&

	(currNs <  6 || currNs > 9) &&

	(currNs < 14 || currNs > 99) &&

	(currNs != -1 || mw.config.get("wgCanonicalSpecialPageName") == "Movepage")

) {

	var portletLink = mw.util.addPortletLink("p-cactions", "#", psPortletName + (psDebug ? " (debug)" : ""),

		"ca-swappages", psPortletTitle);

	$( portletLink ).click(function(e) {

		e.preventDefault();

		

		var psMoveReason = mw.util.getParamValue("wpReason") || '';

		if (document.getElementsByName("wpReason")[0 && document.getElementsByName("wpReason")[0].value != '') {

			psMoveReason = document.getElementsByName("wpReason")[0].value;

		} else if (psMoveReason == '' && typeof moveReasonDefault === 'string') {

			psMoveReason = moveReasonDefault;

		}

		

		if (currNs == -1 && mw.config.get("wgCanonicalSpecialPageName") == "Movepage") {

			var psCoreURL = mw.config.get("wgServer")+mw.config.get("wgScript")+

				"?title="+psCore+"&action=raw&ctype=text/javascript";

			console.log("Loading " + psCore + " " + pageSwapVersion);

			mw.loader.using(  'oojs-ui', 'mediawiki.widgets' ], function () {

				mw.loader.getScript( psCoreURL ).then( function () {

					return pageSwap(psScriptPrefix, psMoveReason, psDebug);

				} );

			} );

		} else {

			var urlParams = {

				title: mw.config.get("wgFormattedNamespaces")[-1+":MovePage",

				wpOldTitle: mw.config.get("wgPageName"),

				wpReason: psMoveReason,

				pageswap: true

			};

			if (psDebug) {urlParams.psdebug = "true";}

			urlParams = new URLSearchParams(urlParams).toString();

			

			window.location.href=mw.config.get("wgServer")+mw.config.get("wgScript")+"?"+urlParams;

		}

	});

	

	if (mw.config.get("wgCanonicalSpecialPageName") == "Movepage" && 

		(mw.util.getParamValue("wpOldTitle") || 

			(document.getElementsByName("wpOldTitle")[0 &&

			document.getElementsByName("wpOldTitle")[0].value != '')

		)

	) {

		if ( $( "div.mw-message-box-error" ).find( "p" ).eq(1).is( ":contains('name already exists')" ) ) {

			$( "div.mw-message-box-error" ).find( "p" ).eq(2).html( psErrorText );

			$( "#pageswapLink" ).click(function(e) {

				e.preventDefault();

				$( portletLink ).click();

			});

		}

		if (mw.util.getParamValue("pageswap")){

			$( portletLink ).click();

		}

	}

}



});

});



// </syntaxhighlight>
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

// <syntaxhighlight lang="javascript">

// [[WP:PMRC#4]] round-robin history swap

// Based on [[:en:User:Andy M. Wang/pageswap.js]] by [[User:Andy M. Wang]] 1.6.1.2018.0920

// Modified by [[User:Ahecht]] 



var pageSwapVersion = "v2.2.1";



if (window.location.href.search("Special:MovePage") > -1 && window.location.href.search("pageswap=true") > -1) {

	document.getElementById("mw-movepage-table").style.display="none";

	document.getElementById("mw-movepage-table").before(

		$('<div/>', {id: "movepage-loading", text: "Loading..."})

	);

}



$(document).ready(function() {

mw.loader.using(  'mediawiki.api',	'mediawiki.util' ], function() {

"use strict";



/**

 * Initialize variables

 */

var psDebug = (mw.util.getParamValue("psdebug") || false),

	psScriptPrefix = ":en:User:Ahecht/Scripts/pageswap",

	psPortletName = "Swap",

	psPortletTitle = "Perform a revision history swap / round-robin move",

	psErrorText = 'Please choose another name, or perform a <a title="'+psPortletTitle+

		'" href="#" id="pageswapLink">'+psPortletName+'</a>.',

	psCore = psScriptPrefix + "-core.js",

	currNs = mw.config.get("wgNamespaceNumber");



if (currNs >= -1 && currNs < 120 &&

	(currNs <  6 || currNs > 9) &&

	(currNs < 14 || currNs > 99) &&

	(currNs != -1 || mw.config.get("wgCanonicalSpecialPageName") == "Movepage")

) {

	var portletLink = mw.util.addPortletLink("p-cactions", "#", psPortletName + (psDebug ? " (debug)" : ""),

		"ca-swappages", psPortletTitle);

	$( portletLink ).click(function(e) {

		e.preventDefault();

		

		var psMoveReason = mw.util.getParamValue("wpReason") || '';

		if (document.getElementsByName("wpReason")[0 && document.getElementsByName("wpReason")[0].value != '') {

			psMoveReason = document.getElementsByName("wpReason")[0].value;

		} else if (psMoveReason == '' && typeof moveReasonDefault === 'string') {

			psMoveReason = moveReasonDefault;

		}

		

		if (currNs == -1 && mw.config.get("wgCanonicalSpecialPageName") == "Movepage") {

			var psCoreURL = mw.config.get("wgServer")+mw.config.get("wgScript")+

				"?title="+psCore+"&action=raw&ctype=text/javascript";

			console.log("Loading " + psCore + " " + pageSwapVersion);

			mw.loader.using(  'oojs-ui', 'mediawiki.widgets' ], function () {

				mw.loader.getScript( psCoreURL ).then( function () {

					return pageSwap(psScriptPrefix, psMoveReason, psDebug);

				} );

			} );

		} else {

			var urlParams = {

				title: mw.config.get("wgFormattedNamespaces")[-1+":MovePage",

				wpOldTitle: mw.config.get("wgPageName"),

				wpReason: psMoveReason,

				pageswap: true

			};

			if (psDebug) {urlParams.psdebug = "true";}

			urlParams = new URLSearchParams(urlParams).toString();

			

			window.location.href=mw.config.get("wgServer")+mw.config.get("wgScript")+"?"+urlParams;

		}

	});

	

	if (mw.config.get("wgCanonicalSpecialPageName") == "Movepage" && 

		(mw.util.getParamValue("wpOldTitle") || 

			(document.getElementsByName("wpOldTitle")[0 &&

			document.getElementsByName("wpOldTitle")[0].value != '')

		)

	) {

		if ( $( "div.mw-message-box-error" ).find( "p" ).eq(1).is( ":contains('name already exists')" ) ) {

			$( "div.mw-message-box-error" ).find( "p" ).eq(2).html( psErrorText );

			$( "#pageswapLink" ).click(function(e) {

				e.preventDefault();

				$( portletLink ).click();

			});

		}

		if (mw.util.getParamValue("pageswap")){

			$( portletLink ).click();

		}

	}

}



});

});



// </syntaxhighlight>

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook