Browse Source

Added disabled local storage workaround

master
Igor Zhukov 10 years ago
parent
commit
bd508e5937
  1. 15
      app/js/lib/config.js

15
app/js/lib/config.js

@ -125,6 +125,7 @@ Config.LangCountries = {"es": "ES", "ru": "RU", "en": "US", "de": "DE", "it": "I
callback = keys.pop(), callback = keys.pop(),
result = [], result = [],
single = keys.length == 1, single = keys.length == 1,
value,
allFound = true, allFound = true,
prefix = storageGetPrefix(), prefix = storageGetPrefix(),
i, key; i, key;
@ -135,7 +136,11 @@ Config.LangCountries = {"es": "ES", "ru": "RU", "en": "US", "de": "DE", "it": "I
result.push(cache[key]); result.push(cache[key]);
} }
else if (useLs) { else if (useLs) {
var value = localStorage.getItem(key); try {
value = localStorage.getItem(key);
} catch (e) {
useLs = false;
}
try { try {
value = (value === undefined || value === null) ? false : JSON.parse(value); value = (value === undefined || value === null) ? false : JSON.parse(value);
} catch (e) { } catch (e) {
@ -181,7 +186,11 @@ Config.LangCountries = {"es": "ES", "ru": "RU", "en": "US", "de": "DE", "it": "I
cache[key] = value; cache[key] = value;
value = JSON.stringify(value); value = JSON.stringify(value);
if (useLs) { if (useLs) {
try {
localStorage.setItem(key, value); localStorage.setItem(key, value);
} catch (e) {
useLs = false;
}
} else { } else {
keyValues[key] = value; keyValues[key] = value;
} }
@ -211,7 +220,11 @@ Config.LangCountries = {"es": "ES", "ru": "RU", "en": "US", "de": "DE", "it": "I
key = keys[i] = prefix + keys[i]; key = keys[i] = prefix + keys[i];
delete cache[key]; delete cache[key];
if (useLs) { if (useLs) {
try {
localStorage.removeItem(key); localStorage.removeItem(key);
} catch (e) {
useLs = false;
}
} }
} }
if (useCs) { if (useCs) {

Loading…
Cancel
Save