diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 5662829f2..955fc7695 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,5 +1,4 @@ //= require hammer.js -//= require jquery.storageapi.js //= require jquery.dropdown.js //= require stupidtable.js //= require jquery.qtip.js diff --git a/app/assets/javascripts/autocomplete.js.erb b/app/assets/javascripts/autocomplete.js.erb index f3a61253d..6e2116aab 100644 --- a/app/assets/javascripts/autocomplete.js.erb +++ b/app/assets/javascripts/autocomplete.js.erb @@ -10,7 +10,7 @@ if (Danbooru.meta("enable-auto-complete") === "true") { $.widget("ui.autocomplete", $.ui.autocomplete, { options: { - delay: 100, + delay: 0, minLength: 1, autoFocus: false, focus: function() { return false; }, @@ -22,25 +22,14 @@ _renderItem: Danbooru.Autocomplete.render_item, }); - Danbooru.Autocomplete.enable_local_storage = false; this.initialize_tag_autocomplete(); this.initialize_mention_autocomplete($(".autocomplete-mentions textarea")); this.initialize_artist_autocomplete($('[data-autocomplete="artist"]')); this.initialize_pool_autocomplete($('[data-autocomplete="pool"]')); this.initialize_wiki_autocomplete($('[data-autocomplete="wiki-page"]')); - this.prune_local_storage(); } } - // todo: remove eventually - Danbooru.Autocomplete.prune_local_storage = function() { - $.each(Object.keys(localStorage), function(i, key) { - if (key.substr(0, 3) === "ac-") { - $.localStorage.remove(key); - } - }); - } - Danbooru.Autocomplete.initialize_mention_autocomplete = function($fields) { $fields.autocomplete({ search: function() { @@ -346,22 +335,22 @@ Danbooru.Autocomplete.render_item = function(list, item) { var $link = $(""); - var $menu_item = $("
").append($link); + $link.text(item.label); + $link.attr("href", "/posts?tags=" + encodeURIComponent(item.value)); + $link.click(function(e) { + e.preventDefault(); + }); if (item.antecedent) { var antecedent = item.antecedent.replace(/_/g, " "); var arrow = $("").html(" → ").addClass("autocomplete-arrow"); var antecedent_element = $("").text(antecedent).addClass("autocomplete-antecedent"); - $link.append(antecedent_element); - $link.append(arrow); + $link.append([ + arrow, + antecedent_element + ]); } - $link.append(document.createTextNode(item.label)); - $link.attr("href", "/posts?tags=" + encodeURIComponent(item.value)); - $link.click(function(e) { - e.preventDefault(); - }); - if (item.post_count !== undefined) { var count; if (item.post_count >= 1000) { @@ -385,6 +374,7 @@ $link.addClass("pool-category-" + item.category); } + var $menu_item = $("
").append($link); return $("
  • ").data("item.autocomplete", item).append($menu_item).appendTo(list); }; diff --git a/vendor/assets/javascripts/jquery.storageapi.js b/vendor/assets/javascripts/jquery.storageapi.js deleted file mode 100644 index c7bdb8606..000000000 --- a/vendor/assets/javascripts/jquery.storageapi.js +++ /dev/null @@ -1,554 +0,0 @@ -/* - * jQuery Storage API Plugin - * - * Copyright (c) 2013 Julien Maurel - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/mit-license.php - * - * Project home: - * https://github.com/julien-maurel/jQuery-Storage-API - * - * Version: 1.9.4 - */ -(function (factory) { - if (typeof define === 'function' && define.amd) { - // AMD - define(['jquery'], factory); - } else if (typeof exports === 'object') { - // CommonJS - factory(require('jquery')); - } else { - // Browser globals - factory(jQuery); - } -}(function ($) { - // Prefix to use with cookie fallback - var cookie_local_prefix = "ls_"; - var cookie_session_prefix = "ss_"; - - // Get items from a storage - function _get() { - var storage = this._type, l = arguments.length, s = window[storage], a = arguments, a0 = a[0], vi, ret, tmp; - if (l < 1) { - throw new Error('Minimum 1 argument must be given'); - } else if ($.isArray(a0)) { - // If second argument is an array, return an object with value of storage for each item in this array - ret = {}; - for (var i in a0) { - vi = a0[i]; - try { - ret[vi] = JSON.parse(s.getItem(vi)); - } catch (e) { - ret[vi] = s.getItem(vi); - } - } - return ret; - } else if (l == 1) { - // If only 1 argument, return value directly - try { - return JSON.parse(s.getItem(a0)); - } catch (e) { - return s.getItem(a0); - } - } else { - // If more than 1 argument, parse storage to retrieve final value to return it - // Get first level - try { - ret = JSON.parse(s.getItem(a0)); - } catch (e) { - throw new ReferenceError(a0 + ' is not defined in this storage'); - } - // Parse next levels - for (var i = 1; i < l - 1; i++) { - ret = ret[a[i]]; - if (ret === undefined) { - throw new ReferenceError([].slice.call(a, 1, i + 1).join('.') + ' is not defined in this storage'); - } - } - // If last argument is an array, return an object with value for each item in this array - // Else return value normally - if ($.isArray(a[i])) { - tmp = ret; - ret = {}; - for (var j in a[i]) { - ret[a[i][j]] = tmp[a[i][j]]; - } - return ret; - } else { - return ret[a[i]]; - } - } - } - - // Set items of a storage - function _set() { - var storage = this._type, l = arguments.length, s = window[storage], a = arguments, a0 = a[0], a1 = a[1], vi, to_store = isNaN(a1)?{}:[], type, tmp; - if (l < 1 || !$.isPlainObject(a0) && l < 2) { - throw new Error('Minimum 2 arguments must be given or first parameter must be an object'); - } else if ($.isPlainObject(a0)) { - // If first argument is an object, set values of storage for each property of this object - for (var i in a0) { - vi = a0[i]; - if (!$.isPlainObject(vi) && !this.alwaysUseJson) { - s.setItem(i, vi); - } else { - s.setItem(i, JSON.stringify(vi)); - } - } - return a0; - } else if (l == 2) { - // If only 2 arguments, set value of storage directly - if (typeof a1 === 'object' || this.alwaysUseJson) { - s.setItem(a0, JSON.stringify(a1)); - } else { - s.setItem(a0, a1); - } - return a1; - } else { - // If more than 3 arguments, parse storage to retrieve final node and set value - // Get first level - try { - tmp = s.getItem(a0); - if (tmp != null) { - to_store = JSON.parse(tmp); - } - } catch (e) { - } - tmp = to_store; - // Parse next levels and set value - for (var i = 1; i < l - 2; i++) { - vi = a[i]; - type = isNaN(a[i+1])?"object":"array"; - if (!tmp[vi] || type == "object" && !$.isPlainObject(tmp[vi]) || type=="array" && !$.isArray(tmp[vi])) { - if(type=="array") tmp[vi] = []; - else tmp[vi] = {}; - } - tmp = tmp[vi]; - } - tmp[a[i]] = a[i + 1]; - s.setItem(a0, JSON.stringify(to_store)); - return to_store; - } - } - - // Remove items from a storage - function _remove() { - var storage = this._type, l = arguments.length, s = window[storage], a = arguments, a0 = a[0], to_store, tmp; - if (l < 1) { - throw new Error('Minimum 1 argument must be given'); - } else if ($.isArray(a0)) { - // If first argument is an array, remove values from storage for each item of this array - for (var i in a0) { - s.removeItem(a0[i]); - } - return true; - } else if (l == 1) { - // If only 2 arguments, remove value from storage directly - s.removeItem(a0); - return true; - } else { - // If more than 2 arguments, parse storage to retrieve final node and remove value - // Get first level - try { - to_store = tmp = JSON.parse(s.getItem(a0)); - } catch (e) { - throw new ReferenceError(a0 + ' is not defined in this storage'); - } - // Parse next levels and remove value - for (var i = 1; i < l - 1; i++) { - tmp = tmp[a[i]]; - if (tmp === undefined) { - throw new ReferenceError([].slice.call(a, 1, i).join('.') + ' is not defined in this storage'); - } - } - // If last argument is an array,remove value for each item in this array - // Else remove value normally - if ($.isArray(a[i])) { - for (var j in a[i]) { - delete tmp[a[i][j]]; - } - } else { - delete tmp[a[i]]; - } - s.setItem(a0, JSON.stringify(to_store)); - return true; - } - } - - // Remove all items from a storage - function _removeAll(reinit_ns) { - var keys = _keys.call(this); - for (var i in keys) { - _remove.call(this, keys[i]); - } - // Reinitialize all namespace storages - if (reinit_ns) { - for (var i in $.namespaceStorages) { - _createNamespace(i); - } - } - } - - // Check if items of a storage are empty - function _isEmpty() { - var l = arguments.length, a = arguments, a0 = a[0]; - if (l == 0) { - // If no argument, test if storage is empty - return (_keys.call(this).length == 0); - } else if ($.isArray(a0)) { - // If first argument is an array, test each item of this array and return true only if all items are empty - for (var i = 0; i < a0.length; i++) { - if (!_isEmpty.call(this, a0[i])) { - return false; - } - } - return true; - } else { - // If at least 1 argument, try to get value and test it - try { - var v = _get.apply(this, arguments); - // Convert result to an object (if last argument is an array, _get return already an object) and test each item - if (!$.isArray(a[l - 1])) { - v = {'totest': v}; - } - for (var i in v) { - if (!( - ($.isPlainObject(v[i]) && $.isEmptyObject(v[i])) || - ($.isArray(v[i]) && !v[i].length) || - (!v[i]) - )) { - return false; - } - } - return true; - } catch (e) { - return true; - } - } - } - - // Check if items of a storage exist - function _isSet() { - var l = arguments.length, a = arguments, a0 = a[0]; - if (l < 1) { - throw new Error('Minimum 1 argument must be given'); - } - if ($.isArray(a0)) { - // If first argument is an array, test each item of this array and return true only if all items exist - for (var i = 0; i < a0.length; i++) { - if (!_isSet.call(this, a0[i])) { - return false; - } - } - return true; - } else { - // For other case, try to get value and test it - try { - var v = _get.apply(this, arguments); - // Convert result to an object (if last argument is an array, _get return already an object) and test each item - if (!$.isArray(a[l - 1])) { - v = {'totest': v}; - } - for (var i in v) { - if (!(v[i] !== undefined && v[i] !== null)) { - return false; - } - } - return true; - } catch (e) { - return false; - } - } - } - - // Get keys of a storage or of an item of the storage - function _keys() { - var storage = this._type, l = arguments.length, s = window[storage], a = arguments, keys = [], o = {}; - // If at least 1 argument, get value from storage to retrieve keys - // Else, use storage to retrieve keys - if (l > 0) { - o = _get.apply(this, a); - } else { - o = s; - } - if (o && o._cookie) { - // If storage is a cookie, use js-cookie to retrieve keys - for (var key in Cookies.get()) { - if (key != '') { - keys.push(key.replace(o._prefix, '')); - } - } - } else { - for (var i in o) { - if (o.hasOwnProperty(i)) { - keys.push(i); - } - } - } - return keys; - } - - // Create new namespace storage - function _createNamespace(name) { - if (!name || typeof name != "string") { - throw new Error('First parameter must be a string'); - } - if (storage_available) { - if (!window.localStorage.getItem(name)) { - window.localStorage.setItem(name, '{}'); - } - if (!window.sessionStorage.getItem(name)) { - window.sessionStorage.setItem(name, '{}'); - } - } else { - if (!window.localCookieStorage.getItem(name)) { - window.localCookieStorage.setItem(name, '{}'); - } - if (!window.sessionCookieStorage.getItem(name)) { - window.sessionCookieStorage.setItem(name, '{}'); - } - } - var ns = { - localStorage: $.extend({}, $.localStorage, {_ns: name}), - sessionStorage: $.extend({}, $.sessionStorage, {_ns: name}) - }; - if (typeof Cookies !== 'undefined') { - if (!window.cookieStorage.getItem(name)) { - window.cookieStorage.setItem(name, '{}'); - } - ns.cookieStorage = $.extend({}, $.cookieStorage, {_ns: name}); - } - $.namespaceStorages[name] = ns; - return ns; - } - - // Test if storage is natively available on browser - function _testStorage(name) { - var foo = 'jsapi'; - try { - if (!window[name]) { - return false; - } - window[name].setItem(foo, foo); - window[name].removeItem(foo); - return true; - } catch (e) { - return false; - } - } - - // Check if storages are natively available on browser - var storage_available = _testStorage('localStorage'); - - // Namespace object - var storage = { - _type: '', - _ns: '', - _callMethod: function (f, a) { - var p = [], a = Array.prototype.slice.call(a), a0 = a[0]; - - if (this._ns) { - p.push(this._ns); - } - if (typeof a0 === 'string' && a0.indexOf('.') !== -1) { - a.shift(); - [].unshift.apply(a, a0.split('.')); - } - [].push.apply(p, a); - return f.apply(this, p); - }, - // Define if plugin always use JSON to store values (even to store simple values like string, int...) or not - alwaysUseJson: false, - // Get items. If no parameters and storage have a namespace, return all namespace - get: function () { - return this._callMethod(_get, arguments); - }, - // Set items - set: function () { - var l = arguments.length, a = arguments, a0 = a[0]; - if (l < 1 || !$.isPlainObject(a0) && l < 2) { - throw new Error('Minimum 2 arguments must be given or first parameter must be an object'); - } - // If first argument is an object and storage is a namespace storage, set values individually - if ($.isPlainObject(a0) && this._ns) { - for (var i in a0) { - this._callMethod(_set, [i, a0[i]]); - } - return a0; - } else { - var r = this._callMethod(_set, a); - if (this._ns) { - return r[a0.split('.')[0]]; - } else { - return r; - } - } - }, - // Delete items - remove: function () { - if (arguments.length < 1) { - throw new Error('Minimum 1 argument must be given'); - } - return this._callMethod(_remove, arguments); - }, - // Delete all items - removeAll: function (reinit_ns) { - if (this._ns) { - this._callMethod(_set, [{}]); - return true; - } else { - return this._callMethod(_removeAll, [reinit_ns]); - } - }, - // Items empty - isEmpty: function () { - return this._callMethod(_isEmpty, arguments); - }, - // Items exists - isSet: function () { - if (arguments.length < 1) { - throw new Error('Minimum 1 argument must be given'); - } - return this._callMethod(_isSet, arguments); - }, - // Get keys of items - keys: function () { - return this._callMethod(_keys, arguments); - } - }; - - // Use js-cookie for compatibility with old browsers and give access to cookieStorage - if (typeof Cookies !== 'undefined') { - // sessionStorage is valid for one window/tab. To simulate that with cookie, we set a name for the window and use it for the name of the cookie - if (!window.name) { - window.name = Math.floor(Math.random() * 100000000); - } - var cookie_storage = { - _cookie: true, - _prefix: '', - _expires: null, - _path: null, - _domain: null, - setItem: function (n, v) { - Cookies.set(this._prefix + n, v, {expires: this._expires, path: this._path, domain: this._domain}); - }, - getItem: function (n) { - return Cookies.get(this._prefix + n); - }, - removeItem: function (n) { - return Cookies.remove(this._prefix + n, {path: this._path}); - }, - clear: function () { - for (var key in Cookies.get()) { - if (key != '') { - if (!this._prefix && key.indexOf(cookie_local_prefix) === -1 && key.indexOf(cookie_session_prefix) === -1 || this._prefix && key.indexOf(this._prefix) === 0) { - Cookies.remove(key); - } - } - } - }, - setExpires: function (e) { - this._expires = e; - return this; - }, - setPath: function (p) { - this._path = p; - return this; - }, - setDomain: function (d) { - this._domain = d; - return this; - }, - setConf: function (c) { - if (c.path) { - this._path = c.path; - } - if (c.domain) { - this._domain = c.domain; - } - if (c.expires) { - this._expires = c.expires; - } - return this; - }, - setDefaultConf: function () { - this._path = this._domain = this._expires = null; - } - }; - if (!storage_available) { - window.localCookieStorage = $.extend({}, cookie_storage, { - _prefix: cookie_local_prefix, - _expires: 365 * 10 - }); - window.sessionCookieStorage = $.extend({}, cookie_storage, {_prefix: cookie_session_prefix + window.name + '_'}); - } - window.cookieStorage = $.extend({}, cookie_storage); - // cookieStorage API - $.cookieStorage = $.extend({}, storage, { - _type: 'cookieStorage', - setExpires: function (e) { - window.cookieStorage.setExpires(e); - return this; - }, - setPath: function (p) { - window.cookieStorage.setPath(p); - return this; - }, - setDomain: function (d) { - window.cookieStorage.setDomain(d); - return this; - }, - setConf: function (c) { - window.cookieStorage.setConf(c); - return this; - }, - setDefaultConf: function () { - window.cookieStorage.setDefaultConf(); - return this; - } - }); - } - - // Get a new API on a namespace - $.initNamespaceStorage = function (ns) { - return _createNamespace(ns); - }; - if (storage_available) { - // About alwaysUseJson - // By default, all values are string on html storages and the plugin don't use json to store simple values (strings, int, float...) - // So by default, if you do storage.setItem('test',2), value in storage will be "2", not 2 - // If you set this property to true, all values set with the plugin will be stored as json to have typed values in any cases - - // localStorage API - $.localStorage = $.extend({}, storage, {_type: 'localStorage'}); - // sessionStorage API - $.sessionStorage = $.extend({}, storage, {_type: 'sessionStorage'}); - } else { - // localStorage API - $.localStorage = $.extend({}, storage, {_type: 'localCookieStorage'}); - // sessionStorage API - $.sessionStorage = $.extend({}, storage, {_type: 'sessionCookieStorage'}); - } - // List of all namespace storage - $.namespaceStorages = {}; - // Remove all items in all storages - $.removeAllStorages = function (reinit_ns) { - $.localStorage.removeAll(reinit_ns); - $.sessionStorage.removeAll(reinit_ns); - if ($.cookieStorage) { - $.cookieStorage.removeAll(reinit_ns); - } - if (!reinit_ns) { - $.namespaceStorages = {}; - } - } - $.alwaysUseJsonInStorage = function (value) { - storage.alwaysUseJson = value; - $.localStorage.alwaysUseJson = value; - $.sessionStorage.alwaysUseJson = value; - if ($.cookieStorage) { - $.cookieStorage.alwaysUseJson = value; - } - } -})); diff --git a/vendor/assets/javascripts/jquery.storageapi.min.js b/vendor/assets/javascripts/jquery.storageapi.min.js deleted file mode 100644 index a060c559f..000000000 --- a/vendor/assets/javascripts/jquery.storageapi.min.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * jQuery Storage API Plugin - * - * Copyright (c) 2013 Julien Maurel - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/mit-license.php - * - * Project home: - * https://github.com/julien-maurel/jQuery-Storage-API - * - * Version: 1.9.4 - */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){function t(){var t,r,i,o=this._type,n=arguments.length,s=window[o],a=arguments,f=a[0];if(1>n)throw new Error("Minimum 1 argument must be given");if(e.isArray(f)){r={};for(var l in f){t=f[l];try{r[t]=JSON.parse(s.getItem(t))}catch(c){r[t]=s.getItem(t)}}return r}if(1!=n){try{r=JSON.parse(s.getItem(f))}catch(c){throw new ReferenceError(f+" is not defined in this storage")}for(var l=1;n-1>l;l++)if(r=r[a[l]],void 0===r)throw new ReferenceError([].slice.call(a,1,l+1).join(".")+" is not defined in this storage");if(e.isArray(a[l])){i=r,r={};for(var u in a[l])r[a[l][u]]=i[a[l][u]];return r}return r[a[l]]}try{return JSON.parse(s.getItem(f))}catch(c){return s.getItem(f)}}function r(){var t,r,i,o=this._type,n=arguments.length,s=window[o],a=arguments,f=a[0],l=a[1],c=isNaN(l)?{}:[];if(1>n||!e.isPlainObject(f)&&2>n)throw new Error("Minimum 2 arguments must be given or first parameter must be an object");if(e.isPlainObject(f)){for(var u in f)t=f[u],e.isPlainObject(t)||this.alwaysUseJson?s.setItem(u,JSON.stringify(t)):s.setItem(u,t);return f}if(2==n)return"object"==typeof l||this.alwaysUseJson?s.setItem(f,JSON.stringify(l)):s.setItem(f,l),l;try{i=s.getItem(f),null!=i&&(c=JSON.parse(i))}catch(h){}i=c;for(var u=1;n-2>u;u++)t=a[u],r=isNaN(a[u+1])?"object":"array",(!i[t]||"object"==r&&!e.isPlainObject(i[t])||"array"==r&&!e.isArray(i[t]))&&("array"==r?i[t]=[]:i[t]={}),i=i[t];return i[a[u]]=a[u+1],s.setItem(f,JSON.stringify(c)),c}function i(){var t,r,i=this._type,o=arguments.length,n=window[i],s=arguments,a=s[0];if(1>o)throw new Error("Minimum 1 argument must be given");if(e.isArray(a)){for(var f in a)n.removeItem(a[f]);return!0}if(1==o)return n.removeItem(a),!0;try{t=r=JSON.parse(n.getItem(a))}catch(l){throw new ReferenceError(a+" is not defined in this storage")}for(var f=1;o-1>f;f++)if(r=r[s[f]],void 0===r)throw new ReferenceError([].slice.call(s,1,f).join(".")+" is not defined in this storage");if(e.isArray(s[f]))for(var c in s[f])delete r[s[f][c]];else delete r[s[f]];return n.setItem(a,JSON.stringify(t)),!0}function o(t){var r=a.call(this);for(var o in r)i.call(this,r[o]);if(t)for(var o in e.namespaceStorages)f(o)}function n(){var r=arguments.length,i=arguments,o=i[0];if(0==r)return 0==a.call(this).length;if(e.isArray(o)){for(var s=0;sr)throw new Error("Minimum 1 argument must be given");if(e.isArray(o)){for(var n=0;n0?t.apply(this,o):i,s&&s._cookie)for(var a in Cookies.get())""!=a&&n.push(a.replace(s._prefix,""));else for(var f in s)s.hasOwnProperty(f)&&n.push(f);return n}function f(t){if(!t||"string"!=typeof t)throw new Error("First parameter must be a string");h?(window.localStorage.getItem(t)||window.localStorage.setItem(t,"{}"),window.sessionStorage.getItem(t)||window.sessionStorage.setItem(t,"{}")):(window.localCookieStorage.getItem(t)||window.localCookieStorage.setItem(t,"{}"),window.sessionCookieStorage.getItem(t)||window.sessionCookieStorage.setItem(t,"{}"));var r={localStorage:e.extend({},e.localStorage,{_ns:t}),sessionStorage:e.extend({},e.sessionStorage,{_ns:t})};return"undefined"!=typeof Cookies&&(window.cookieStorage.getItem(t)||window.cookieStorage.setItem(t,"{}"),r.cookieStorage=e.extend({},e.cookieStorage,{_ns:t})),e.namespaceStorages[t]=r,r}function l(e){var t="jsapi";try{return window[e]?(window[e].setItem(t,t),window[e].removeItem(t),!0):!1}catch(r){return!1}}var c="ls_",u="ss_",h=l("localStorage"),g={_type:"",_ns:"",_callMethod:function(e,t){var r=[],t=Array.prototype.slice.call(t),i=t[0];return this._ns&&r.push(this._ns),"string"==typeof i&&-1!==i.indexOf(".")&&(t.shift(),[].unshift.apply(t,i.split("."))),[].push.apply(r,t),e.apply(this,r)},alwaysUseJson:!1,get:function(){return this._callMethod(t,arguments)},set:function(){var t=arguments.length,i=arguments,o=i[0];if(1>t||!e.isPlainObject(o)&&2>t)throw new Error("Minimum 2 arguments must be given or first parameter must be an object");if(e.isPlainObject(o)&&this._ns){for(var n in o)this._callMethod(r,[n,o[n]]);return o}var s=this._callMethod(r,i);return this._ns?s[o.split(".")[0]]:s},remove:function(){if(arguments.length<1)throw new Error("Minimum 1 argument must be given");return this._callMethod(i,arguments)},removeAll:function(e){return this._ns?(this._callMethod(r,[{}]),!0):this._callMethod(o,[e])},isEmpty:function(){return this._callMethod(n,arguments)},isSet:function(){if(arguments.length<1)throw new Error("Minimum 1 argument must be given");return this._callMethod(s,arguments)},keys:function(){return this._callMethod(a,arguments)}};if("undefined"!=typeof Cookies){window.name||(window.name=Math.floor(1e8*Math.random()));var m={_cookie:!0,_prefix:"",_expires:null,_path:null,_domain:null,setItem:function(e,t){Cookies.set(this._prefix+e,t,{expires:this._expires,path:this._path,domain:this._domain})},getItem:function(e){return Cookies.get(this._prefix+e)},removeItem:function(e){return Cookies.remove(this._prefix+e,{path:this._path})},clear:function(){for(var e in Cookies.get())""!=e&&(!this._prefix&&-1===e.indexOf(c)&&-1===e.indexOf(u)||this._prefix&&0===e.indexOf(this._prefix))&&Cookies.remove(e)},setExpires:function(e){return this._expires=e,this},setPath:function(e){return this._path=e,this},setDomain:function(e){return this._domain=e,this},setConf:function(e){return e.path&&(this._path=e.path),e.domain&&(this._domain=e.domain),e.expires&&(this._expires=e.expires),this},setDefaultConf:function(){this._path=this._domain=this._expires=null}};h||(window.localCookieStorage=e.extend({},m,{_prefix:c,_expires:3650}),window.sessionCookieStorage=e.extend({},m,{_prefix:u+window.name+"_"})),window.cookieStorage=e.extend({},m),e.cookieStorage=e.extend({},g,{_type:"cookieStorage",setExpires:function(e){return window.cookieStorage.setExpires(e),this},setPath:function(e){return window.cookieStorage.setPath(e),this},setDomain:function(e){return window.cookieStorage.setDomain(e),this},setConf:function(e){return window.cookieStorage.setConf(e),this},setDefaultConf:function(){return window.cookieStorage.setDefaultConf(),this}})}e.initNamespaceStorage=function(e){return f(e)},h?(e.localStorage=e.extend({},g,{_type:"localStorage"}),e.sessionStorage=e.extend({},g,{_type:"sessionStorage"})):(e.localStorage=e.extend({},g,{_type:"localCookieStorage"}),e.sessionStorage=e.extend({},g,{_type:"sessionCookieStorage"})),e.namespaceStorages={},e.removeAllStorages=function(t){e.localStorage.removeAll(t),e.sessionStorage.removeAll(t),e.cookieStorage&&e.cookieStorage.removeAll(t),t||(e.namespaceStorages={})},e.alwaysUseJsonInStorage=function(t){g.alwaysUseJson=t,e.localStorage.alwaysUseJson=t,e.sessionStorage.alwaysUseJson=t,e.cookieStorage&&(e.cookieStorage.alwaysUseJson=t)}}); \ No newline at end of file