Source
if (typeof confirmation === 'undefined' || (typeof confirmation !== 'undefined' && confirm(confirmation))) {
/*
** 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.
**/
/**
* 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() {
var ls = this.namespace('instances.localStorage');
ls && ls.destruct();
redirect('index.php?reconnect=1', 'post', 'sid', true);
}
});
jQuery(function($) {
$.propHooks.disabled = {
set: function (el, val) {
if (el.disabled !== val) {
el.disabled = val;
$(el).trigger(val ? 'disable' : 'enable');
}