From dbb4cdbe3674f692f5f593cc46e26b73df078acc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 30 Nov 2018 08:39:45 +0300 Subject: [PATCH] plugins: run eslint const/let fixes --- plugins/af_psql_trgm/init.js | 2 +- plugins/af_zz_noautoplay/init.js | 6 +++--- plugins/embed_original/init.js | 12 ++++++------ plugins/mailto/init.js | 4 ++-- plugins/shorten_expanded/init.js | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/plugins/af_psql_trgm/init.js b/plugins/af_psql_trgm/init.js index 621ccb746..f84bb4877 100644 --- a/plugins/af_psql_trgm/init.js +++ b/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¶m=" + param_escape(id); + const query = "backend.php?op=pluginhandler&plugin=af_psql_trgm&method=showrelated¶m=" + param_escape(id); if (dijit.byId("trgmRelatedDlg")) dijit.byId("trgmRelatedDlg").destroyRecursive(); diff --git a/plugins/af_zz_noautoplay/init.js b/plugins/af_zz_noautoplay/init.js index 45dfc55ab..28e7ec787 100644 --- a/plugins/af_zz_noautoplay/init.js +++ b/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; }); }); -}); \ No newline at end of file +}); diff --git a/plugins/embed_original/init.js b/plugins/embed_original/init.js index 17090653d..865491142 100644 --- a/plugins/embed_original/init.js +++ b/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', diff --git a/plugins/mailto/init.js b/plugins/mailto/init.js index 8f7656a07..272b8cea7 100644 --- a/plugins/mailto/init.js +++ b/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¶m=" + param_escape(id); + const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + param_escape(id); dialog = new dijit.Dialog({ id: "emailArticleDlg", diff --git a/plugins/shorten_expanded/init.js b/plugins/shorten_expanded/init.js index 24d72b0a1..d75644286 100644 --- a/plugins/shorten_expanded/init.js +++ b/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) {