Remove useless params of Functions.selectContent

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2022-06-18 19:13:35 -03:00
parent 41c48b423e
commit 4071f52223
2 changed files with 10 additions and 14 deletions

View File

@ -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;
}

View File

@ -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 $()