Source
xxxxxxxxxx
if (typeof confirmation === 'undefined' || (typeof confirmation !== 'undefined' && confirm(confirmation))) {
/*
** 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/>.
**/
/**
* An object that is used to namespace objects, allows to retrieve and write objects via arbitrary path.
*/
window.ZABBIX = Object.create({
/**
* @param {string} path Dot separated path. Each segment is used as object key.
* @param {mixed} value Optional value to be written into path only if path held undefined before.
*
* @return {mixed} Value underlying the path is returned.
*/
namespace: function(path, value) {
return path.split('.').reduce(function(obj, pt, idx, src) {
var last = (idx + 1 == src.length);
if (typeof obj[pt] === 'undefined') {
obj[pt] = last ? value : {};
}
return obj[pt];
}, this);
},
/**
* Logs user out, also, handles side effects before that.
*/
logout: function(csrf_token) {
let ls = this.namespace('instances.localStorage');
ls && ls.destruct();
redirect(`index.php?reconnect=1&${CSRF_TOKEN_NAME}=${csrf_token}`, 'post', CSRF_TOKEN_NAME, true);
}
});
document.addEventListener('click', e => {
const element = e.target;
if (element.matches('input[type="radio"][readonly], input[type="checkbox"][readonly]')) {
e.preventDefault();
}
});
jQuery(function($) {
$.propHooks.disabled = {
set: function (el, val) {
if (el.disabled !== val) {