3 lines
42 KiB
JavaScript
3 lines
42 KiB
JavaScript
|
|
/* store.js - Copyright (c) 2010-2017 Marcus Westin */
|
|||
|
|
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.store=t()}}(function(){var define,module,exports;return function t(e,n,r){function o(i,u){if(!n[i]){if(!e[i]){var a="function"==typeof require&&require;if(!u&&a)return a(i,!0);if(s)return s(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[i]={exports:{}};e[i][0].call(f.exports,function(t){var n=e[i][1][t];return o(n?n:t)},f,f.exports,t,e,n,r)}return n[i].exports}for(var s="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(t,e,n){"use strict";var r=t("../src/store-engine"),o=t("../storages/all"),s=[t("../plugins/json2")];e.exports=r.createStore(o,s)},{"../plugins/json2":17,"../src/store-engine":29,"../storages/all":31}],2:[function(t,e,n){"use strict";var r=t("../tests/tests");r.runTests()},{"../tests/tests":43}],3:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(l===setTimeout)return setTimeout(t,0);if((l===r||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function i(t){if(p===clearTimeout)return clearTimeout(t);if((p===o||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}function u(){v&&h&&(v=!1,h.length?g=h.concat(g):m=-1,g.length&&a())}function a(){if(!v){var t=s(u);v=!0;for(var e=g.length;e;){for(h=g,g=[];++m<e;)h&&h[m].run();m=-1,e=g.length}h=null,v=!1,i(t)}}function c(t,e){this.fun=t,this.array=e}function f(){}var l,p,d=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:r}catch(t){l=r}try{p="function"==typeof clearTimeout?clearTimeout:o}catch(t){p=o}}();var h,g=[],v=!1,m=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];g.push(new c(t,e)),1!==g.length||v||s(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=f,d.addListener=f,d.once=f,d.off=f,d.removeListener=f,d.removeAllListeners=f,d.emit=f,d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},{}],4:[function(t,e,n){(function(t){function n(t){return function(e){var n=e.replace(/</g,"<").replace(/>/g,">");return'<span style="color:'+t+'">'+n+"</span>"}}function r(t){var e=o[t];return function(t){return e[0]+t+e[1]}}var o=e.exports={grey:["[90m","[39m"],green:["[32m","[39m"],yellow:["[33m","[39m"],red:["[31m","[39m"]},s="undefined"!=typeof t.window;for(var i in o)o.hasOwnProperty(i)&&(o[i]=s?n(i):r(i))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(t,e,n){(function(n){function r(t){o(m,t),x.t0=new Date,x._runNextTest()}function o(t,e,n,r){t||(t={});for(var o=1;o<arguments.length;o++){var s=arguments[o];for(var i in s)s.hasOwnProperty(i)&&(t[i]=s[i])}return t}function s(){return x.skipGroupStack[x.skipGroupStack.length-1]}function i(t,e){s()?x.tests.push({name:x.currentGroup+" - "+t,shouldSkip:!0}):x.tests.push({name:x.currentGroup+" - "+t,fn:e})}function u(t,e,n,r){if(!t){var o=Array.prototype.slice.call(arguments,1).join(" "),s="assert failed"+(o?": "+o:"");throw a(h.red(s)),new Error(s)}}function a(){if(w){m.outputEl||(m.outputEl=document.createElement("div"),o(m.outputEl.style,{fontFamily:"monaco,sans-serif",fontSize:"12px",padding:"10px",background:"black",color:"white"}),document.body.appendChild(m.outputEl));for(var t=Array.prototype.slice.call(arguments,0),e=0;e<t.length;e++)void 0
|
|||
|
|
return e.apply(t,Array.prototype.slice.call(arguments,0))}}function i(t,e){return Array.prototype.slice.call(t,e||0)}function u(t,e){c(t,function(t,n){return e(t,n),!1})}function a(t,e){var n=f(t)?[]:{};return c(t,function(t,r){return n[r]=e(t,r),!1}),n}function c(t,e){if(f(t)){for(var n=0;n<t.length;n++)if(e(t[n],n))return t[n]}else for(var r in t)if(t.hasOwnProperty(r)&&e(t[r],r))return t[r]}function f(t){return null!=t&&"function"!=typeof t&&"number"==typeof t.length}function l(t){return t&&"[object Function]"==={}.toString.call(t)}function p(t){return t&&"[object Object]"==={}.toString.call(t)}var d=n(),h=r(),g=o(),v="undefined"!=typeof window?window:t;e.exports={assign:d,create:h,trim:g,bind:s,slice:i,each:u,map:a,pluck:c,isList:f,isFunction:l,isObject:p,Global:v}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],31:[function(t,e,n){"use strict";e.exports=[t("./localStorage"),t("./oldFF-globalStorage"),t("./oldIE-userDataStorage"),t("./cookieStorage"),t("./sessionStorage"),t("./memoryStorage")]},{"./cookieStorage":32,"./localStorage":33,"./memoryStorage":34,"./oldFF-globalStorage":35,"./oldIE-userDataStorage":36,"./sessionStorage":37}],32:[function(t,e,n){"use strict";function r(t){if(!t||!a(t))return null;var e="(?:^|.*;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(p.cookie.replace(new RegExp(e),"$1"))}function o(t){for(var e=p.cookie.split(/; ?/g),n=e.length-1;n>=0;n--)if(l(e[n])){var r=e[n].split("="),o=unescape(r[0]),s=unescape(r[1]);t(s,o)}}function s(t,e){t&&(p.cookie=escape(t)+"="+escape(e)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function i(t){t&&a(t)&&(p.cookie=escape(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function u(){o(function(t,e){i(e)})}function a(t){return new RegExp("(?:^|;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(p.cookie)}var c=t("../src/util"),f=c.Global,l=c.trim;e.exports={name:"cookieStorage",read:r,write:s,each:o,remove:i,clearAll:u};var p=f.document},{"../src/util":30}],33:[function(t,e,n){"use strict";function r(){return f.localStorage}function o(t){return r().getItem(t)}function s(t,e){return r().setItem(t,e)}function i(t){for(var e=r().length-1;e>=0;e--){var n=r().key(e);t(o(n),n)}}function u(t){return r().removeItem(t)}function a(){return r().clear()}var c=t("../src/util"),f=c.Global;e.exports={name:"localStorage",read:o,write:s,each:i,remove:u,clearAll:a}},{"../src/util":30}],34:[function(t,e,n){"use strict";function r(t){return a[t]}function o(t,e){a[t]=e}function s(t){for(var e in a)a.hasOwnProperty(e)&&t(a[e],e)}function i(t){delete a[t]}function u(t){a={}}e.exports={name:"memoryStorage",read:r,write:o,each:s,remove:i,clearAll:u};var a={}},{}],35:[function(t,e,n){"use strict";function r(t){return f[t]}function o(t,e){f[t]=e}function s(t){for(var e=f.length-1;e>=0;e--){var n=f.key(e);t(f[n],n)}}function i(t){return f.removeItem(t)}function u(){s(function(t,e){delete f[t]})}var a=t("../src/util"),c=a.Global;e.exports={name:"oldFF-globalStorage",read:r,write:o,each:s,remove:i,clearAll:u};var f=c.globalStorage},{"../src/util":30}],36:[function(t,e,n){"use strict";function r(t,e){if(!g){var n=a(t);h(function(t){t.setAttribute(n,e),t.save(p)})}}function o(t){if(!g){var e=a(t),n=null;return h(function(t){n=t.getAttribute(e)}),n}}function s(t){h(function(e){for(var n=e.XMLDocument.documentElement.attributes,r=n.length-1;r>=0;r--){var o=n[r];t(e.getAttribute(o.name),o.name)}})}function i(t){var e=a(t);h(function(t){t.removeAttribute(e),t.save(p)})}function u(){h(function(t){var e=t.XMLDocument.documentElement.attributes;t.load(p);for(var n=e.length-1;n>=0;n--)t.removeAttribute(e[n].name);t.save(p)})}function a(t){return t.replace(/^\d/,"___$&").replace(v,"___")}function c(){if(!d||!d.documentElement||!d.documentElement.addBehavior)return null;var t,e,n,r="script";try{e=new ActiveXObject("htmlfile"),e.open(),e.write("<"+r+">document.w=window</"+r+'><iframe src="/favicon.ico"></iframe>'),e.close(),t=e.w.frames[0].document,n=t.cr
|