Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/im/lib/localstorage/dist/ |
Upload File : |
this.BX=this.BX||{};this.BX.Messenger=this.BX.Messenger||{};(function(e){"use strict"; /** * Bitrix Messenger * LocalStorage manager * * @package bitrix * @subpackage im * @copyright 2001-2019 Bitrix */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,s){var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;if(!this.isEnabled()){return false}var l=null;if(n){l=new Date((new Date).getTime()+n*1e3)}var a=JSON.stringify({value:s,expire:l});if(window.localStorage.getItem(this._getKey(t,i,r))!==a){window.localStorage.setItem(this._getKey(t,i,r),a)}if(n){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,s){if(!this.isEnabled()){return typeof s!=="undefined"?s:null}var n=window.localStorage.getItem(this._getKey(t,i,r));if(n===null){return typeof s!=="undefined"?s:null}try{n=JSON.parse(n);if(n&&typeof n.value!=="undefined"){if(!n.expire||new Date(n.expire)>new Date){n=n.value}else{window.localStorage.removeItem(this._getKey(t,i,r));if(this.expireList){delete this.expireList[this._getKey(t,i,r)]}return typeof s!=="undefined"?s:null}}else{return typeof s!=="undefined"?s:null}}catch(e){return typeof s!=="undefined"?s:null}return n}},{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}();var i=new t;e.LocalStorage=i})(this.BX.Messenger.Lib=this.BX.Messenger.Lib||{}); //# sourceMappingURL=localstorage.bundle.map.js