Source
updateCharCount(('maxlength' in obj.options) ? obj.options.maxlength - value.length : value.length);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
(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:
$content.height($content.css('max-height'));
}
while (diff > 0) {
li += '<li></li>';