summaryrefslogtreecommitdiff
path: root/skins/larry
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-07-23 18:24:49 +0200
committerAleksander Machniak <alec@alec.pl>2014-07-23 18:26:59 +0200
commit835638037a6e11cfdf4fd84c4b362465937a5bba (patch)
treeb7788e299550c596cacda457e1b2cdd6e207347e /skins/larry
parentb78ecabaa1c50953cefdb6458b4532c131193bcc (diff)
Fix errors when using localStorage in Safari's private browsing mode (#1489996)
Conflicts: program/js/app.js
Diffstat (limited to 'skins/larry')
-rw-r--r--skins/larry/ui.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index f25c4fc1c..1c1df08be 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -76,7 +76,7 @@ function rcube_mail_ui()
function get_pref(key)
{
if (!prefs) {
- prefs = window.localStorage ? rcmail.local_storage_get_item('prefs.larry', {}) : {};
+ prefs = rcmail.local_storage_get_item('prefs.larry', {});
}
// fall-back to cookies
@@ -85,9 +85,8 @@ function rcube_mail_ui()
if (cookie != null) {
prefs[key] = cookie;
- // copy value to local storage and remove cookie
- if (window.localStorage) {
- rcmail.local_storage_set_item('prefs.larry', prefs);
+ // copy value to local storage and remove cookie (if localStorage is supported)
+ if (rcmail.local_storage_set_item('prefs.larry', prefs)) {
rcmail.set_cookie(key, cookie, new Date()); // expire cookie
}
}
@@ -103,11 +102,8 @@ function rcube_mail_ui()
{
prefs[key] = val;
- // write prefs to local storage
- if (window.localStorage) {
- rcmail.local_storage_set_item('prefs.larry', prefs);
- }
- else {
+ // write prefs to local storage (if supported)
+ if (!rcmail.local_storage_set_item('prefs.larry', prefs)) {
// store value in cookie
var exp = new Date();
exp.setYear(exp.getFullYear() + 1);