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

User:Tails Wx/common.js

In this article about User:Tails Wx/common.js we will explore different aspects and perspectives about this broad and relevant topic in today's society. From its origin and evolution, to its implications in different areas of daily life, we will delve into a detailed analysis that will allow us to better understand the multiple dimensions that User:Tails Wx/common.js encompasses. Through research and reflection, we seek to shed light on aspects that are little known or debated, in order to enrich our understanding of User:Tails Wx/common.js and its implications in the contemporary world.
importScript('User:Jackmcbarn/editProtectedHelper.js'); // Linkback: ]
importScript( 'User:Qwertyytrewqqwerty/DisamAssist.js' ); // Backlink: ]
//Mass rollback function
//Written by John254 and modified/rewritten by Writ Keeper with modifications by TheDJ; original is at https://en.wikipedia.orghttps://wiki386.com/en/User:John254/mass_rollback.js
//Adapted from User:Mr.Z-man/rollbackSummary.js
//Instructions: Selecting the "rollback all" tab when viewing a user's contributions history
//will open all rollback links displayed there. (Use with caution)
if(typeof wkContribsCheckboxInit === "undefined")
{
	wkContribsCheckboxInit = false;
}

function rollbackEverythingWKMR(editSummary) 
{
	if(editSummary === null)
	{
		return false;
	}
	mw.loader.using( 'mediawiki.api' ).done( function()
	{
		var rbMetadata = {};
		rbMetadata.api = new mw.Api();
		rbMetadata.userName = mw.config.get("wgRelevantUserName");
		rbMetadata.ipRange = (rbMetadata.userName === null);
		rbMetadata.titleRegex = /title=(+)/;
		rbMetadata.editSummary = editSummary;
		$("a").each(function(ind, el)
		{
			rollbackOneThingWKMR(el, rbMetadata);
		} );
	} );
	return false;
}
function rollbackSomeThingsWKMR(editSummary)
{
	if(editSummary === null)
	{
		return false;
	}
	mw.loader.using( 'mediawiki.api' ).done( function()
	{
		var rbMetadata = {};
		rbMetadata.api = new mw.Api();
		rbMetadata.userName = mw.config.get("wgRelevantUserName");
		rbMetadata.titleRegex = /title=(+)/;
		rbMetadata.editSummary = editSummary;
		var rollbackList = $("input.revdelIds:checked").parents("li.mw-contributions-current").find("a");
		if(rollbackList.length <= 0)
		{
			mw.notify("You didn't select any edits that could be rolled back!");
			return;
		}
		$("input.revdelIds:checked").parents("li.mw-contributions-current").find("a").each(function(ind, el)
		{
			rollbackOneThingWKMR(el, rbMetadata);
		} );
	} );
}
function rollbackOneThingWKMR(edit, rbMetadata)
{
	var userName;
	//if we're in an anonymous IP range, we have to figure out each username on its own, since they might be different for each edit.
	if(rbMetadata.userName === null)
	{
		//the not clause is probably not necessary, but I'm including it just to be sure.
		userName = $(edit).parents("li:first").children("a.mw-anonuserlink").not(".mw-contributions-title").text();
	}
	else
	{
		userName = rbMetadata.userName;
	}
	var params = {};
	if( rbMetadata.editSummary != '' )
	{
		params.summary = rbMetadata.editSummary;
	}
	rbMetadata.api.rollback( decodeURIComponent(rbMetadata.titleRegex.exec(edit.href)), userName, params).done( function()
	{
		$(edit).after("reverted");
		$(edit).remove();
	} );
}
$(document).ready(function()
{
	if(mw.config.get("wgCanonicalSpecialPageName") == "Contributions" && $("span.mw-rollback-link").length > 0)
	{
		mw.loader.using("mediawiki.util").done( function ()
		{
			mw.util.addPortletLink('p-cactions', '#', "rollback all", "ca-rollbackeverything", "rollback all edits displayed here");
			if(!wkContribsCheckboxInit)
			{
				if($("ul.mw-contributions-list .mw-revdelundel-link").length > 0)
				{
					$("ul.mw-contributions-list .mw-revdelundel-link").each(function(ind,el){
						if($(this).children("a").length > 0)
						{
							var revId = /ids=(\d+)/.exec($(this).children("a").attr("href"));
							var pageTitle = /target=(+)/.exec($(this).children("a").attr("href"));
							$(el).prepend("<input type='checkbox' name='"+decodeURIComponent(pageTitle)+"' class='revdelIds' value='"+revId+"'>&nbsp;");
							$(el).children(".revdelIds").data("index", ind);
						}
					});
				}
				else
				{
					$("ul.mw-contributions-list a.mw-changeslist-date").each(function(ind,el){
						$(el).before("<input type='checkbox' class='revdelIds'>&nbsp;");
					});
				}
				wkContribsCheckboxInit = true;
			}
			mw.util.addPortletLink('p-cactions', '#', "rollback selected", "ca-rollbacksome", "rollback selected edits");
			$("#ca-rollbackeverything").click( function(event)
			{
				event.preventDefault();
				mw.loader.load( 'mediawiki.api' ); //start loading, while the user is in the prompt	
				return rollbackEverythingWKMR(prompt("Enter an edit summary, or leave blank to use the default (or hit Cancel to cancel the rollback entirely)"));
			});
			$("#ca-rollbacksome").click( function(event)
			{
				event.preventDefault();
				mw.loader.load( 'mediawiki.api' ); //start loading, while the user is in the prompt	
				return rollbackSomeThingsWKMR(prompt("Enter an edit summary, or leave blank to use the default (or hit Cancel to cancel the rollback entirely)"));
			});
		});
	}
});
importScript( 'User:Enterprisey/orcp-helper.js' ); // Backlink: ]
importScript( 'User:Evad37/OneClickArchiver.js' ); // Backlink: ]
//Mass rollback function
//Written by John254 and modified/rewritten by Writ Keeper with modifications by TheDJ; original is at https://en.wikipedia.orghttps://wiki386.com/en/User:John254/mass_rollback.js
//Adapted from User:Mr.Z-man/rollbackSummary.js
//Instructions: Selecting the "rollback all" tab when viewing a user's contributions history
//will open all rollback links displayed there. (Use with caution)
if(typeof wkContribsCheckboxInit === "undefined")
{
	wkContribsCheckboxInit = false;
}

function rollbackEverythingWKMR(editSummary) 
{
	if(editSummary === null)
	{
		return false;
	}
	mw.loader.using( 'mediawiki.api' ).done( function()
	{
		var rbMetadata = {};
		rbMetadata.api = new mw.Api();
		rbMetadata.userName = mw.config.get("wgRelevantUserName");
		rbMetadata.ipRange = (rbMetadata.userName === null);
		rbMetadata.titleRegex = /title=(+)/;
		rbMetadata.editSummary = editSummary;
		$("a").each(function(ind, el)
		{
			rollbackOneThingWKMR(el, rbMetadata);
		} );
	} );
	return false;
}
function rollbackSomeThingsWKMR(editSummary)
{
	if(editSummary === null)
	{
		return false;
	}
	mw.loader.using( 'mediawiki.api' ).done( function()
	{
		var rbMetadata = {};
		rbMetadata.api = new mw.Api();
		rbMetadata.userName = mw.config.get("wgRelevantUserName");
		rbMetadata.titleRegex = /title=(+)/;
		rbMetadata.editSummary = editSummary;
		var rollbackList = $("input.revdelIds:checked").parents("li.mw-contributions-current").find("a");
		if(rollbackList.length <= 0)
		{
			mw.notify("You didn't select any edits that could be rolled back!");
			return;
		}
		$("input.revdelIds:checked").parents("li.mw-contributions-current").find("a").each(function(ind, el)
		{
			rollbackOneThingWKMR(el, rbMetadata);
		} );
	} );
}
function rollbackOneThingWKMR(edit, rbMetadata)
{
	var userName;
	//if we're in an anonymous IP range, we have to figure out each username on its own, since they might be different for each edit.
	if(rbMetadata.userName === null)
	{
		//the not clause is probably not necessary, but I'm including it just to be sure.
		userName = $(edit).parents("li:first").children("a.mw-anonuserlink").not(".mw-contributions-title").text();
	}
	else
	{
		userName = rbMetadata.userName;
	}
	var params = {};
	if( rbMetadata.editSummary != '' )
	{
		params.summary = rbMetadata.editSummary;
	}
	rbMetadata.api.rollback( decodeURIComponent(rbMetadata.titleRegex.exec(edit.href)), userName, params).done( function()
	{
		$(edit).after("reverted");
		$(edit).remove();
	} );
}
$(document).ready(function()
{
	if(mw.config.get("wgCanonicalSpecialPageName") == "Contributions" && $("span.mw-rollback-link").length > 0)
	{
		mw.loader.using("mediawiki.util").done( function ()
		{
			mw.util.addPortletLink('p-cactions', '#', "rollback all", "ca-rollbackeverything", "rollback all edits displayed here");
			if(!wkContribsCheckboxInit)
			{
				if($("ul.mw-contributions-list .mw-revdelundel-link").length > 0)
				{
					$("ul.mw-contributions-list .mw-revdelundel-link").each(function(ind,el){
						if($(this).children("a").length > 0)
						{
							var revId = /ids=(\d+)/.exec($(this).children("a").attr("href"));
							var pageTitle = /target=(+)/.exec($(this).children("a").attr("href"));
							$(el).prepend("<input type='checkbox' name='"+decodeURIComponent(pageTitle)+"' class='revdelIds' value='"+revId+"'>&nbsp;");
							$(el).children(".revdelIds").data("index", ind);
						}
					});
				}
				else
				{
					$("ul.mw-contributions-list a.mw-changeslist-date").each(function(ind,el){
						$(el).before("<input type='checkbox' class='revdelIds'>&nbsp;");
					});
				}
				wkContribsCheckboxInit = true;
			}
			mw.util.addPortletLink('p-cactions', '#', "rollback selected", "ca-rollbacksome", "rollback selected edits");
			$("#ca-rollbackeverything").click( function(event)
			{
				event.preventDefault();
				mw.loader.load( 'mediawiki.api' ); //start loading, while the user is in the prompt	
				return rollbackEverythingWKMR(prompt("Rollback all edits: Enter an edit summary, or leave blank to use the default (or hit Cancel to cancel the rollback entirely)"));
			});
			$("#ca-rollbacksome").click( function(event)
			{
				event.preventDefault();
				mw.loader.load( 'mediawiki.api' ); //start loading, while the user is in the prompt	
				return rollbackSomeThingsWKMR(prompt("Rollback selected edits: Enter an edit summary, or leave blank to use the default (or hit Cancel to cancel the rollback entirely)"));
			});
			$("#ca-rollbacksome").data("lastSelectedIndex", -1);

			$("input.revdelIds").off("click").click(
				function(ev)
				{
					var lastSelectedRevdel = $("#ca-rollbacksome").data("lastSelectedIndex");
					var newIndex = $(this).data("index")
					if(ev.shiftKey && lastSelectedRevdel >= 0)
					{
						var checkboxArray = $("input.revdelIds");
						var start = lastSelectedRevdel;
						var stop = newIndex;
						if(start < stop)
						{
							for(var i = start; i < stop; i++)
							{
								$(checkboxArray).prop("checked", true);
							}
						}
						else
						{
							for(var i = start; i > stop; i--)
							{
								$(checkboxArray).prop("checked", true);
							}
						}
					}
					 $("#ca-rollbacksome").data("lastSelectedIndex", newIndex);
				});

		});
	}
});
importScript('User:Mr. Stradivarius/gadgets/ConfirmRollback.js'); // Linkback: ]
importScript('User:MusikAnimal/confirmationRollback.js'); // Linkback: ]
importScript( 'User:DannyS712/DiscussionCloser.js' );// ]
// ---------------------------------------------------------------------------
//
//  What follows is a fork of ] (forked on 27 May 2020)
//  The editor who developed the script is no longer active, and changes to
//  Wikipedia have restricted who can edit the old script page.
//
//  Please see the edit history for ] for attribution
//  
//  --------------------------------------------------------------------------
//  Fix hyphens, dashes, and minus signs per ].
//
//  See talk page for instructions.
//
//  The user can disable these conversions by putting "nodashes" somewhere
//  in the text — either temporarily or permanently.  You can similarly add
//  "scores" if the score-detection heuristic doesn't trigger automatically.
//
//  This tool can be used standalone until it is added to AutoEd and wikEd.
//  This module should follow unicodify.js if it is used.
//  Testing page is at ].
//  Please report false positives on the talk page.

function autoEdDashes (str)
{
  if (str.search(/nodashes/i) >= 0)
    return str;

  var scpat = /\bscores?\b|\[\[Category:.*\b(sport|athlet|players|teams|games|league|champion|tournament|competit|cup\b|\w+ball\b|hockey|lacrosse|cricket|rugby|tennis|golf|polo|boxing|boxers|martial.art|chess)/i;
  var scoresAreLikely = (str.search(scpat) >= 0);

  // Ensure the replacement isn't a link such as ] before
  // replacing it, so that we don't break the link. But we do want to
  // replace dashes used in the right-side label part of links.  Also,
  // don't break templates, URLs, DOIs, {{#expr:}}, <math> equations,
  // source code, or <ref name="13-70">.
  //
  function ifNotLink (str)
  {
    var pos    = arguments;
    var string = arguments;

    var pat = /\]*$|\{\{*$|+$|<*$|#\w*expr:.*$/i;
    if (string.substring(pos-260,pos+1).search(pat) >= 0)
        return str;             // it's a link, so don't change it

    var pat2 = /\{\{(main|see|detail|excerpt|about|for\b|other|redir|conv|coor|sort|anchor|Israel populations|ISBN|DNB(?: ite|)|ite DNB)*$/i;
    if (string.substring(pos-260,pos+1).search(pat2) >= 0)
        return str;             // likely templates with page-name or neg params
        
    var pat3 = /\|\s*(CAS_number)\s*=\s*/i;
    if (string.substring(pos-260,pos+1).search(pat3) >= 0)
        return str;             // drugbox CAS_number
        
    var pat4 = /\|\s*(doi|elevation|filename|isbn)\s*=\s*/i;
    if (string.substring(pos-260,pos+1).search(pat4) >= 0)
        return str;             // doi or isbn (or elevation parameter in Template:Infobox German location which can contain range marked using hyphen)

    var m = string.slice(pos).search(/<\/?(math|pre|code|tt|source|syntaxhighlight|gallery)\b/i);
    if (m >= 0 && string.charAt(pos+m+1) == '/')
        return str;             // don't break a <math> equation, or source code

    m = string.slice(pos).search(/\{\{*raph:Chart\b/i);
    if (m >= 0)
        return str;             // don't break a Graph:Chart

    if (string.slice(pos).search(/^<>\n]*\.({3,4}\s*|jpg|png|svg)|^.*hyphen/i) >= 0)
        return str;             // it's a file name parameter, or <!--sic hyphen-->

    if (str.search(/\b/) >= 0)
        return str.replace(//, "−");       // minus sign
    else
        return str.replace(/--+\b/g, "—") . replace(/+/g, "–");     // dash
  }

  str = str.replace(/\s--?\s/g, ifNotLink);                 // en dash looks better
  str = str.replace(/---?/ig, ifNotLink);     // em dash
  str = str.replace(/\d\d\d]*}*(present|current)\b/ig, ifNotLink);       // 1973-present
  str = str.replace(/(18|19|20)\d\d]*}*/g, ifNotLink);     // (1973-)
  str = str.replace(/\d(s|%|\?|''')\d/g, ifNotLink);    // 1950s-1960s, 40%-50%
  str = str.replace(/\d(\$|'+)\d/g, ifNotLink);         // $40-$50, 7-'''4''', '49-'53
  str = str.replace(/%?/g, ifNotLink);           // 3½-6
  str = str.replace(/\d(st|nd|rd|th)?\d+(st|nd|rd|th)\b/g, ifNotLink);   // 2nd-3rd

  str = str.replace(/(>] +|\(|^\| *|\|\| *)\d/mig, ifNotLink);   // minus -35
  str = str.replace(/<((sup|sub|td)>\s*)(\d)/ig, "<$1−$3");         // 10<sup>-3</sup>
  str = str.replace(/,*(?=.? ) * *(\d*:\d\d)/g, " – $1");   // album track listings

  // November 15, 2005-March 7, 2006; ]-]
  str = str.replace(/(\d\]*)(\* +\d)/g, "$1 – $2");
  // July-August 2007
  str = str.replace(/\b((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)*?\b){2,}/g, ifNotLink);
  // ]-]
  str = str.replace(/(\d(?: BC)?\]\])((ca?\.|AD ?)?\)/g, "$1–$2");
  // (1984 – 1992)
  str = str.replace(/( *\*) + +(\*\s*)/g, "$1–$2");
  // iv-xii
  str = str.replace(/(?=\w+-)(m*(cm|cd|d?c*)(xc|xl|l?x*)(ix|iv|v?i*)-?\b){2}/g, ifNotLink);

  if (scoresAreLikely)      // W-L-D or 73–70–67–70=280, but not castling
    str = str.replace(/(?!0-0-0)(\d\d?\d?){2,}\d\d?/g, ifNotLink);

  str = str.replace(/\b(\d+)(year|month|day|hour|minute|mile|yard|foot|inch|bit|door|speed|gun|page|seat|way|point|ton|man)\b/g, "$1-$2");     // hyphen

  // Number ranges and scores should use en dashes, per ].
  // This has been well-tested and false positives (e.g., ID nos.) are rare.
  //
  function range (str, from,to, pos,string)
  {
    var dash   = true;
    var except = /\b(fig(ure)?|table|example|exhibit|circular|section|part|number|no|nr|id|model|pub|std|report|rpt|law|L|p|page|date|IS\wN\b*|SCOTUS)*$/i;
    var rpat   = /^(|nbsp)*(AD|BC|B?CE|BP|a|km|mi|kg|lb|\w?Hz|vote|decision|record|odds|scor\w*|win|loss|tie|draw|lead|victory|defeat|upset|run|deficit|start|finish|season|game)\b/;
    var lpat   = /\b(pages|pp|rp|nos|\d+\)?'*|(wn|lost?|tie|dr.w|lea?d|f.ll|vot|rul|decid|pass|fail|defeat|scor|gam|match|trail|finish|end)e??|\w\w+ing|ahead|behind|up|down|from|to|is|are|was|were|of|out|by|an?|at|it|went|go|gone|beaten|between)(|nbsp)*$/i;
    var inorder   = (to-0 > from.slice(-to.length));     // pp 362-5
    var precision = Math.max( from.search(/0*$/), to.search(/0*$/) );

    if (string.substring(pos-20,pos+1).search(except) >= 0) {
        return str;      // based on preceding word, looks like a ref number
    }
    if (from == 9 && to == 11) {
        dash = false;    // 9-11 is a common special case
    }
    if (from-0 >= to) {
        dash = false;    // values don't look like a range
    }
    if (to-from > 120 && from * (precision > 2 ? 5 : 50) < to && from > 1) {
        dash = false;    // values don't look like a range
    }
    if (scoresAreLikely && from <= 900 && to <= 900) {
        dash = true;     // likely a score or wins-losses
    }
    if (from < 2-to && string.search(/Category:.*\bChess\b/i) >= 0) {
        dash = false;    // chess notations 0-0, 0-1, 1-0
    }
    if (str.charAt(0) == '(' && string.charAt(pos + str.length) == ')') {
        dash = true;     // scores often seen as (8-4)
    }
    if (from.search(/^0./) >= 0 || to.search(/^0./) >= 0) {
        dash = false;    // 3-07 and 0123-4567 look like ref numbers
    }
    if (string.substr(pos-1,15).search(/^\d()\d+.\d+\1\d/) >= 0) {
        dash = true;     // 10:30-11:30, 35,000-40,000, 2.5-4.0
    }
    if (string.substr(pos,30).search(rpat) >= 0) {
        dash = true;     // 12-5 BC, 5-5000&nbsp;km, 6-4 win, 73-50 vote
    }
    if (string.substring(pos-80,pos).search(lpat) >= 0) {
        dash = true;     // pp.&nbsp;8, 25, 270-74, 313-7; won 6-4, 6-2
    }
    if (from > 1000 && from < 2100 && to.length == 2 && inorder) {
        dash = true;     // 1994-95 year range
    }
    return dash ? ifNotLink(str,pos,string) : str;
  }

  str = str.replace(/(\d{1,4})(\d{1,4})(?!'*)/g, range);

  return str;
}


//  Hook to allow using this tool "standalone"

if (importScript("Wikipedia:AutoEd/core.js"))   // if not otherwise using AutoEd
    console.log('imported')

    function autoEdFunctions() {
        var txt = document.editform.wpTextbox1;
        var str = txt.value.
                  replace(/&mdash;/g, '—').
                  replace(/&ndash;/g, '–').     // simplify core regexes
                  replace(/&minus;/g, '−');
        var newstr = autoEdDashes( str );
        if (newstr != str) {         // don't alter encoding style if no fixes
            txt.value = newstr;
            autoEdTag = "fixed ] using ]";
        }
    }
    autoEdLinkName  = "–";
    autoEdLinkHover = "Fix dashes, hyphens, and minus signs";
    autoEdTag       = "";
    
importScript( 'User:Qwertyytrewqqwerty/DisamAssist.js' ); // Backlink: ]
mw.loader.load( '/w/index.php?title=User:EnterpriseyBot/delsort.js&action=raw&ctype=text/javascript' ); // Backlink: ]
importScript( 'User:Qwertyytrewqqwerty/DisamAssist.js' ); // Backlink: ]
importScript( 'User:SD0001/BDCS.js' ); // Backlink: ]
importScript("User:Awesome Aasim/xfdvote.");
importScript('User:Novem Linguae/Scripts/CiteHighlighter.js'); // Backlink: ]
importScript( 'User:Ingenuity/AntiVandal.js' ); // Backlink: ]
importScript( 'User:MPGuy2824/MoveToDraft.js' ); // Backlink: ]
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Uziel302/typo.js&action=raw&ctype=text/javascript');
importScript("User:Writ Keeper/Scripts/teahouseUtility.js"); // Gives one-click option to add Teahouse invitation or talkback to a user

importScript("User:Writ Keeper/Scripts/teahouseTalkback.js"); // Adds Talkback reminder when you save an edit at the Teahouse

importScript("User:Writ Keeper/Scripts/teahouseTalkbackLink.js"); // Adds a talkback link to signatures on the Teahouse

importScript("User:Ocaasi/WikiLoveinstallscript.js");// Adds Teahouse Badges to WikiLove
importScript('User:SD0001/DYK-helper.js'); // ]
importScript( 'User:Enterprisey/cv-revdel.js' ); // Backlink: ]
importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool
importScript( 'User:Headbomb/unreliable.js' ); // Backlink: ]
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Wugapodes/Capricorn.js&action=raw&ctype=text/javascript');
importScript( 'User:Eejit43/scripts/redirect-helper.js' ); // Backlink: ]
mw.loader.load( '/w/index.php?title=User:Evad37/rater.js&action=raw&ctype=text/javascript' ); // Backlink: ]
importScript('User:SD0001/GAN-helper.js'); // ]
// <nowiki>
// Attribution: Enterprisey and Red-tailed Hawk
// Licenses: CC BY-SA 3.0 unported and GFDL
// License link (CC): https://creativecommons.org/licenses/by-sa/3.0/legalcode
// License link (GNU): https://www.gnu.org/licenses/fdl-1.3.html

$( function () {
    var ADVERT = " (])";
    var SUMMARY = "Requesting copyvio revdel" + ADVERT;
    var SUMMARY_TALK = "Add note about recent copyvio" + ADVERT;
    var CCLEAN_TPL = "Cclean";
    var pageName; // Current page name
    var urlCounter = 1;
    var api;

    /**
     * Make a link to a given oldid of the current page.
     */
    function makeOldidLink( oldid ) {
        var href = "/w/index.php?title=" + encodeURIComponent( pageName ) +
            "&oldid=" + oldid;
        var link = document.createElement( "a" );
        link.href = href;
        link.textContent = oldid;
        return link;
    }

    /**
     * Add the appropriate copyvio-revdel template to the current page.
     */
    function addCvRevdel( urls ) {
        var deferred = $.Deferred();

        var template = "{" + "{copyvio-revdel";
        template += urls.map( function ( u, idx ) {
                    var num = idx == 0 ? "" : ( idx + 1 );
                    return "|url" + num + "=" + u;
                } ).join( "" );
        var rows = document.querySelectorAll( "#cv-revdel tr" );
        var num;
        for( var i = 1, n = rows.length; i < n; i++ ) {
            template += "|start" + i + "=" + rows.childNodes.textContent
                + ( rows.childNodes.childNodes.checked ? ( "|end" + i + "=" + rows.childNodes.textContent ) : "" );
        }
        template = template + "|CopyPatrol="+ document.getElementById("copypatrol-url0").value;
        template += "}}";

        api.postWithToken( "csrf", {
            action: "edit",
            title: pageName,
            summary: SUMMARY,
            prependtext: template + "\n"
        } ).done( function ( d ) {
            if( d && d.edit && d.edit.result && d.edit.result == "Success" ) {
                $( "#cv-rd-status" ).text( "Success!" );
                deferred.resolve();
            } else if( d && d.error ) {
                $( "#cv-rd-status" ).html( "Error! Edit failed: " + d.error.info );
                console.log( d );
                deferred.reject();
            } else {
                $( "#cv-rd-status" ).html( "Error! Edit failed." );
                console.log( d );
                deferred.reject();
            }
        } ).fail( function ( code, result ) {
            console.log( code, result );
            if( result && result.error && result.error.spamblacklist ) {
                $( "#cv-rd-status" ).html( "Error! The following URLs were on the <a href='" + mw.util.getUrl( "MediaWiki:Spam-blacklist" ) + "'>spam blacklist</a>: " + result.error.spamblacklist.matches.join( ", " ) + ". Consider removing the 'https://' or 'http://' from the beginning to make them not links." );
            } else {
                $( "#cv-rd-status" ).html( api.getErrorMessage( result ) );
            }
            deferred.reject();
        } );

        return deferred;
    }

    function addCclean( urls ) {
        var deferred = $.Deferred(),
            template = "{" + "{subst:cclean|url=" + urls.join( " " ) + "}}",
            talkNs = mw.config.get( "wgNamespaceNumber" ) | 1,
            talkNsName = mw.config.get( "wgFormattedNamespaces" ),
            talkPage = talkNsName + ":" + mw.config.get( "wgTitle" );
        api.postWithToken( "csrf", {
            action: "edit",
            title: talkPage,
            summary: SUMMARY_TALK,
            appendtext: "\n\n" + template
        } ).done( function ( d ) {
            if( d && d.edit && d.edit.result && d.edit.result == "Success" ) {
                deferred.resolve();
            } else {
                deferred.reject();
                console.log( d );
            }
        } ).fail( function ( code, result ) {
            deferred.reject();
            $( "#cv-rd-status" ).append( "Also, while editing " + talkPage +
                    ", this error happened: " + api.getErrorMessage( result ) );
            console.log( code, result );
        } );
        return deferred;
    }

    /**
     * Load the main cv-revdel panel and add buttons/other stuff to
     * the history UI
     */
    function load( evt ) {
        if( evt ) evt.preventDefault();

        // Don't load the panel for a second time if it's already there
        if( document.getElementById( "cv-revdel" ) ) return;

        api = new mw.Api();

        // Style for the panel
        mw.util.addCSS(
            "#cv-revdel { border: thin solid rgb(197, 197, 197); " +
            "box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.25); border-radius: 3px;" +
            "padding: 2em; display: inline-block }" +
            "#cv-revdel table { margin: 1em 0 }" +
            "#cv-revdel td { padding: 0 0.5em }" +
            "#cv-revdel a.disabled {color: gray;text-decoration: line-through;font-style: italic;}" +
            "#cv-rd-submit { margin-right: 1em }"+
            "#cv-rd-urls input { width: 50%; min-width: 30em; }"+
            "#cv-rd-urls div { margin-bottom: 0.35em; }"+
            "#cv-revdel div.bottom-row { margin-top: 1em; }"+
            "#cv-rd-add-range { margin-right: 0.5em; }"
        );

        // Add the panel itself
        var panel = document.createElement( "div" );
        panel.id = "cv-revdel";
        var urlHTML = "<div id='cv-rd-urls'>" +
            "<div><label for='cv-rd-url0'>URL: </label><input type='text' "+
            "id='cv-rd-url0' class='mw-ui-input mw-ui-input-inline'/>"+
            "<button class='mw-ui-button mw-ui-quiet'>Remove</button></div>" +
            "</div>"+
            "<button id='cv-rd-url-add' class='mw-ui-button'>Add another</button>";
        var copyPatrolHTML = "<div><label for='copypatrol-url0'> CopyPatrol URL: </label><input type='text' "+
            "id='copypatrol-url0' class='mw-ui-input mw-ui-input-inline'/>";
        panel.innerHTML = "<p>Instructions: Select a range of revisions using " +
            "the radio buttons you would normally use for comparing two " +
            "revisions, then click 'Add range to revdel template' to add the " +
            "range to the template. 'Include end?' should be unchecked to tag " +
            "only the single revision in the 'Start' column. Fill in URLs, and " +
            "then click 'Submit' to place the template.</p><br />" +
            urlHTML + "<p>\n\n</p>"+ copyPatrolHTML + "<table id='cv-rd-ranges'><tr><th>Start</th><th>End</th>" +
            "<th>Include end?</th><th>Remove</th></table>" +
            "<input type='checkbox' id='cv-rd-cclean' />" +
            "<label for='cv-rd-cclean'>Add {{subst:<a href='" + 
              mw.util.getUrl( "Template:" + CCLEAN_TPL ) + "'>Cclean</a>}} to " +
              ( ( mw.config.get( "wgNamespaceNumber" ) % 2 ) ? "this" : "talk" ) +
              " page</label><br />"+
            "<div class='bottom-row'><button id='cv-rd-submit' class='mw-ui-button"+
              " mw-ui-progressive'>Submit</button>" +
              "<button id='cv-rd-close' class='mw-ui-button mw-ui-quiet'>Close</button>"+
              "<span id='cv-rd-status'></span></div>";
        document.getElementById( "bodyContent" ).insertBefore( panel,
            document.getElementById( "mw-content-text" ) );

        // Add range-add buttons before each of the buttons
        // that say "Compare selected revisions"
        var cmpSelRevsBtns = document.getElementsByClassName( "historysubmit" );
        for( var i = 0, n = cmpSelRevsBtns.length; i < n; i++ ) {
            var rangeBtn = document.createElement( "button" );
            rangeBtn.textContent = "Add range to revdel template";
            rangeBtn.className = "mw-ui-button + mw-ui-progressive";
            rangeBtn.id = "cv-rd-add-range";
            cmpSelRevsBtns.parentNode.insertBefore( rangeBtn, cmpSelRevsBtns );
            rangeBtn.addEventListener( "click", function ( evt ) {
                evt.preventDefault();

                var oldidStart = document.querySelector( "li.selected.after" ).dataset.mwRevid;
                var oldidEnd = document.querySelector( "li.selected.before" ).dataset.mwRevid;

                // Add new row to ranges table
                var rangesTable = document.getElementById( "cv-rd-ranges" ).getElementsByTagName( "tbody" );
                var newRow = rangesTable.insertRow( rangesTable.rows.length );
                newRow.insertCell( 0 ).appendChild( makeOldidLink( oldidStart ) );
                newRow.insertCell( 1 ).appendChild( makeOldidLink( oldidEnd ) );
                newRow.insertCell( 2 ).innerHTML = "<input type='checkbox' />";
                newRow.cells.childNodes.checked = true;
                newRow.cells.childNodes.addEventListener( "click", function () {
                    this.parentNode.previousElementSibling.childNodes.className = this.checked ? "" : "disabled";
                } );
                var deleteBtn = document.createElement( "button" );
                deleteBtn.textContent = "Delete";
                deleteBtn.className = "delete";
                deleteBtn.addEventListener( "click", function () {
                    this.parentNode.parentNode.parentNode.removeChild(
                        this.parentNode.parentNode );
                } );
                newRow.insertCell( 3 ).appendChild( deleteBtn );
            } );
        }

        // Panel submission handler
        document.getElementById( "cv-rd-submit" ).addEventListener( "click", function () {
            $( this ).prop( "disabled", true );
            $( "#cv-rd-status" ).empty();
            var urls = Array.prototype.map.call( document.getElementById( "cv-rd-urls" ).children,
                    function ( e ) { return e.children.value; } );
            var deferreds = ;
            if( document.getElementById( "cv-rd-cclean" ).checked ) {
                deferreds.push( addCclean( urls ) );
            }
            $.when.apply( $, deferreds ).then( function () {
                // Return to content page
                document.querySelector( "#ca-view a" ).click();
            }, function () {
                $( this ).prop( "disabled", false );
            }.bind( this ) );
        } );

        // "Add URL" handler
        document.getElementById( "cv-rd-url-add" ).addEventListener( "click", function () {
            var numUrls = document.querySelectorAll( "#cv-rd-urls div" ).length;
            if( numUrls < 3 ) {
                var newDiv = document.createElement( "div" );
                newDiv.innerHTML = "<label for='cv-rd-url" + urlCounter + "'>URL: </label>"+
                    "<input type='text' id='cv-rd-url" + urlCounter +
                    "' class='mw-ui-input mw-ui-input-inline'/>"+
                    "<button class='mw-ui-button mw-ui-quiet'>Remove</button>";
                document.getElementById( "cv-rd-urls" ).appendChild( newDiv );
                urlCounter++;
                this.disabled = numUrls >= 2;
            }
        } );

        // Remove URL handler
        document.getElementById( "cv-rd-urls" ).addEventListener( "click", function ( e ) {
            var numUrls = document.querySelectorAll( "#cv-rd-urls div" ).length;
            if( e.target && e.target.nodeType === 1 && numUrls > 1 &&
                    e.target.tagName.toLowerCase() === "button" ) {
                this.removeChild( document.getElementById( e.target.previousElementSibling.getAttribute( "id" ) ).parentNode );
                document.getElementById( "cv-rd-url-add" ).disabled = false;
            }
        } );

        // Close handler
        document.getElementById( "cv-rd-close" ).addEventListener( "click", function () {
            $( "#cv-revdel" ).remove();
            $( ".cv-rd-add-range" ).remove();
        } );

        document.querySelector( "#cv-rd-urls input" ).focus();
    }

    mw.loader.using( , function () {

        pageName = mw.config.get( "wgPageName" );

        if( mw.config.get( "wgAction" ) == "history" ) {
            var link = mw.util.addPortletLink( "p-cactions", "#", "Request CV revdel", "pt-cv-revdel" );
            link.addEventListener( "click", load );
            if( mw.util.getParamValue( "open_cv_revdel" ) === "true" ) {
                load();
            }
        } else if( mw.config.get( "wgNamespaceNumber" ) >= 0 ) {
            var historyPage = mw.util.getUrl( pageName, { "action": "history", "open_cv_revdel": "true" } );
            var link = mw.util.addPortletLink( "p-cactions", historyPage, "Request CV revdel", "pt-cv-revdel" );
        }
    } );
} );
// </nowiki>
mw.loader.load('/w/index.php?title=User:BrandonXLF/ShowUserGender.js&action=raw&ctype=text/javascript'); // ]
mw.loader.load( '/w/index.php?title=User:Chlod/Scripts/Deputy.js&action=raw&ctype=text/javascript' ); // Backlink: ]
importScript( 'User:Novem Linguae/Scripts/GANReviewTool.js' ); // Backlink: ]
//Fork of ]
$.getScript(
	'//meta.wikimedia.org/w/index.php?title=User:EpochFail/ArticleQuality-system.js&action=raw&ctype=text/javascript',
	function(){
		articleQuality = new ArticleQuality({
			ores_host: "https://ores.wikimedia.org",
			weights: {
				Stub: 1, 
				Start: 2,
				C: 3,
				B: 4,
				GA: 5,
				FA: 6
			},
			names: {
				Stub: "{{class|Stub|image=yes}}", 
				Start: "{{class|Start|image=yes}}",
				C: "{{class|C|image=yes}}",
				B: "{{class|B|image=yes}}",
				GA: "{{class|GA|image=yes}}",
				FA: "{{class|FA|image=yes}}"
			},
			assessment_system: "ORES predicted quality",
			dbname: "enwiki"
		});
		// if(mw.config.get('wgAction') === "history" && (mw.config.get('wgNamespaceNumber') === 0 || mw.config.get('wgNamespaceNumber') === 118)){
		// 	articleQuality.getAndRenderHistoryScores();
		// }
		if(mw.config.get('wgAction') === "view" && (mw.config.get('wgNamespaceNumber') === 0 || mw.config.get('wgNamespaceNumber') === 118)){
			articleQuality.getAndRenderScoreHeader();
		}
		articleQuality.addScoresToArticleLinks();
	}
);
mw.loader.load("//meta.wikimedia.org/w/index.php?title=User:EpochFail/ArticleQuality.css&action=raw&ctype=text/css", 'text/css');
importScript('User:Harej/citation-watchlist.js');