Your IP : 18.219.10.176


Current Path : /home/bitrix/ext_www/dev.home-comfort.in.ua/bitrix/js/mobileapp/
Upload File :
Current File : /home/bitrix/ext_www/dev.home-comfort.in.ua/bitrix/js/mobileapp/bitrix_mobile.min.js

(function(){if(window.app)return;MobileDatabase=function(){this.tableList=[];this.db=window.openDatabase("Database","1.0","Bitrix Base",20*1024*1024)};MobileDatabase.prototype.init=function(){ReadyDevice(BX.proxy(function(){this.db=window.openDatabase("Database","1.0","Bitrix Base",2e5)},this))};MobileDatabase.prototype.isTableExists=function(e,t){var i=this;var n=function(){var n=i.tableList.length;for(var a=0;a<n;a++){if(i.tableList[a].toUpperCase()==e.toUpperCase()){t(true);return}}t(false)};if(this.tableList.length<=0)this.getTableList(n);else n()};MobileDatabase.prototype.getTableList=function(e){var t=this;var i=e;this.query({query:"SELECT tbl_name from sqlite_master WHERE type = 'table'",values:{}},function(e){if(e.count>0){for(var n=0;n<e.items.length;n++)t.tableList[t.tableList.length]=e.items[n].tbl_name}if(i!=null&&typeof i=="function")i(t.tableList)})};MobileDatabase.prototype.createTable=function(e){e.action="create";var t=this.getQuery(e);this.query(t,e.success,e.fail)};MobileDatabase.prototype.dropTable=function(e){e.action="drop";var t=this.getQuery(e);this.query(t,e.success,e)};MobileDatabase.prototype.addRow=function(e){e.action="insert";this.query(this.getQuery(e),e.success,e.fail)};MobileDatabase.prototype.getRows=function(e){e.action="select";this.query(this.getQuery(e),e.success,e.fail)};MobileDatabase.prototype.updateRows=function(e){e.action="update";var t=this.getQuery(e);this.query(t,e.success,e)};MobileDatabase.prototype.deleteRows=function(e){e.action="delete";var t=this.getQuery(e);this.query(t,e.success,e)};MobileDatabase.prototype.getQuery=function(e){var t=[];var i=e.filter;var n=e.fields;var a=e.insertFields;var o=e.updateFields;var r=e.tableName;var s="";switch(e.action){case"delete":{s="DELETE FROM "+r.toUpperCase()+" "+this.getFilter(i);t=this.getValues([i]);break}case"update":{s="UPDATE "+r.toUpperCase()+" "+this.getFieldPair(o,"SET ")+" "+this.getFilter(i);t=this.getValues([o,i]);break}case"create":{var c="";if(typeof n=="object"){var l="";for(var u=0;u<n.length;u++){l="";if(typeof n[u]=="object"){if(n[u].name){l=n[u].name;if(n[u].unique&&n[u].unique==true)l+=" unique"}}else if(typeof n[u]=="string"&&n[u].length>0)l=n[u];if(l.length>0){if(c.length>0)c+=","+l.toUpperCase();else c=l.toUpperCase()}}}s="CREATE TABLE IF NOT EXISTS "+r.toUpperCase()+" ("+c+") ";break}case"drop":{s="DROP TABLE IF EXISTS "+r.toUpperCase();break}case"select":{s="SELECT "+this.getValueArrayString(n,"*")+" FROM "+r.toUpperCase()+" "+this.getFilter(i);t=this.getValues([i]);break}case"insert":{t=this.getValues([a]);s="INSERT INTO "+r.toUpperCase()+" ("+this.getKeyString(a)+") VALUES(%values%)";var f="";for(var h=0;h<t.length;h++){if(f.length>0)f+=",?";else f="?"}s=s.replace("%values%",f);break}}return{query:s,values:t}};MobileDatabase.prototype.getFieldPair=function(e,t){var i="";var n=t||"";if(typeof e=="object"){var a=0;for(var o in e){var r=(a>0?", ":"")+(o.toUpperCase()+"="+"?");if(i.length==0&&n.length>0)i=n;i+=r;a++}}return i};MobileDatabase.prototype.getFilter=function(e){var t="";var i="WHERE ";if(typeof e=="object"){var n=0;for(var a in e){var o="";var r=1;if(typeof e[a]=="object")r=e[a].length;for(var s=0;s<r;s++){o=(s>0?o+" OR ":"(")+(a.toUpperCase()+"="+"?");if(s+1==r)o+=")"}t+=o;n++}}return"WHERE "+t};MobileDatabase.prototype.getKeyString=function(e,t){var i="";if(!t)t="";if(typeof e=="array"){for(var n=0;n<valuesItem.length;n++){if(i.length>0)i+=","+valuesItem[n].toUpperCase();else i=valuesItem[n].toUpperCase()}}else if(typeof e=="object"){for(var a in e){if(i.length>0)i+=","+a.toUpperCase();else i=a.toUpperCase()}}if(i.length==0)i=t;return i};MobileDatabase.prototype.getValueArrayString=function(e,t){var i="";if(!t)t="";if(typeof e=="object"){for(var n=0;n<e.length;n++){if(i.length>0)i+=","+e[n].toUpperCase();else i=e[n].toUpperCase()}}if(i.length==0)i=t;return i};MobileDatabase.prototype.getValues=function(e){var t=[];for(var i=0;i<e.length;i++){var n=e[i];if(typeof n=="object"){for(var a in n){if(typeof n[a]!="object")t[t.length]=n[a];else for(var o=0;o<n[a].length;o++){t[t.length]=n[a][o]}}}else if(typeof n=="array"){for(var o=0;o<n.length;o++){if(typeof n[o]!="object")t[t.length]=n[o]}}}return t};MobileDatabase.prototype.query=function(e,t,i){this.db.transaction(function(n){n.executeSql(e.query,e.values,function(e,i){var n={originalResult:i};var a=i.rows.length;if(a>=0){n.count=a;n.items=[];for(var o=0;o<a;o++){n.items[n.items.length]=i.rows.item(o)}}if(t!=null)t(n,e)},function(e,t){if(i!=null)i(t,e)})})};MobileDatabase.prototype.getResponseObject=function(e){var t=e.rows.length;var i=[];for(var n=0;n<t;n++){i[i.length]=e.rows.item(n)}return i};window.BXCordovaPlugin=function(e,t,i){this.pluginName=e;this.useSyncPlugin=t==true;this.callbackIndex=0;this.callbacks={};this.callbackIndex=0;this.dataBrigePath=(typeof mobileSiteDir=="undefined"?"/":mobileSiteDir)+"mobile/";this.available=false;this.convertBoolean=typeof i=="undefined"?true:i;this.platform=null;this.apiVersion=0;this.db=null;this.isDatabaseSupported=true;if(window.openDatabase)this.db=new MobileDatabase;else this.isDatabaseSupported=false;var n=this;document.addEventListener("deviceready",function(){n.available=true},false)};BXCordovaPlugin.prototype.RegisterCallBack=function(e){if(typeof e==="function"){this.callbackIndex++;this.callbacks[this.callbackIndex]=e;return this.callbackIndex}return false};BXCordovaPlugin.prototype.CallBackExecute=function(e,t){if(this.callbacks[e]&&typeof this.callbacks[e]==="function"){this.callbacks[e](t)}};BXCordovaPlugin.prototype.prepareParams=function(e,t){var i=true;if(typeof t=="boolean"){i=t}if(typeof e=="object"){for(var n in e){if(typeof e[n]=="object")e[n]=this.prepareParams(e[n],t);if(typeof e[n]=="function")e[n]=this.RegisterCallBack(e[n]);else if(i){if(e[n]===true)e[n]="YES";else if(e[n]===false)e[n]="NO"}}}else{if(typeof e=="function")e=this.RegisterCallBack(e);else if(i){if(e===true)e="YES";else if(e===false)e="NO"}}return e};BXCordovaPlugin.prototype.clone=function(e,t){var i,n,a;if(t!==false)t=true;if(e===null)return null;if(typeof e=="object"){if(Object.prototype.toString.call(e)=="[object Array]"){i=[];for(n=0,a=e.length;n<a;n++){if(typeof e[n]=="object"&&t)i[n]=this.clone(e[n],t);else i[n]=e[n]}}else{i={};for(n in e){if(typeof e[n]=="object"&&t)i[n]=this.clone(e[n],t);else i[n]=e[n]}}}else{i=e}return i};BXCordovaPlugin.prototype.exec=function(e,t,i){var n={};if(typeof i=="undefined"){i=this.convertBoolean}if(!this.available){document.addEventListener("deviceready",BX.proxy(function(){this.exec(e,t,i)},this),false);return false}if(typeof t!="undefined"){n=this.clone(t,true);n=this.prepareParams(n,i);if(typeof n=="object")n=JSON.stringify(n)}else{n="{}"}if(window.syncPlugin&&this.useSyncPlugin){window.syncPlugin.execute(e,n);return}if(device.platform.toUpperCase()=="ANDROID"||device.cordova>"2.0.0"){return Cordova.exec(null,null,this.pluginName,e,[n])}else{return Cordova.exec(this.pluginName+"."+e,n)}};var e=new BXCordovaPlugin("MobileWebRTC");window.webrtc=e;e.UI={parent:e,state:{OUTGOING_CALL:"outgoing_call",INCOMING_CALL:"incoming_call",CONVERSATION:"conversation",FAIL_CALL:"fail_call"}};e.UI.exec=function(e,t){this.parent.exec(e,t)};e.UI.show=function(e,t){var i=t||{};i.state=e;return this.exec("showUi",i)};e.UI.close=function(e){return this.exec("closeUi",e)};e.UI.showLocalVideo=function(e){return this.exec("showLocalVideo",e)};e.createPeerConnection=function(e){return this.exec("createPeerConnection",e)};e.createOffer=function(e){return this.exec("createOffer",e)};e.createAnswer=function(e){return this.exec("createAnswer",e)};e.addIceCandidates=function(e){return this.exec("addIceCandidates",e)};e.setRemoteDescription=function(e){return this.exec("setRemoteDescription",e)};e.getUserMedia=function(e){return this.exec("getUserMedia",e)};e.onReconnect=function(e){return this.exec("onReconnect",e)};e.setEventListeners=function(e){return this.exec("setEventListeners",e)};var t=new BXCordovaPlugin("BitrixMobile",true);window.app=t;t.notificationBar=function(e,t){this.exec("notificationBar",{action:e,params:t})};t.actionSheet=function(e,t){this.exec("actionSheet",{action:e,params:t})};t.titleAction=function(e,t){this.exec("titleAction",{action:e,params:t})};t.refresh=function(e,t){this.exec("refreshAction",{action:e,params:t})};t.textPanelAction=function(e,t){this.exec("textPanelAction",{action:e,params:t})};t.showSlidingPanel=function(e){return this.exec("showSlidingPanel",e)};t.changeAccount=function(){return this.exec("changeAccount",{})};t.showDocumentsCache=function(e){return this.exec("showDocumentsCache",e)};t.showButtonPanel=function(e){return this.exec("showButtonPanel",e)};t.hideSlidingPanel=t.hideButtonPanel=function(e){return this.exec("hideSlidingPanel",e)};t.showSelectPicker=function(e){return this.exec("showSelectPicker",e)};t.hideSelectPicker=function(e){return this.exec("hideSelectPicker",e)};t.updateButtonBadge=function(e){return this.exec("updateButtonBadge",e)};t.openBarCodeScanner=function(e){return this.exec("openBarCodeScanner",e)};t.openPhotos=function(e){return this.exec("openPhotos",e)};t.removeAllCache=function(e){return this.exec("removeAllCache",e)};t.loadPageBlank=function(e){return this.exec("openNewPage",e)};t.loadPageStart=function(e){return this.exec("loadPage",e)};t.confirm=function(e){if(!this.available){document.addEventListener("deviceready",BX.proxy(function(){this.confirm(e)},this),false);return}var t={callback:function(){},title:"",text:"",buttons:"OK"};if(e){if(e.title)t.title=e.title;if(e.buttons&&e.buttons.length>0){t.buttons="";for(var i=0;i<e.buttons.length;i++){if(t.buttons.length>0){t.buttons+=","+e.buttons[i]}else t.buttons=e.buttons[i]}}t.accept=e.accept;if(e.text)t.text=e.text;if(e.callback&&typeof e.callback=="function")t.callback=e.callback}navigator.notification.confirm(t.text,t.callback,t.title,t.buttons)};t.alert=function(e){if(!this.available){document.addEventListener("deviceready",BX.proxy(function(){this.alert(e)},this),false);return}var t={callback:function(){},title:"",button:"",text:""};if(typeof e=="object"){if(e.title)t.title=e.title;if(e.button)t.button=e.button;if(e.text)t.text=e.text;if(e.callback&&typeof e.callback=="function")t.callback=e.callback}else{t.text=e}navigator.notification.alert(t.text,t.callback,t.title,t.button)};t.openLeft=function(){return this.exec("openMenu")};t.setPageTitle=function(e){return this.exec("setPageTitle",e)};t.removeTableCache=function(e){return this.exec("removeTableCache",{table_id:e})};t.showDatePicker=function(e){return this.exec("showDatePicker",e)};t.hideDatePicker=function(){return this.exec("hideDatePicker")};t.showInput=function(e){return this.exec("showInput",e)};t.showInputLoading=function(e){if(e&&e!==true)e=false;return this.exec("showInputLoading",{status:e})};t.clearInput=function(){return this.exec("clearInput")};t.hideInput=function(){return this.exec("hideInput")};t.reload=function(e){var e=e||{url:document.location.href};if(window.platform=="android"){this.exec("reload",e)}else{document.location.href=e.url}};t.flipScreen=function(){return this.exec("flipScreen")};t.removeButtons=function(e){return this.exec("removeButtons",e)};t.openBXTable=function(e){if(typeof e.table_settings!="undefined"){e.TABLE_SETTINGS=e.table_settings;delete e.table_settings}if(e.TABLE_SETTINGS.markmode&&e.TABLE_SETTINGS.markmode==true){if(e.TABLE_SETTINGS.callback&&typeof e.TABLE_SETTINGS.callback=="function"){var t=e.TABLE_SETTINGS.callback;e.TABLE_SETTINGS.callback=function(e){t(BitrixMobile.Utils.htmlspecialchars(e))}}}if(typeof e.TABLE_SETTINGS.modal!="undefined"){e.modal=e.TABLE_SETTINGS.modal}return this.exec("openBXTable",e)};t.openDocument=function(e){return this.exec("openDocument",e)};t.showPopupLoader=function(e){return this.exec("showPopupLoader",e)};t.hidePopupLoader=function(e){return this.exec("hidePopupLoader",e)};t.changeCurPageParams=function(e){return this.exec("changeCurPageParams",e)};t.getPageParams=function(e){if(!this.enableInVersion(3))return false;return this.exec("getPageParams",e)};t.menuCreate=function(e){return this.exec("menuCreate",e)};t.menuShow=function(){return this.exec("menuShow")};t.menuHide=function(){return this.exec("menuHide")};t.enableInVersion=function(e,t){if(this.apiVersion==0){try{if(typeof BXMobileAppContext!="undefined"&&typeof BXMobileAppContext.getApiVersion=="function"){this.apiVersion=BXMobileAppContext.getApiVersion()}else if(typeof appVersion!="undefined"){this.apiVersion=appVersion}}catch(i){}}return typeof t!="undefined"&&t==true?parseInt(this.apiVersion)==parseInt(e):parseInt(this.apiVersion)>=parseInt(e)};t.checkOpenStatus=function(e){return this.exec("checkOpenStatus",e)};t.asyncRequest=function(e){return this.exec("asyncRequest",e)};t.openUrl=function(e){return this.exec("openUrl",e)};t.RegisterCallBack=function(e){if(typeof e=="function"){this.callbackIndex++;this.callbacks["callback"+this.callbackIndex]=e;return this.callbackIndex}};t.CallBackExecute=function(e,t){if(this.callbacks["callback"+e]&&typeof this.callbacks["callback"+e]==="function"){this.callbacks["callback"+e](t)}};t.onCustomEvent=function(e,t,i,n){if(typeof n=="undefined"){n=true}if(!this.available){document.addEventListener("deviceready",BX.delegate(function(){this.onCustomEvent(e,t,i,n)},this),false);return}if(n)t=this.prepareParams(t);if(typeof t=="object")t=JSON.stringify(t);if(device.platform.toUpperCase()=="ANDROID"||device.cordova>"2.0.0"){var a={eventName:e,params:t};return Cordova.exec(null,null,"BitrixMobile","onCustomEvent",[a])}else{return Cordova.exec("BitrixMobile.onCustomEvent",e,t,i)}};t.getVar=function(e){return this.exec("getVar",e)};t.passVar=function(e,t){try{evalVar=window[e];if(!evalVar)evalVar="empty"}catch(i){evalVar=""}if(evalVar){if(typeof evalVar=="object")evalVar=JSON.stringify(evalVar);if(platform.toUpperCase()=="ANDROID"){t=t||false;if(t)Bitrix24Android.receiveStringValue(JSON.stringify({variable:evalVar,key:t}));else Bitrix24Android.receiveStringValue(evalVar)}else{return evalVar}}};t.takePhoto=function(e){if(!this.available){document.addEventListener("deviceready",BX.proxy(function(){this.takePhoto(e)},this),false);return}if(!e.callback)e.callback=function(){};if(!e.fail)e.fail=function(){};var t={quality:e.quality||(this.enableInVersion(2)?40:10),correctOrientation:e.correctOrientation||false,targetWidth:e.targetWidth||false,targetHeight:e.targetHeight||false,sourceType:typeof e.source!="undefined"?e.source:0,mediaType:typeof e.mediaType!="undefined"?e.mediaType:0,allowEdit:typeof e.allowEdit!="undefined"?e.allowEdit:false,saveToPhotoAlbum:typeof e.saveToPhotoAlbum!="undefined"?e.saveToPhotoAlbum:false};if(e.destinationType!==undefined)t.destinationType=e.destinationType;navigator.camera.getPicture(e.callback,e.fail,t)};t.openMenu=function(){return this.exec("openMenu")};t.showModalDialog=function(e){if(typeof e["cache"]=="undefined"){e["cache"]=false}return this.exec("showModalDialog",e)};t.closeModalDialog=function(e){return this.exec("closeModalDialog",e)};t.closeController=function(e){return this.exec("closeController",e)};t.addButtons=function(e){return this.exec("addButtons",e)};t.openContent=function(){return this.exec("openContent")};t.closeMenu=function(){return this.exec("closeMenu")};t.loadPage=function(e,t){if(this.enableInVersion(2)&&t){params={url:e,page_id:t};return this.exec("loadPage",params)}return this.exec("loadPage",e)};t.setPageID=function(e){return this.exec("setPageID",e)};t.openNewPage=function(e,t,i){if(this.enableInVersion(3)){var n={url:e,data:t,title:i};return this.exec("openNewPage",n)}else return this.exec("openNewPage",e)};t.loadMenu=function(e){return this.exec("loadMenu",e)};t.openTable=function(e){if(e.markmode&&e.markmode==true){if(e.callback&&typeof e.callback=="function"){if(!(e.skipSpecialChars&&e.skipSpecialChars===true)){var t=e.callback;e.callback=function(e){t(BitrixMobile.Utils.htmlspecialchars(e))}}}}return this.exec("openTable",e)};t.openUserList=function(e){return this.exec("openUserList",e)};t.addUserListButton=function(e){return this.exec("addUserListButton",e)};t.pullDown=function(e){return this.exec("pullDown",e)};t.pullDownLoadingStop=function(){return this.exec("pullDownLoadingStop")};t.enableScroll=function(e){var e=e||false;return this.exec("enableScroll",e)};t.enableCaptureKeyboard=function(e){var e=e||false;return this.exec("enableCaptureKeyboard",e)};t.enableLoadingScreen=function(e){var e=e||false;return this.exec("enableLoadingScreen",e)};t.showLoadingScreen=function(){return this.exec("showLoadingScreen")};t.hideLoadingScreen=function(){return this.exec("hideLoadingScreen")};t.visibleNavigationBar=function(e){var e=e||false;return this.exec("visibleNavigationBar",e)};t.visibleToolBar=function(e){var e=e||false;return this.exec("visibleToolBar",e)};t.enableSliderMenu=function(e){var e=e||false;return this.exec("enableSliderMenu",e)};t.enableRight=function(e){var e=e||false;return this.exec("enableRight",e)};t.setCounters=function(e){return this.exec("setCounters",e)};t.setBadge=function(e){return this.exec("setBadge",e)};t.refreshPanelPage=function(e){if(!e)e="";var t={page:e};return this.exec("refreshPanelPage",t)};t.setPanelPages=function(e){return this.exec("setPanelPages",e)};t.getToken=function(){var e="APPLE";if(platform!="ios")e="GOOGLE";var i={callback:function(i){BX.proxy(BX.ajax.post(t.dataBrigePath,{mobile_action:"save_device_token",device_name:typeof device.name=="undefined"?device.model:device.name,uuid:device.uuid,device_token:i,device_type:e,sessid:BX.bitrix_sessid()},function(e){}),this)}};return this.exec("getToken",i)};t.BasicAuth=function(e){e=e||{};var i=e.success&&typeof e.success=="function"?e.success:function(){};var n=e.failture&&typeof e.failture=="function"?e.failture:function(){};var a={check_url:e.check_url,success:function(e){if(typeof e!="object"){try{e=JSON.parse(e)}catch(n){e={status:"failed"}}}if(e.status=="success"&&e.sessid_md5){if(BX.message.bitrix_sessid!=e.sessid_md5){BX.message.bitrix_sessid=e.sessid_md5;t.onCustomEvent("onSessIdChanged",{sessid:e.sessid_md5})}}i(e)},failture:function(e){if(e.status=="failed")t.exec("showAuthForm");else n(e)}};return this.exec("BasicAuth",a)};t.logOut=function(){if(this.enableInVersion(2)){this.asyncRequest({url:this.dataBrigePath+"?mobile_action=logout&uuid="+device.uuid});return this.exec("showAuthForm")}var e=new XMLHttpRequest;e.open("GET",this.dataBrigePath+"?mobile_action=logout&uuid="+device.uuid,true);e.onreadystatechange=function(){if(e.readyState==4&&e.status=="200"){return t.exec("showAuthForm")}};e.send(null)};t.getCurrentLocation=function(e){if(!this.available){document.addEventListener("deviceready",BX.proxy(function(){this.getCurrentLocation(e)},this),false);return}var t;var i;if(e){t=e.onsuccess;i=e.onerror}navigator.geolocation.getCurrentPosition(t,i)};t.setVibrate=function(e){e=e||500;navigator.notification.vibrate(parseInt(e))};t.bindloadPageBlank=function(){document.addEventListener("DOMContentLoaded",function(){document.body.addEventListener("click",function(e){var t=null;var i="__bx_android_click_detect__";if(e.target.tagName.toUpperCase()=="A")t=e.target;else t=BX.findParent(e.target,{tagName:"A"},10);if(t&&t.href&&t.href.length>0){if(t.href.indexOf(i)==-1&&t.href.indexOf("javascript")!=0){if(t.href.indexOf("#")==-1)t.href+="#"+i;else t.href+="&"+i}}},false)},false)};BitrixMobile={};BitrixMobile.Utils={autoResizeForm:function(e,t,i){if(!e||!t)return;var n=e.parentNode;i=i||126;var a=(e.ownerDocument||document).defaultView.getComputedStyle(e,null).getPropertyValue("height");var o=(n.ownerDocument||document).defaultView.getComputedStyle(n,null).getPropertyValue("height");a=parseInt(a);o=parseInt(o);e.setAttribute("data-orig-height",a);n.setAttribute("data-orig-height",o);var r=a;var s=document.createElement("textarea");s.className="send-message-input";s.style.height=r+"px";s.style.visibility="hidden";s.style.position="absolute";s.style.left="-300px";document.body.appendChild(s);e.addEventListener("change",c,false);e.addEventListener("cut",l,false);e.addEventListener("paste",l,false);e.addEventListener("drop",l,false);e.addEventListener("keyup",c,false);if(window.platform=="android")e.addEventListener("keydown",l,false);function c(){s.value=e.value;var c=s.scrollHeight;if(c>i)c=i;if(r!=c){r=c;e.style.height=c+"px";n.style.height=o+(c-a)+"px";t.style.bottom=o+(c-a)+"px";if(window.platform=="android")window.scrollTo(0,document.documentElement.scrollHeight)}}function l(){setTimeout(c,0)}},resetAutoResize:function(e,t){if(!e||!t)return;var i=e.parentNode;var n=e.getAttribute("data-orig-height");var a=i.getAttribute("data-orig-height");e.style.height=n+"px";i.style.height=a+"px";t.style.bottom=a+"px"},showHiddenImages:function(){var e=document.getElementsByTagName("img");for(var t=0;t<e.length;t++){var i=e[t];var n=i.getAttribute("data-src");if(!n)continue;if(BitrixMobile.Utils.isElementVisibleOnScreen(i)){i.src=n;i.setAttribute("data-src","")}}},isElementVisibleOnScreen:function(e){var t=BitrixMobile.Utils.getElementCoords(e);var i=window.pageYOffset||document.documentElement.scrollTop;var n=i+document.documentElement.clientHeight;t.bottom=t.top+e.offsetHeight;var a=t.top>i&&t.top<n;var o=t.bottom<n&&t.bottom>i;return a||o},isElementVisibleOn2Screens:function(e){var t=BitrixMobile.Utils.getElementCoords(e);var i=document.documentElement.clientHeight;var n=window.pageYOffset||document.documentElement.scrollTop;var a=n+i;t.bottom=t.top+e.offsetHeight;n-=i;a+=i;var o=t.top>n&&t.top<a;var r=t.bottom<a&&t.bottom>n;return o||r},getElementCoords:function(e){var t=e.getBoundingClientRect();return{originTop:t.top,originLeft:t.left,top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}},htmlspecialchars:function(e){if(BX.type.isString(e))return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");if(BX.type.isArray(e)){for(var t=0;t<e.length;t++){e[t]=BitrixMobile.Utils.htmlspecialchars(e[t])}}else if(typeof e=="object"&&e!=null){var i={};for(var n in e)i[n]=BitrixMobile.Utils.htmlspecialchars(e[n]);e=i}return e}};BitrixMobile.fastClick={bindDelegate:function(e,t,i){if(typeof window.BX!="undefined"){var n=BX.delegateEvent(t,i);new FastButton(e,n,true)}else{document.addEventListener("DOMContentLoaded",function(){BitrixMobile.fastClick.bindDelegate(e,t,i)})}},bind:function(e,t){new FastButton(e,t,true)}};BitrixMobile.LazyLoad={images:[],status:{hidden:-2,error:-1,undefined:0,inited:1,loaded:2},types:{image:1,background:2},clearImages:function(){this.images=[]},showImages:function(e){e=e===false?false:true;for(var t=0,i=this.images.length;t<i;t++){var n=this.images[t];if(n.status==this.status.undefined){this._initImage(n)}if(n.status!==this.status.inited){continue}if(!n.node||!n.node.parentNode){n.node=null;n.status=BitrixMobile.LazyLoad.status.error;continue}var a=true;if(e&&n.func){a=n.func(n)}if(a===true&&BitrixMobile.Utils.isElementVisibleOn2Screens(n.node)){if(n.type==BitrixMobile.LazyLoad.types.image){n.node.src=n.src}else{n.node.style.backgroundImage="url('"+n.src+"')"}n.node.setAttribute("data-src","");n.status=this.status.loaded}}},registerImage:function(e,t){if(BX.type.isNotEmptyString(e)){this.images.push({id:e,node:null,src:null,type:null,func:BX.type.isFunction(t)?t:null,status:this.status.undefined})}},registerImages:function(e,t){if(BX.type.isArray(e)){for(var i=0,n=e.length;i<n;i++){this.registerImage(e[i],t)}}},_initImage:function(e){e.status=this.status.error;var t=BX(e.id);if(t){var i=t.getAttribute("data-src");if(BX.type.isNotEmptyString(i)){e.node=t;e.src=i;e.status=this.status.inited;e.type=e.node.tagName.toLowerCase()=="img"?BitrixMobile.LazyLoad.types.image:BitrixMobile.LazyLoad.types.background}}},getImageById:function(e){for(var t=0,i=this.images.length;t<i;t++){if(this.images[t].id==e){return this.images[t]}}return null},removeImage:function(e){for(var t=0,i=this.images.length;t<i;t++){if(this.images[t].id==e){this.images=BX.util.deleteFromArray(this.images,t);break}}},onScroll:function(){BitrixMobile.LazyLoad.showImages()}};window.BitrixAnimation={animate:function(e){if(!e||!e.start||!e.finish||typeof e.start!="object"||typeof e.finish!="object")return null;for(var t in e.start){if(!e.finish[t]){delete e.start[t]}}e.progress=function(e){var t={};for(var i in this.start)t[i]=Math.round(this.start[i]+(this.finish[i]-this.start[i])*e);if(this.step)this.step(t)};return BitrixAnimation.animateProgress(e)},animateProgress:function(e){var t=new Date;var i=e.transition||BitrixAnimation.transitions.linear;var n=e.duration||1e3;var a=setInterval(function(){var o=(new Date-t)/n;if(o>1)o=1;e.progress(i(o));if(o==1){clearInterval(a);e.complete&&e.complete()}},e.delay||13);return a},makeEaseInOut:function(e){return function(t){if(t<.5)return e(2*t)/2;else return(2-e(2*(1-t)))/2}},makeEaseOut:function(e){return function(t){return 1-e(1-t)}},transitions:{linear:function(e){return e},elastic:function(e){return Math.pow(2,10*(e-1))*Math.cos(20*Math.PI*1.5/3*e)},quad:function(e){return Math.pow(e,2)},cubic:function(e){return Math.pow(e,3)},quart:function(e){return Math.pow(e,4)},quint:function(e){return Math.pow(e,5)},circ:function(e){return 1-Math.sin(Math.acos(e))},back:function(e){return Math.pow(e,2)*((1.5+1)*e-1.5)},bounce:function(e){for(var t=0,i=1;1;t+=i,i/=2){if(e>=(7-4*t)/11){return-Math.pow((11-6*t-11*e)/4,2)+Math.pow(i,2)}}}}};document.addEventListener("DOMContentLoaded",function(){BX.addCustomEvent("onFrameDataReceived",function(e){if(e.lang)t.onCustomEvent("onServerLangReceived",e.lang)});BX.addCustomEvent("onServerLangReceived",function(e){if(e){for(var t in e){BX.message[t]=e[t]}}})},false);document.addEventListener("deviceready",function(){if(typeof BXMobileAppContext!="undefined"){BX.addCustomEvent("onAppPaused",function(){BXMobileAppContext.active=false});BX.addCustomEvent("UIApplicationDidBecomeActiveNotification",function(){BXMobileAppContext.active=true});BXMobileAppContext.isAppActive=function(){if(typeof this.active=="undefined"||!t.enableInVersion(16)){this.active=!BXMobileAppContext.isBackground()}return this.active}}t.available=true;BX.addCustomEvent("onSessIdChanged",function(e){BX.message.bitrix_sessid=e.sessid});BX.addCustomEvent("onPageParamsChangedLegacy",function(e){if(e.url!=location.pathname+location.search)return false;BXMobileApp.UI.Page.params.set({data:e.data});BX.onCustomEvent("onPageParamsChanged",[e.data]);return true})},false);MobileAjaxWrapper=function(){this.type=null;this.method=null;this.url=null;this.callback=null;this.failure_callback=null;this.progress_callback=null;this.offline=null;this.processData=null;this.xhr=null;this.data=null;this.headers=null};MobileAjaxWrapper.prototype.Init=function(e){if(e.type!="json")e.type="html";if(e.method!="POST")e.method="GET";if(e.processData=="undefined")e.processData=true;this.type=e.type;this.method=e.method;this.url=e.url;this.data=e.data;this.headers=typeof e.headers!="undefined"?e.headers:[];this.processData=e.processData;this.start=e.start;this.preparePost=e.preparePost;this.callback=e.callback;if(e.callback_failure!="undefined")this.failure_callback=e.callback_failure;if(e.callback_progress!="undefined")this.progress_callback=e.callback_progress;if(e.callback_loadstart!="undefined")this.loadstart_callback=e.callback_loadstart;if(e.callback_loadend!="undefined")this.loadend_callback=e.callback_loadend};MobileAjaxWrapper.prototype.Wrap=function(e){this.Init(e);this.xhr=BX.ajax({timeout:30,start:this.start,preparePost:this.preparePost,method:this.method,dataType:this.type,url:this.url,data:this.data,headers:this.headers,processData:this.processData,onsuccess:BX.defer(function(e){var t=false;if(this.xhr.status===0){t=true}else if(this.type=="json"){t=typeof e=="object"&&typeof e.status!="undefined"&&e.status=="failed"}else if(this.type=="html"){t=e=='{"status":"failed"}'}if(t){this.RepeatRequest()}else{this.callback(e)}},this),onfailure:BX.delegate(function(e,t){if(e!==undefined&&e=="status"&&t!==undefined&&t==401){this.RepeatRequest()}else{this.failure_callback()}},this)});if(this.progress_callback!=null)BX.bind(this.xhr,"progress",this.progress_callback);if(this.load_callback!=null)BX.bind(this.xhr,"load",this.load_callback);if(this.loadstart_callback!=null)BX.bind(this.xhr,"loadstart",this.loadstart_callback);if(this.loadend_callback!=null)BX.bind(this.xhr,"loadend",this.loadend_callback);if(this.error_callback!=null)BX.bind(this.xhr,"error",this.error_callback);if(this.abort_callback!=null)BX.bind(this.xhr,"abort",this.abort_callback);return this.xhr};MobileAjaxWrapper.prototype.RepeatRequest=function(){t.BasicAuth({success:BX.delegate(function(e){this.data.sessid=e.sessid_md5;this.xhr=BX.ajax({timeout:30,method:this.method,dataType:this.type,url:this.url,data:this.data,onsuccess:BX.delegate(function(e){if(this.xhr.status===0)var t=true;else if(this.type=="json"){var t=typeof e=="object"&&typeof e.status!="undefined"&&e.status=="failed"}else if(this.type=="html")var t=e=='{"status":"failed"}';if(t)this.failure_callback();else this.callback(e)},this),onfailure:BX.delegate(function(){this.failure_callback()},this)})},this),failture:BX.delegate(function(){this.failure_callback()},this)})};MobileAjaxWrapper.prototype.OfflineAlert=function(e){navigator.notification.alert(BX.message("MobileAppOfflineMessage"),e||BX.DoNothing,BX.message("MobileAppOfflineTitle"))};BMAjaxWrapper=new MobileAjaxWrapper;MobileNetworkStatus=function(){this.offline=null;var e=this;document.addEventListener("offline",function(){e.offline=true},false);document.addEventListener("online",function(){e.offline=false},false);document.addEventListener("DOMContentLoaded",function(){BX.addCustomEvent("UIApplicationDidBecomeActiveNotification",function(t){var i=navigator.network.connection.type;e.offline=i==Connection.UNKNOWN||i==Connection.NONE})},false)};BMNetworkStatus=new MobileNetworkStatus})();(function(){function e(e,t,i,n){if(e.addEventListener){e.addEventListener(t,i,n);return{destroy:function(){e.removeEventListener(t,i,n)}}}else{var a=function(e){i.handleEvent(window.event,i)};e.attachEvent("on"+t,a);return{destroy:function(){e.detachEvent("on"+t,a)}}}}var t=true;this.FastButton=function(i,n,a){this.events=[];this.touchEvents=[];this.element=i;this.handler=n;this.useCapture=a;if(t)this.events.push(e(i,"touchstart",this,this.useCapture));this.events.push(e(i,"click",this,this.useCapture))};this.FastButton.prototype.destroy=function(){for(i=this.events.length-1;i>=0;i-=1)this.events[i].destroy();this.events=this.touchEvents=this.element=this.handler=this.fastButton=null};this.FastButton.prototype.handleEvent=function(e){switch(e.type){case"touchstart":this.onTouchStart(e);break;case"touchmove":this.onTouchMove(e);break;case"touchend":this.onClick(e);break;case"click":this.onClick(e);break}};this.FastButton.prototype.onTouchStart=function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=true;this.touchEvents.push(e(this.element,"touchend",this,this.useCapture));this.touchEvents.push(e(document.body,"touchmove",this,this.useCapture));this.startX=t.touches[0].clientX;this.startY=t.touches[0].clientY};this.FastButton.prototype.onTouchMove=function(e){if(Math.abs(e.touches[0].clientX-this.startX)>10||Math.abs(e.touches[0].clientY-this.startY)>10){this.reset()}};this.FastButton.prototype.onClick=function(e){this.reset();var t=this.handler.call(this.element,e);if(t!==null){e.preventDefault();e.stopPropagation?e.stopPropagation():e.cancelBubble=true}if(e.type=="touchend")clickbuster.preventGhostClick(this.startX,this.startY);return t};this.FastButton.prototype.reset=function(){for(i=this.touchEvents.length-1;i>=0;i-=1)this.touchEvents[i].destroy();this.touchEvents=[]};this.clickbuster=function(){};this.clickbuster.preventGhostClick=function(e,t){clickbuster.coordinates.push(e,t);window.setTimeout(clickbuster.pop,2500)};this.clickbuster.pop=function(){clickbuster.coordinates.splice(0,2)};this.clickbuster.onClick=function(e){for(var t=0;t<clickbuster.coordinates.length;t+=2){
var i=clickbuster.coordinates[t];var n=clickbuster.coordinates[t+1];if(Math.abs(e.clientX-i)<25&&Math.abs(e.clientY-n)<25){e.stopPropagation?e.stopPropagation():e.cancelBubble=true;e.preventDefault?e.preventDefault():e.returnValue=false}}};if(t){document.addEventListener("click",clickbuster.onClick,true);clickbuster.coordinates=[]}})(this);function ReadyDevice(e){if(app.available==true&&typeof e=="function"){e()}else{document.addEventListener("deviceready",e,false)}}
//# sourceMappingURL=bitrix_mobile.map.js