Source
updateCharCount(('maxlength' in obj.options) ? obj.options.maxlength - value.length : value.length);
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
(function($) {
'use strict';
function updateProperties(obj, $elm) {
obj.$hidden.prop('disabled', obj.options.disabled ? true : null);
obj.$input
.prop('disabled', obj.options.disabled ? true : null)
.prop('readonly', obj.options.disabled ? null : true)
.prop('title', obj.options.disabled ? '' : obj.options.hint);
obj.$button
.prop('disabled', obj.options.disabled ? true : null)
.prop('title', obj.options.disabled ? '' : obj.options.hint);
$elm
.toggleClass('multilineinput-readonly', (obj.options.readonly && !obj.options.disabled))
.toggleClass('multilineinput-disabled', obj.options.disabled);
}
function setDisabled(e) {
if ($(this)[0] !== e.target) {
return;
}
var obj = e.data,
$elm = $(this);
obj.options.disabled = (e.type === 'disable');
updateProperties(obj, $elm);
}
function setReadOnly(e) {
if ($(this)[0] !== e.target) {
return;
}
var obj = e.data,
$elm = $(this);
obj.options.readonly = (e.type === 'readonly');
updateProperties(obj, $elm);
}
function openModal(e) {
e.preventDefault();
var obj = e.data;
if (obj.options.disabled) {
return;
}
function updateCharCount(count) {
$('span', $footer).text(count);
}
function updateLineNumbers(lines_count) {
var min_rows = 3,
line_height = 18,
diff = lines_count - $line_numbers[0].childElementCount,
li = '';
switch (obj.options.grow) {
case 'fixed':
$content.height(obj.options.rows * line_height + 2);
break;
case 'auto':
var rows = Math.max(min_rows, lines_count);
rows = obj.options.rows == 0 ? rows : Math.min(rows, obj.options.rows)
$content.height(rows * line_height + 2);
break;
default: