From 4071f52223c146a97758ad6723d1f1353df5eade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sat, 18 Jun 2022 19:13:35 -0300 Subject: [PATCH] Remove useless params of Functions.selectContent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- js/src/functions.js | 19 ++++++++----------- js/src/sql.js | 5 ++--- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/js/src/functions.js b/js/src/functions.js index 12331589a8..e66a6a9428 100644 --- a/js/src/functions.js +++ b/js/src/functions.js @@ -15,15 +15,14 @@ var Functions = {}; /** - * @var sqlBoxLocked lock for the sqlbox textarea in the querybox + * @type {boolean} lock for the sqlbox textarea in the querybox */ -// eslint-disable-next-line no-unused-vars -var sqlBoxLocked = false; +let sqlBoxLocked = false; /** - * @var {array}, holds elements which content should only selected once + * @type {boolean[]} holds elements which content should only selected once */ -var onlyOnceElements = []; +const onlyOnceElements = []; /** * @var {number} ajaxMessageCount Number of AJAX messages shown since page load @@ -632,18 +631,16 @@ Functions.displayPasswordGenerateButton = function () { /** * selects the content of a given object, f.e. a textarea * - * @param {object} element element of which the content will be selected - * @param {any | true} lock variable which holds the lock for this element or true, if no lock exists - * @param {boolean} onlyOnce boolean if true this is only done once f.e. only on first focus + * @param {HTMLTextAreaElement} element Element of which the content will be selected */ -Functions.selectContent = function (element, lock, onlyOnce) { - if (onlyOnce && onlyOnceElements[element.name]) { +Functions.selectContent = function (element) { + if (onlyOnceElements[element.name]) { return; } onlyOnceElements[element.name] = true; - if (lock) { + if (sqlBoxLocked) { return; } diff --git a/js/src/sql.js b/js/src/sql.js index 7b109f07cd..cf99236455 100644 --- a/js/src/sql.js +++ b/js/src/sql.js @@ -10,7 +10,6 @@ /* global isStorageSupported */ // js/config.js /* global codeMirrorEditor */ // js/functions.js /* global makeGrid */ // js/makegrid.js -/* global sqlBoxLocked */ // js/functions.js var Sql = {}; @@ -844,12 +843,12 @@ AJAX.registerOnload('sql.js', function () { }); $('#view_as').on('click', function () { - Functions.selectContent(this, sqlBoxLocked, true); + Functions.selectContent(this); }); $('#sqlquery').on('click', function () { if ($(this).data('textarea-auto-select') === true) { - Functions.selectContent(this, sqlBoxLocked, true); + Functions.selectContent(this); } }); }); // end $()