Browse Source

plugins: run eslint const/let fixes

Andrew Dolgov 1 year ago
parent
commit
dbb4cdbe36

+ 1 - 1
plugins/af_psql_trgm/init.js

@@ -1,7 +1,7 @@
 function showTrgmRelated(id) {
 	try {
 
-		var query = "backend.php?op=pluginhandler&plugin=af_psql_trgm&method=showrelated&param=" + param_escape(id);
+		const query = "backend.php?op=pluginhandler&plugin=af_psql_trgm&method=showrelated&param=" + param_escape(id);
 
 		if (dijit.byId("trgmRelatedDlg"))
 			dijit.byId("trgmRelatedDlg").destroyRecursive();

+ 3 - 3
plugins/af_zz_noautoplay/init.js

@@ -5,7 +5,7 @@ require(['dojo/_base/kernel', 'dojo/ready'], function  (dojo, ready) {
 				console.log("af_zz_noautoplay!");
 				console.log(row);
 
-				var videos = row.getElementsByTagName("video");
+				const videos = row.getElementsByTagName("video");
 				console.log(row.innerHTML);
 
 				for (i = 0; i < videos.length; i++) {
@@ -23,7 +23,7 @@ require(['dojo/_base/kernel', 'dojo/ready'], function  (dojo, ready) {
 
 		PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function (row) {
 			if (row) {
-				var videos = row.getElementsByTagName("video");
+				const videos = row.getElementsByTagName("video");
 
 				for (i = 0; i < videos.length; i++) {
 					videos[i].removeAttribute("autoplay");
@@ -38,4 +38,4 @@ require(['dojo/_base/kernel', 'dojo/ready'], function  (dojo, ready) {
 			return true;
 		});
 	});
-});
+});

+ 6 - 6
plugins/embed_original/init.js

@@ -1,16 +1,16 @@
 function embedOriginalArticle(id) {
 	try {
-		var hasSandbox = "sandbox" in document.createElement("iframe");
+		const hasSandbox = "sandbox" in document.createElement("iframe");
 
 		if (!hasSandbox) {
 			alert(__("Sorry, your browser does not support sandboxed iframes."));
 			return;
 		}
 
-		var query = "op=pluginhandler&plugin=embed_original&method=getUrl&id=" +
+		const query = "op=pluginhandler&plugin=embed_original&method=getUrl&id=" +
 			param_escape(id);
 
-		var c = false;
+		let c = false;
 
 		if (isCdmMode()) {
 			c = $$("div#RROW-" + id + " div[class=cdmContentInner]")[0];
@@ -19,7 +19,7 @@ function embedOriginalArticle(id) {
 		}
 
 		if (c) {
-			var iframe = c.parentNode.getElementsByClassName("embeddedContent")[0];
+			const iframe = c.parentNode.getElementsByClassName("embeddedContent")[0];
 
 			if (iframe) {
 				Element.show(c);
@@ -36,11 +36,11 @@ function embedOriginalArticle(id) {
 		new Ajax.Request("backend.php",	{
 			parameters: query,
 			onComplete: function(transport) {
-				var ti = JSON.parse(transport.responseText);
+				const ti = JSON.parse(transport.responseText);
 
 				if (ti) {
 
-					var iframe = new Element("iframe", {
+					const iframe = new Element("iframe", {
 						class: "embeddedContent",
 						src: ti.url,
 						width: (c.parentNode.offsetWidth-5)+'px',

+ 2 - 2
plugins/mailto/init.js

@@ -1,7 +1,7 @@
 function mailtoArticle(id) {
 	try {
 		if (!id) {
-			var ids = getSelectedArticleIds2();
+			const ids = getSelectedArticleIds2();
 
 			if (ids.length == 0) {
 				alert(__("No articles are selected."));
@@ -14,7 +14,7 @@ function mailtoArticle(id) {
 		if (dijit.byId("emailArticleDlg"))
 			dijit.byId("emailArticleDlg").destroyRecursive();
 
-		var query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle&param=" + param_escape(id);
+		const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle&param=" + param_escape(id);
 
 		dialog = new dijit.Dialog({
 			id: "emailArticleDlg",

+ 5 - 5
plugins/shorten_expanded/init.js

@@ -2,13 +2,13 @@ var _shorten_expanded_threshold = 1.5; //window heights
 
 function expandSizeWrapper(id) {
 	try {
-		var row = $(id);
+		const row = $(id);
 
 		console.log(row);
 
 		if (row) {
-			var content = row.select(".contentSizeWrapper")[0];
-			var link = row.select(".expandPrompt")[0];
+			const content = row.select(".contentSizeWrapper")[0];
+			const link = row.select(".expandPrompt")[0];
 
 			if (content) content.removeClassName("contentSizeWrapper");
 			if (link) Element.hide(link);
@@ -30,8 +30,8 @@ require(['dojo/_base/kernel', 'dojo/ready'], function  (dojo, ready) {
 
 				window.setTimeout(function() {
 					if (row) {
-						var c_inner = row.select(".cdmContentInner")[0];
-						var c_inter = row.select(".cdmIntermediate")[0];
+						const c_inner = row.select(".cdmContentInner")[0];
+						const c_inter = row.select(".cdmIntermediate")[0];
 
 						if (c_inner && c_inter &&
 							row.offsetHeight >= _shorten_expanded_threshold * window.innerHeight) {