SickGear/gui/slick/js/lib/jquery.cookiejar.min.js
2023-02-09 13:41:15 +00:00

4 lines
1.5 KiB
JavaScript

(function(c){c.cookieJar=function(g,h){return c.parseJSON&&c.toJSON&&c.cookie?new function(){function d(b){"undefined"!=typeof console&&"undefined"!=typeof console.log?console.log("cookiejar:"+a.cookieName+" "+b):alert(b)}function e(){a.options.debug&&d("save "+c.toJSON(a.cookieObject));return Cookies.set(a.cookieName,c.toJSON(a.cookieObject),a.options.cookie)}function f(){var b=Cookies.get(a.cookieName);"string"==typeof b?(a.options.debug&&d("load "+b),a.cookieObject=c.parseJSON(b,!0)):(a.options.debug&&
d("load new"),a.cookieObject={},e())}this.set=function(b,c){a.options.debug&&d("set "+b+" = "+c);a.cookieObject[b]=c;return e()};this.get=function(b){a.options.cacheCookie||f();a.options.debug&&d("get "+b+" = "+a.cookieObject[b]);return a.cookieObject[b]};this.remove=function(b){a.options.debug&&d("remove "+b);"undefined"!=typeof b?delete a.cookieObject[b]:a.setFromObject({});return e()};this.setFromObject=function(b){if("object"==typeof b)return a.options.debug&&d("setFromObject"),a.cookieObject=
b,e()};this.toObject=function(){a.options.debug&&d("toObject");return a.cookieObject};this.toString=function(){a.options.debug&&d("toString = "+c.toJSON(a.cookieObject));return c.toJSON(a.cookieObject)};this.destroy=function(){a.options.debug&&d("destroy");a.cookieObject={};return Cookies.set(a.cookieName,null,a.options.cookie)};this.construct=function(b,d){a.options=c.extend({cookie:{expires:365,path:"/"},cacheCookie:!0,cookiePrefix:"jqCookieJar_",debug:!1},d);a.cookieName=a.options.cookiePrefix+
b;f();return a};var a=this;a.construct(g,h)}:!1}})(jQuery);