_ _    _ _____  ___   __                       
 __      _(_) | _(_)___ / ( _ ) / /_   ___ ___  _ __ ___  
 \ \ /\ / / | |/ / | |_ \ / _ \| '_ \ / __/ _ \| '_ ` _ \ 
  \ V  V /| |   <| |___) | (_) | (_) | (_| (_) | | | | | |
   \_/\_/ |_|_|\_\_|____/ \___/ \___(_)___\___/|_| |_| |_|

User:Ahecht/sandbox/Scripts/pageswap2.js

In this article, User:Ahecht/sandbox/Scripts/pageswap2.js will be analyzed from different perspectives, in order to offer a broad and detailed vision of this topic. Historical, cultural, social, political and economic aspects related to User:Ahecht/sandbox/Scripts/pageswap2.js will be addressed, with the aim of understanding its impact on current society. Recent research, expert opinions and testimonies from people who have had experiences related to User:Ahecht/sandbox/Scripts/pageswap2.js will be presented. Through this exhaustive analysis, we seek to provide the reader with a deep and complete understanding of User:Ahecht/sandbox/Scripts/pageswap2.js, allowing them to form an informed opinion and enrich their knowledge on this topic.
// <syntaxhighlight lang="javascript">
// ] round-robin history swap
// Based on ] by ] 1.6.1.2018.0920
// Modified by ] -- v2.0.0 beta 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("Loading...");
}

$(document).ready(function() {
mw.loader.using( , function() {
"use strict";

/**
 * Initialize variables
 */
var psDebug = (mw.util.getParamValue("psdebug") || false),
	psScriptPrefix = ":en:User:Ahecht/sandbox/Scripts/pageswap",
	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", "#", "Swap" + (psDebug ? " (debug)" : ""),
		"ca-swappages", "Perform a revision history swap / round-robin move");
	$( portletLink ).click(function(e) {
		e.preventDefault();
		
		var psMoveReason = mw.util.getParamValue("wpReason") || '';
		if (document.getElementsByName("wpReason") && document.getElementsByName("wpReason").value != '') {
			psMoveReason = document.getElementsByName("wpReason").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";
			mw.loader.using( , function () {
				mw.loader.getScript( psCoreURL ).then( function () {
					if(psDebug) {console.log(psCoreURL+" loaded. Starting pageSwap("+psScriptPrefix+", "+psMoveReason+", "+psDebug+").");}//debug
					return pageSwap(psScriptPrefix, psMoveReason, psDebug);
				} );
			} );
		} else {
			var urlParams = {
				title: mw.config.get("wgFormattedNamespaces")+":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") &&
			document.getElementsByName("wpOldTitle").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( 'Please choose another name, or perform a <a title="Perform a revision history swap / round-robin move" href="#" id="pageswapLink">swap</a>.' );
			$( "#pageswapLink" ).click(function(e) {
				e.preventDefault();
				$( portletLink ).click();
			});
		}
		if (mw.util.getParamValue("pageswap")){
			$( portletLink ).click();
		}
	}
}

});
});

// </syntaxhighlight>