Source
// If options.remove_next_sibling is true, counter counts each row making the next index twice as large (bug).
/*
** 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/>.
**/
// Global constants.
// Sync with SASS variable: $ui-transition-duration.
const UI_TRANSITION_DURATION = 300;
const PROFILE_TYPE_INT = 2;
const PROFILE_TYPE_STR = 3;
// Array indexOf method for javascript<1.6 compatibility
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement) {
if (this === void 0 || this === null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
return -1;
}
var n = 0;
if (arguments.length > 0) {
n = Number(arguments[1]);
if (n !== n) { // shortcut for verifying if it's NaN
n = 0;
}
else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
}
if (n >= len) {
return -1;
}
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;
}
}
return -1;
}
}
/*
* Page refresh
*/
var PageRefresh = {
delay: null, // refresh timeout
delayLeft: null, // left till refresh
timeout: null, // link to timeout
init: function(time) {
this.delay = time;
this.delayLeft = this.delay;
this.start();
},
check: function() {
if (is_null(this.delay)) {
return false;
}
this.delayLeft = Math.max(-1, this.delayLeft - 1000);
if (this.delayLeft < 0 && !overlays_stack.length) {
if (ED) {
sessionStorage.scrollTop = $('.wrapper').scrollTop();
}
location.reload();
}
else {
this.timeout = setTimeout('PageRefresh.check()', 1000);
}
},
start: function() {