diff --git a/jstorage.min.js b/jstorage.min.js index 355136f..d0bc992 100644 --- a/jstorage.min.js +++ b/jstorage.min.js @@ -1 +1 @@ -(function(e){if(!e||!(e.toJSON||Object.toJSON||window.JSON)){throw new Error("jQuery, MooTools or Prototype needs to be loaded before jStorage!")}var f={},b={jStorage:"{}"},g=null,i=e.toJSON||Object.toJSON||(window.JSON&&(JSON.encode||JSON.stringify)),d=e.evalJSON||(window.JSON&&(JSON.decode||JSON.parse))||function(j){return String(j).evalJSON()};function h(){if(window.localStorage){try{b=window.localStorage}catch(k){}}else{if(window.globalStorage){try{b=window.globalStorage[window.location.hostname]}catch(j){}}else{g=document.createElement("link");if(g.addBehavior){g.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(g);g.load("jStorage");var l="{}";try{l=g.getAttribute("jStorage")}catch(n){}b.jStorage=l}else{g=null;return}}}if(b.jStorage){try{f=d(b.jStorage)}catch(m){b.jStorage="{}"}}else{b.jStorage="{}"}}function c(){try{b.jStorage=i(f);if(g){g.setAttribute("jStorage",b.jStorage);g.save("jStorage")}}catch(j){}}function a(j){if(!j||(typeof j!="string"&&typeof j!="number")){throw new TypeError("Key name must be string or numeric")}return true}e.jStorage={version:"0.1.3",set:function(j,k){a(j);f[j]=k;c();return k},get:function(j,k){a(j);if(j in f){return f[j]}return typeof(k)=="undefined"?null:k},deleteKey:function(j){a(j);if(j in f){delete f[j];c();return true}return false},flush:function(){f={};c();if(window.localStorage){try{localStorage.clear()}catch(j){}}return true},storageObj:function(){function j(){}j.prototype=f;return new j()}};h()})(window.jQuery||window.$); \ No newline at end of file +(function(e){if(!e||!(e.toJSON||Object.toJSON||window.JSON)){throw new Error("jQuery, MooTools or Prototype needs to be loaded before jStorage!")}var f={},b={jStorage:"{}"},g=null,i=e.toJSON||Object.toJSON||(window.JSON&&(JSON.encode||JSON.stringify)),d=e.evalJSON||(window.JSON&&(JSON.decode||JSON.parse))||function(j){return String(j).evalJSON()};function h(){if(window.localStorage){try{b=window.localStorage}catch(k){}}else{if(window.globalStorage){try{b=window.globalStorage[window.location.hostname]}catch(j){}}else{g=document.createElement("link");if(g.addBehavior){g.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(g);g.load("jStorage");var l="{}";try{l=g.getAttribute("jStorage")}catch(n){}b.jStorage=l}else{g=null;return}}}if(b.jStorage){try{f=d(String(b.jStorage))}catch(m){b.jStorage="{}"}}else{b.jStorage="{}"}}function c(){try{b.jStorage=i(f);if(g){g.setAttribute("jStorage",b.jStorage);g.save("jStorage")}}catch(j){}}function a(j){if(!j||(typeof j!="string"&&typeof j!="number")){throw new TypeError("Key name must be string or numeric")}return true}e.jStorage={version:"0.1.3",set:function(j,k){a(j);f[j]=k;c();return k},get:function(j,k){a(j);if(j in f){return f[j]}return typeof(k)=="undefined"?null:k},deleteKey:function(j){a(j);if(j in f){delete f[j];c();return true}return false},flush:function(){f={};c();if(window.localStorage){try{localStorage.clear()}catch(j){}}return true},storageObj:function(){function j(){}j.prototype=f;return new j()}};h()})(window.jQuery||window.$); \ No newline at end of file