Add back theme

This commit is contained in:
Samy Pessé
2015-01-20 11:29:26 +01:00
parent bac25cdf29
commit 238cd9f7f0
87 changed files with 5115 additions and 2 deletions
+31
View File
@@ -0,0 +1,31 @@
define(function(){
var baseKey = "";
/*
* Simple module for storing data in the browser's local storage
*/
return {
setBaseKey: function(key) {
baseKey = key;
},
set: function(key, value) {
key = baseKey+":"+key;
localStorage[key] = JSON.stringify(value);
},
get: function(key, def) {
key = baseKey+":"+key;
if (localStorage[key] === undefined) return def;
try {
var v = JSON.parse(localStorage[key]);
return v == null ? def : v;;
} catch(err) {
console.error(err);
return localStorage[key] || def;
}
},
remove: function(key) {
key = baseKey+":"+key;
localStorage.removeItem(key);
}
};
});