Source
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
/*
** Zabbix
** Copyright (C) 2001-2023 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.
**/
var cookie = {
cookies: [],
// Encoding values separated by a comma (%2C), makes the cookie very large in size. A dot, however, remains a dot.
delimiter: '.',
init: function() {
var allCookies = document.cookie.split('; ');
for (var i = 0; i < allCookies.length; i++) {
var cookiePair = allCookies[i].split('=');
this.cookies[decodeURIComponent(cookiePair[0])] = decodeURIComponent(cookiePair[1]);
}
},
create: function(name, value, days) {
var expires = '';
if (typeof(days) !== 'undefined') {
var date = new Date();
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
expires = '; expires=' + date.toGMTString();
}
document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value) + expires +
(location.protocol === 'https:' ? '; secure' : '');
// Apache header size limit.
if (document.cookie.length > 8000) {
document.cookie = encodeURIComponent(name) + '=;';
alert(t('S_MAX_COOKIE_SIZE_REACHED'));
return false;
}
else {
this.cookies[name] = value;
}
return true;
},
createArray: function(name, value, days) {
var part_string = '',
part_length = 0,
part = 0,