CARVIEW |
Select Language
HTTP/2 301
location: https://raw.githubusercontent.com/nbubna/store/master/src/store.old.js
accept-ranges: bytes
age: 0
date: Thu, 24 Jul 2025 10:12:14 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210083-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753351934.813780,VS0,VE296
vary: Accept-Encoding
x-fastly-request-id: 80714c0be16af3af2cc839cbd9bf20fbe4ead030
content-length: 0
HTTP/2 200
cache-control: max-age=300
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
content-type: text/plain; charset=utf-8
etag: W/"0c04a517d2e00881f99077c2f2e25d9d513205eea5a806fc8b0e8c8c945071b4"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: FFB5:276E8D:21133:3D443:688206F9
content-encoding: gzip
accept-ranges: bytes
date: Thu, 24 Jul 2025 10:12:14 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210020-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753351934.178710,VS0,VE281
vary: Authorization,Accept-Encoding
access-control-allow-origin: *
cross-origin-resource-policy: cross-origin
x-fastly-request-id: a0e407bc96d333479aa6da0ace7ec8500d3f06d0
expires: Thu, 24 Jul 2025 10:17:14 GMT
source-age: 0
content-length: 1571
/**
* Copyright (c) 2013 ESHA Research
* Dual licensed under the MIT and GPL licenses:
* https://www.opensource.org/licenses/mit-license.php
* https://www.gnu.org/licenses/gpl.html
*
* If fake (non-persistent) storage for users stuck in the dark ages
* does not satisfy you, this will replace it with the a reasonable imitator for their
* pathetic, incompetent browser. Note that the session replacement here is potentially
* insecure as it uses window.name without any fancy protections.
*
* Status: BETA - unsupported, useful, needs testing & refining
*/
;(function(window, document, store, _) {
function addUpdateFn(area, name, update) {
var old = area[name];
area[name] = function() {
var ret = old.apply(this, arguments);
update.apply(this, arguments);
return ret;
};
}
function create(name, items, update) {
var length = 0;
for (var k in items) {
if (items.hasOwnProperty(k)) {
length++;
}
}
var area = _.inherit(_.storageAPI, { items:items, length:length, name:name });
if (update) {
addUpdateFn(area, 'setItem', update);
addUpdateFn(area, 'removeItem', update);
}
return area;
}
if (store.isFake()) {
var area;
if (document.documentElement.addBehavior) {// IE userData
var el = document.createElement('div'),
sn = 'localStorage',
body = document.body,
wrap = function wrap(fn) {
return function() {
body.appendChild(el);
el.addBehavior('#default#userData');
el.load(sn);
var ret = fn.apply(store._area, arguments);
el.save(sn);
body.removeChild(el);
return ret;
};
},
has = function has(key){
return el.getAttribute(key) !== null;
},
UserDataStorage = function UserDataStorage(){};
UserDataStorage.prototype = {
length: (wrap(function(){
return el.XMLDocument.documentElement.attributes.length;
}))(),
has: wrap(has),
key: wrap(function(i) {
return el.XMLDocument.documentElement.attributes[i];
}),
setItem: wrap(function(k, v) {
if (!has(k)) {
this.length++;
}
el.setAttribute(k, v);
}),
removeItem: wrap(function(k) {
if (has(k)) {
el.removeAttribute(k);
this.length--;
}
}),
getItem: wrap(function(k){ return el.getAttribute(k); }),
clear: wrap(function() {
var all = el.XMLDocument.documentElement.attributes;
for (var i=0, a; !!(a = all[i]); i++) {
el.removeAttribute(a.name);
}
this.length = 0;
})
};
area = new UserDataStorage();
} else if ('globalStorage' in window && window.globalStorage) {// FF globalStorage
area = create('global', window.globalStorage[window.location.hostname]);
} else {// cookie
var date = new Date(),
key = 'store.local',
items = {},
cookies = document.cookie.split(';');
date.setTime(date.getTime()+(5*365*24*60*60*1000));//5 years out
date = date.toGMTString();
for (var i=0,m=cookies.length; i