Browse Source

Add sessionstorage support to nag module

pull/2929/head
chris 9 years ago
parent
commit
cf41b4f1af
1 changed files with 10 additions and 0 deletions
  1. 10
      src/definitions/modules/nag.js

10
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);

Loading…
Cancel
Save