diff options
Diffstat (limited to 'skins')
-rw-r--r-- | skins/larry/templates/mail.html | 4 | ||||
-rw-r--r-- | skins/larry/ui.js | 36 |
2 files changed, 34 insertions, 6 deletions
diff --git a/skins/larry/templates/mail.html b/skins/larry/templates/mail.html index 2e7c0c105..8f19b9f7f 100644 --- a/skins/larry/templates/mail.html +++ b/skins/larry/templates/mail.html @@ -5,8 +5,8 @@ <roundcube:include file="/includes/links.html" /> <style type="text/css"> <roundcube:if condition="config:preview_pane == true" /> - #mailview-top { height: <roundcube:exp expression="!empty(cookie:mailviewsplitter) ? cookie:mailviewsplitter-48 : 276" />px; } - #mailview-bottom { top: <roundcube:exp expression="!empty(cookie:mailviewsplitter) ? cookie:mailviewsplitter+6 : 330" />px; height: auto; display: block; } + #mailview-top { height: 276px; } + #mailview-bottom { top: 330px; height: auto; display: block; } #mailpreviewframe { display: block; } <roundcube:endif /> </style> diff --git a/skins/larry/ui.js b/skins/larry/ui.js index ae8ae5c55..a3c64b437 100644 --- a/skins/larry/ui.js +++ b/skins/larry/ui.js @@ -31,6 +31,7 @@ function rcube_mail_ui() var me = this; var mailviewsplit; var compose_headers = {}; + var prefs; // export public methods this.set = setenv; @@ -74,7 +75,25 @@ function rcube_mail_ui() */ function get_pref(key) { - return rcmail.get_cookie(key); + if (!prefs) { + prefs = window.localStorage ? rcmail.local_storage_get_item('prefs.larry', {}) : {}; + } + + // fall-back to cookies + if (prefs[key] == null) { + var cookie = rcmail.get_cookie(key); + 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); + rcmail.set_cookie(key, cookie, new Date()); // expire cookie + } + } + } + + return prefs[key]; } /** @@ -82,9 +101,18 @@ function rcube_mail_ui() */ function save_pref(key, val) { - var exp = new Date(); - exp.setYear(exp.getFullYear() + 1); - rcmail.set_cookie(key, val, exp); + prefs[key] = val; + + // write prefs to local storage + if (window.localStorage) { + rcmail.local_storage_set_item('prefs.larry', prefs); + } + else { + // store value in cookie + var exp = new Date(); + exp.setYear(exp.getFullYear() + 1); + rcmail.set_cookie(key, val, exp); + } } /** |