File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/js/messenger/utils/localstorage/messenger.utils.localstorage.bundle.min.js
Back
(function(e){"use strict";var t=function(){function e(){babelHelpers.classCallCheck(this,e);this.enabled=null;this.expireList=null;this.expireInterval=null}babelHelpers.createClass(e,[{key:"isEnabled",value:function e(){if(this.enabled!==null){return this.enabled}this.enabled=false;if(typeof window.localStorage!=="undefined"){try{window.localStorage.setItem("__bx_test_ls_feature__","ok");if(window.localStorage.getItem("__bx_test_ls_feature__")==="ok"){window.localStorage.removeItem("__bx_test_ls_feature__");this.enabled=true}}catch(e){}}if(this.enabled&&!this.expireInterval){try{var t=window.localStorage.getItem("bx-messenger-localstorage-expire");if(t){this.expireList=JSON.parse(t)}}catch(e){}clearInterval(this.expireInterval);this.expireInterval=setInterval(this._checkExpireInterval.bind(this),6e4)}return this.enabled}},{key:"set",value:function e(t,i,r,n){var s=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;if(!this.isEnabled()){return false}var l=null;if(s){l=new Date((new Date).getTime()+s*1e3)}var a=JSON.stringify({value:n,expire:l});if(window.localStorage.getItem(this._getKey(t,i,r))!==a){window.localStorage.setItem(this._getKey(t,i,r),a)}if(s){if(!this.expireList){this.expireList={}}this.expireList[this._getKey(t,i,r)]=l;window.localStorage.setItem("bx-messenger-localstorage-expire",JSON.stringify(this.expireList))}return true}},{key:"get",value:function e(t,i,r,n){if(!this.isEnabled()){return typeof n!=="undefined"?n:null}var s=window.localStorage.getItem(this._getKey(t,i,r));if(s===null){return typeof n!=="undefined"?n:null}try{s=JSON.parse(s);if(s&&typeof s.value!=="undefined"){if(!s.expire||new Date(s.expire)>new Date){s=s.value}else{window.localStorage.removeItem(this._getKey(t,i,r));if(this.expireList){delete this.expireList[this._getKey(t,i,r)]}return typeof n!=="undefined"?n:null}}else{return typeof n!=="undefined"?n:null}}catch(e){return typeof n!=="undefined"?n:null}return s}},{key:"remove",value:function e(t,i,r){if(!this.isEnabled()){return false}if(this.expireList){delete this.expireList[this._getKey(t,i,r)]}return window.localStorage.removeItem(this._getKey(t,i,r))}},{key:"_getKey",value:function e(t,i,r){return"bx-messenger-"+t+"-"+i+"-"+r}},{key:"_checkExpireInterval",value:function e(){if(!this.expireList)return true;var t=new Date;var i=0;for(var r in this.expireList){if(!this.expireList.hasOwnProperty(r)){continue}if(new Date(this.expireList[r])<=t){window.localStorage.removeItem(r);delete this.expireList[r]}else{i++}}if(i){window.localStorage.setItem("bx-messenger-localstorage-expire",JSON.stringify(this.expireList))}else{this.expireList=null;window.localStorage.removeItem("bx-messenger-localstorage-expire")}return true}}]);return e}();if(!window.BX){window.BX={}}if(typeof window.BX.Messenger=="undefined"){window.BX.Messenger={}}if(typeof window.BX.Messenger.LocalStorage=="undefined"){BX.Messenger.LocalStorage=new t}})(this.window=this.window||{}); //# sourceMappingURL=messenger.utils.localstorage.bundle.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.26 |
proxy
|
phpinfo
|
Settings