diff --git a/media/js/impala/stats/manager.js b/media/js/impala/stats/manager.js index a0579d2b7a..f01419b814 100644 --- a/media/js/impala/stats/manager.js +++ b/media/js/impala/stats/manager.js @@ -11,11 +11,11 @@ z.StatsManager = (function() { // The version of the stats localStorage we are using. // If you increment this number, you cache-bust everyone! - var STATS_VERSION = '2011-10-21-1'; + var STATS_VERSION = '2011-12-12'; var PRECISION = 2; var storage = z.Storage("stats"), - storageCache = z.Storage("statscache"), + storageCache = z.SessionStorage("statscache"), dataStore = {}, currentView = {}, addonId = parseInt($(".primary").attr("data-addon_id"), 10), diff --git a/media/js/zamboni/storage.js b/media/js/zamboni/storage.js index 58ab065fdb..e9670375d2 100644 --- a/media/js/zamboni/storage.js +++ b/media/js/zamboni/storage.js @@ -44,3 +44,32 @@ z.Storage = (function() { }; }; })(); + +z.SessionStorage = (function() { + var cookieStorage = { + getItem: function(key) { + return $.cookie(key); + }, + setItem: function(key, value) { + return $.cookie(key, value, {path: '/'}); + }, + removeItem: function(key) { + return $.cookie(key, null); + } + }; + var engine = z.capabilities.localStorage ? sessionStorage : cookieStorage; + return function(namespace) { + namespace = namespace ? namespace + '-' : ''; + return { + get: function(key) { + return engine.getItem(namespace + key); + }, + set: function(key, value) { + return engine.setItem(namespace + key, value); + }, + remove: function(key) { + return engine.removeItem(namespace + key); + } + }; + }; +})();