From cf41b4f1afcd27620eb2fd282b72e36e02aade90 Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 31 Aug 2015 15:55:54 +1200 Subject: [PATCH] Add sessionstorage support to nag module --- src/definitions/modules/nag.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/definitions/modules/nag.js b/src/definitions/modules/nag.js index 061953fc0..6dc4cd627 100644 --- a/src/definitions/modules/nag.js +++ b/src/definitions/modules/nag.js @@ -194,6 +194,10 @@ $.fn.nag = function(parameters) { window.localStorage.setItem(key, value); module.debug('Value stored using local storage', key, value); } + else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) { + window.sessionStorage.setItem(key, value); + module.debug('Value stored using session storage', key, value); + } else if($.cookie !== undefined) { $.cookie(key, value, options); module.debug('Value stored using cookie', key, value, options); @@ -210,6 +214,9 @@ $.fn.nag = function(parameters) { if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) { storedValue = window.localStorage.getItem(key); } + else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) { + storedValue = window.sessionStorage.getItem(key); + } // get by cookie else if($.cookie !== undefined) { storedValue = $.cookie(key); @@ -229,6 +236,9 @@ $.fn.nag = function(parameters) { if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) { window.localStorage.removeItem(key); } + else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) { + window.sessionStorage.removeItem(key); + } // store by cookie else if($.cookie !== undefined) { $.removeCookie(key, options);