Module: deluge Branch: extjs4-port Commit: a56848acc5536e80079e8f20fd73b33ee637a882
Author: Damien Churchill <[email protected]> Date: Tue Oct 4 22:16:42 2011 +0100 web: support using localStorage for state This adds support for checking to see if the browser supports the HTML5 localStorage, if so use that instead of cookies for storing the UI state. --- deluge/ui/web/js/deluge-all/Deluge.js | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/deluge/ui/web/js/deluge-all/Deluge.js b/deluge/ui/web/js/deluge-all/Deluge.js index f2d258b..1a0b255 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.js +++ b/deluge/ui/web/js/deluge-all/Deluge.js @@ -31,7 +31,14 @@ */ // Setup the state manager -Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); +var provider = Ext.state.CookieProvider; +try { + if ('localStorage' in window && window['localStorage'] !== null) { + provider = Ext.state.LocalStorageProvider; + } +} catch (e) { +} +Ext.state.Manager.setProvider(new provider()); // Add some additional functions to ext and setup some of the // configurable parameters -- You received this message because you are subscribed to the Google Groups "deluge-commit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/deluge-commit?hl=en.
