User:Writ Keeper/Scripts/backlinkWarner.js

This article will address User:Writ Keeper/Scripts/backlinkWarner.js from different perspectives, in order to offer readers a comprehensive and detailed view on this topic. Relevant aspects will be analyzed, relevant data will be presented and various opinions from experts in the field will be offered. User:Writ Keeper/Scripts/backlinkWarner.js is a topic that arouses great interest and curiosity in today's society, so it is essential to delve into its study to understand its importance and impact in different areas. Throughout this article, different facets of User:Writ Keeper/Scripts/backlinkWarner.js will be explored, with the purpose of providing readers with a complete and enriching overview of this topic.
$(document).ready(function()
{
	if(mw.config.get("wgAction") == "delete")
	{
		var backlinkWarning = $(".mw-warning.plainlinks");
		if(backlinkWarning.length > 0)
		{
			backlinkWarning.append("<ul id='backlinkWarnings'></ul>");
			var data = {action:"query",list:"backlinks",format:"json",bltitle:mw.config.get("wgPageName"),blnamespace:"0",blfilterredir:"nonredirects",bllimit:"1"};
			$.post("/w/api.php",data, function(response)
			{
				if(response.query.backlinks.length > 0)
				{
					$("#backlinkWarnings").append("<li style='color:red;'>There are pages in mainspace that link to this article.</li>");
				}
			});
			var data = {action:"query",list:"backlinks",format:"json",bltitle:mw.config.get("wgPageName"),blfilterredir:"redirects",bllimit:"1"};
			$.post("/w/api.php",data, function(response)
			{
				if(response.query.backlinks.length > 0)
				{
					$("#backlinkWarnings").append("<li style='color:red;'>There are pages that redirect to this article.</li>");
				}
			});
			var data = {action:"query",list:"embeddedin",format:"json",eititle:mw.config.get("wgPageName"),eilimit:"2"};
			$.post("/w/api.php",data, function(response)
			{
				if(response.query.embeddedin.length > 1 || (response.query.embeddedin.length == 1 && response.query.embeddedin.title.replace(/ /g,"_") != mw.config.get("wgPageName")))
				{
					$("#backlinkWarnings").append("<li style='color:red;'>There are pages that transclude this page.</li>");					
				}
			});
		}
	}
});