Your IP : 18.222.45.122


Current Path : /home/bitrix/ext_www/coffe.land/bitrix/js/mobileapp/
Upload File :
Current File : /home/bitrix/ext_www/coffe.land/bitrix/js/mobileapp/mobile_lib.min.js

(function(){if(window.BXMobileApp)return;var syncApiObject=function(objectName){this.objectName=objectName;try{this.object=eval(objectName)}catch(e){this.object=null}};syncApiObject.prototype.getFunc=function(e){if(typeof this.object!="undefined"&&this.object!=null){var t=this;return function(){return function(){if(typeof t.object[e]=="function"){var a=t.object[e].apply(t.object,arguments);if(BXMobileAppContext.getPlatform()=="android"){if(typeof a=="string"){var i=null;try{i=JSON.parse(a);a=i}catch(o){}}}return a}else{console.error(t.objectName+" error: function '"+e+"' not found");return false}}.apply(t,arguments)}}return function(){console.error("Mobile Sync API: "+this.objectName+" is not defined",this)}};var _pageNavigator=new syncApiObject("BXMobileNavigator");window.BXMobileApp={eventAddLog:{},debug:true,supportNativeEvents:function(){return false;return app.enableInVersion(17)},apiVersion:typeof appVersion!="undefined"?appVersion:1,cordovaVersion:"3.6.3",UI:{IOS:{flip:function(){app.flipScreen()}},Slider:{state:{CENTER:0,LEFT:1,RIGHT:2},setState:function(e){switch(e){case this.state.CENTER:app.openContent();break;case this.state.LEFT:app.openLeft();break;case this.state.RIGHT:app.exec("openRight");break;default:}},setStateEnabled:function(e,t){switch(e){case this.state.LEFT:app.enableSliderMenu(t);break;case this.state.RIGHT:app.exec("enableRight",t);break;default:}}},Photo:{show:function(e){app.openPhotos(e)}},Document:{showCacheList:function(e){app.showDocumentsCache(e)},open:function(e){app.openDocument(e)}},DatePicker:{setParams:function(e){if(typeof e=="object")this.params=e},show:function(e){this.setParams(e);app.showDatePicker(this.params)},hide:function(){app.hideDatePicker()}},SelectPicker:{show:function(e){app.showSelectPicker(e)},hide:function(){app.hideSelectPicker()}},BarCodeScanner:{open:function(e){app.openBarCodeScanner(e)}},NotifyPanel:{setNotificationNumber:function(e){app.setCounters({notifications:e})},setMessagesNumber:function(e){app.setCounters({messages:e})},setCounters:function(e){app.setCounters(e)},refreshPage:function(e){app.refreshPanelPage(e)},setPages:function(e){app.setPanelPages(e)}},Badge:{setIconBadge:function(e){app.exec("setBadge",e)},setButtonBadge:function(e,t){app.exec("setButtonBadge",{code:e,value:t})}},types:{COMMON:0,BUTTON:1,PANEL:2,TABLE:3,MENU:4,ACTION_SHEET:5,NOTIFY_BAR:6},parentTypes:{TOP_BAR:0,BOTTOM_BAR:1,SLIDING_PANEL:2,UNKNOWN:3}},PushManager:{getLastNotification:new syncApiObject("BXMobileAppContext").getFunc("getLastNotification"),prepareParams:function(e){if(typeof e!="object"||typeof e.params=="undefined"){return{ACTION:"NONE"}}var t={};try{t=JSON.parse(e.params)}catch(a){t={ACTION:e.params}}return t}},PageManager:{loadPageBlank:function(e){app.loadPageBlank(e)},loadPageUnique:function(e){if(typeof e!="object")return false;e.unique=true;app.loadPageBlank(e);if(typeof e.data=="object"){BXMobileApp.onCustomEvent("onPageParamsChangedLegacy",{url:e.url,data:e.data},true,true)}return true},loadPageStart:function(e){app.loadPageStart(e)},loadPageModal:function(e){app.showModalDialog(e)},createPage:function(e){return new function t(e){this.pageData=e;this.getData=function(){return this.pageData.data};this.go=function(){BXMobileApp.PageManager.goToPageWithUniqueCode(this.pageData.uniqueCode)};this.getListeners=function(){return this.pageData.listeners}}(e)},getAllPages:function(){var e=[];var t=_pageNavigator.getFunc("getAllPages")();for(var a=0;a<t.length;a++){e.push(this.createPage(t[a]))}return e},getCurrent:function(){var e=_pageNavigator.getFunc("getCurrent")();if(e){return this.createPage(e)}return null},getPrevious:function(){var e=_pageNavigator.getFunc("getPrevious")();if(e){return this.createPage(e)}return null},goToFirst:_pageNavigator.getFunc("goToFirst"),goBack:_pageNavigator.getFunc("goBack"),goToPageWithId:_pageNavigator.getFunc("goToPageWithId"),goToPageWithUniqueCode:_pageNavigator.getFunc("goToPageWithUniqueCode"),isFirst:_pageNavigator.getFunc("isFirst"),isLast:_pageNavigator.getFunc("isLast"),isVisible:_pageNavigator.getFunc("isVisible")},TOOLS:{extend:function(e,t){var a=function(){};a.prototype=t.prototype;e.prototype=new a;e.prototype.constructor=e;e.superclass=t.prototype;if(t.prototype.constructor==Object.prototype.constructor){t.prototype.constructor=t}},merge:function(e,t){for(var a in e){if(typeof t[a]!="undefined"){e[a]=t[a]}}return e}},Events:{subscribe:function(e){app.exec("subscribeEvent",{eventName:e})},unsubscribe:function(e){app.exec("unsubscribeEvent",{eventName:e})},post:function(e,t){if(app.enableInVersion(17)){if(typeof t=="object")t=JSON.stringify(t);app.exec("fireEvent",{eventName:e,params:t},false);return true}return false},addEventListener:function(e,t,a){BXMobileApp.addCustomEvent(e,t,a)}},onCustomEvent:function(e,t,a,i){var o=true;if(this.supportNativeEvents()&&a){o=false;BXMobileApp.Events.post(e,t);if(i){BX.onCustomEvent(e,BX.type.isArray(t)?t:[t])}}else{app.onCustomEvent(e,t,false,false)}if(BXMobileApp.debug)console.log("Fire event"+(o?" (old)":""),e,location.href)},addCustomEvent:function(e,t,a){if(BX.type.isString(e)){a=t;t=e;e=window}if(BXMobileApp.debug){if(typeof BXMobileApp.eventAddLog[t]=="undefined"){BXMobileApp.eventAddLog[t]=[]}BXMobileApp.eventAddLog[t].push(function i(){var t={};if(Error&&Error["captureStackTrace"]){Error.captureStackTrace(t,i);return{stack:t.stack,eventObject:e,listener:a}}return{eventObject:e,listener:a}}());BX.addCustomEvent(t,function(){console.log("Event has been caught",t)})}BXMobileApp.Events.subscribe(t);BX.addCustomEvent(e,t,a)}};BXMobileApp.UI.Element=function(e,t){this.id=typeof e=="undefined"?this.type+"_"+Math.random():e;this.parentId=t.parentId?t.parentId:BXMobileApp.UI.UNKNOWN;this.isCreated=false;this.isShown=false};BXMobileApp.UI.Element.prototype.onCreate=function(){this.isCreated=true;if(this.isShown){app.exec("show",{type:this.type,id:this.id})}};BXMobileApp.UI.Element.prototype.getIdentifiers=function(){return{id:this.id,type:this.type,parentId:this.parentId}};BXMobileApp.UI.Element.prototype.show=function(){this.isShown=true;if(this.isCreated){app.exec("show",{type:this.type,id:this.id})}};BXMobileApp.UI.Element.prototype.hide=function(){this.isShown=false;app.exec("hide",{type:this.type,id:this.id})};BXMobileApp.UI.Element.prototype.destroy=function(){};BXMobileApp.UI.Button=function(e,t){this.params=t;BXMobileApp.UI.Button.superclass.constructor.apply(this,[e,t])};BXMobileApp.TOOLS.extend(BXMobileApp.UI.Button,BXMobileApp.UI.Element);BXMobileApp.UI.Button.prototype.setBadge=function(e){if(this.params.badgeCode){BXMobileApp.UI.Badge.setButtonBadge(this.params.badgeCode,e)}};BXMobileApp.UI.Button.prototype.remove=function(){app.removeButtons(this.params)};BXMobileApp.UI.Menu=function(e,t){this.items=e.items;this.type=BXMobileApp.UI.types.MENU;BXMobileApp.UI.Menu.superclass.constructor.apply(this,[t,e]);app.menuCreate({items:this.items,useNavigationBarColor:e["useNavigationBarColor"]})};BXMobileApp.TOOLS.extend(BXMobileApp.UI.Menu,BXMobileApp.UI.Element);BXMobileApp.UI.Menu.prototype.show=function(){app.menuShow()};BXMobileApp.UI.Menu.prototype.hide=function(){app.menuHide()};BXMobileApp.UI.NotificationBar=function(e,t){this.params=BXMobileApp.TOOLS.merge(e,{});this.type=BXMobileApp.UI.types.NOTIFY_BAR;BXMobileApp.UI.NotificationBar.superclass.constructor.apply(this,[t,e]);var a=this.params;a["id"]=this.id;a["onCreate"]=BX.proxy(function(e){this.onCreate(e)},this);app.exec("notificationBar",{action:"add",params:a})};BXMobileApp.TOOLS.extend(BXMobileApp.UI.NotificationBar,BXMobileApp.UI.Element);BXMobileApp.UI.NotificationBar.prototype.onCreate=function(e){this.isCreated=true;if(this.isShown){app.exec("notificationBar",{action:"show",params:this.params})}};BXMobileApp.UI.NotificationBar.prototype.show=function(){if(this.isCreated){app.exec("notificationBar",{action:"show",params:this.params})}this.isShown=true};BXMobileApp.UI.NotificationBar.prototype.hide=function(){if(this.isShown){app.exec("notificationBar",{action:"hide",params:this.params})}this.isShown=false};BXMobileApp.UI.ActionSheet=function(e,t){this.items=e.buttons;this.title=e.title?e.title:"";this.type=BXMobileApp.UI.types.ACTION_SHEET;BXMobileApp.UI.ActionSheet.superclass.constructor.apply(this,[t,e]);app.exec("createActionSheet",{onCreate:BX.proxy(function(e){this.onCreate(e)},this),id:this.id,title:this.title,buttons:this.items})};BXMobileApp.TOOLS.extend(BXMobileApp.UI.ActionSheet,BXMobileApp.UI.Element);BXMobileApp.UI.ActionSheet.prototype.show=function(){if(this.isCreated){app.exec("showActionSheet",{id:this.id})}this.isShown=true};BXMobileApp.UI.ActionSheet.prototype.onCreate=function(e){this.isCreated=true;if(this.isShown){app.exec("showActionSheet",{id:this.id})}};BXMobileApp.UI.Table=function(e,t){this.params={table_id:t,url:e.url||"",isroot:false,TABLE_SETTINGS:{callback:function(){},markmode:false,modal:false,multiple:false,okname:"OK",cancelname:"Cancel",showtitle:false,alphabet_index:false,selected:{},button:{}}};this.params.table_settings=this.params.TABLE_SETTINGS;this.params=BXMobileApp.TOOLS.merge(this.params,e);this.params.type=BXMobileApp.UI.types.TABLE;BXMobileApp.UI.Table.superclass.constructor.apply(this,[t,e])};BXMobileApp.TOOLS.extend(BXMobileApp.UI.Table,BXMobileApp.UI.Element);BXMobileApp.UI.Table.prototype.show=function(){app.openBXTable(this.params)};BXMobileApp.UI.Table.prototype.useCache=function(e){this.params.TABLE_SETTINGS.cache=e||false};BXMobileApp.UI.Table.prototype.useAlphabet=function(e){this.params.TABLE_SETTINGS.alphabet_index=e||false};BXMobileApp.UI.Table.prototype.setModal=function(e){this.params.TABLE_SETTINGS.modal=e||false};BXMobileApp.UI.Table.prototype.clearCache=function(){return app.exec("removeTableCache",{table_id:this.id})};BXMobileApp.UI.Page={isVisible:function(e){app.exec("checkOpenStatus",e)},reload:function(){app.reload()},reloadUnique:function(){BXMobileApp.UI.Page.params.get({callback:function(e){BX.localStorage.set("mobileReloadPageData",{url:location.pathname+location.search,data:e});app.reload()}})},close:function(e){app.closeController(e)},captureKeyboardEvents:function(e){app.enableCaptureKeyboard(!(typeof e=="boolean"&&e===false))},setId:function(e){app.setPageID(e)},getTitle:function(){return this.TopBar.title},params:{set:function(e){app.changeCurPageParams(e)},get:function(e){var t=BX.localStorage.get("mobileReloadPageData");if(t&&t.url==location.pathname+location.search&&e.callback){BX.localStorage.remove("mobileReloadPageData");e.callback(t.data)}else{app.getPageParams(e)}}},TopBar:{show:function(){app.visibleNavigationBar(true)},hide:function(){app.visibleNavigationBar(false)},setColors:function(e){app.exec("setTopBarColors",e)},addRightButton:function(e){app.addButtons({rightButton:e})},updateButtons:function(e){this.buttons=e;app.addButtons(e)},title:{params:{imageUrl:"",text:"",detailText:"",callback:""},timeout:0,isAboutToShow:false,show:function(){this.isAboutToShow=this.timeout>0;if(!this.isAboutToShow){clearTimeout(this.showTitleTimeout);this.showTitleTimeout=setTimeout(function(){app.titleAction("show")},300)}},hide:function(){app.titleAction("hide")},setImage:function(e){this.params.imageUrl=e;this.redraw()},setText:function(e){this.params.text=e;this.redraw()},setDetailText:function(e){this.params.detailText=e;this.redraw()},setCallback:function(e){this.params.callback=e;this.redraw()},redraw:function(){if(this.timeout>0)clearTimeout(this.timeout);this.timeout=setTimeout(BX.proxy(this._applyParams,this),200)},_applyParams:function(){app.titleAction("setParams",this.params);this.timeout=0;if(this.isAboutToShow)this.show()}}},SlidingPanel:{buttons:{},hide:function(){app.hideButtonPanel()},show:function(e){app.showSlidingPanel(e)},addButton:function(e){},removeButton:function(e){}},Refresh:{params:{enable:false,callback:false,pulltext:"Pull to refresh",downtext:"Release to refresh",loadtext:"Loading...",timeout:"60"},setParams:function(e){this.params.pulltext=e.pullText?e.pullText:this.params.pulltext;this.params.downtext=e.releaseText?e.releaseText:this.params.downtext;this.params.loadtext=e.loadText?e.loadText:this.params.loadtext;this.params.callback=e.callback?e.callback:this.params.callback;this.params.enable=typeof e.enabled=="boolean"?e.enabled:this.params.enable;this.params.timeout=e.timeout?e.timeout:this.params.timeout;app.pullDown(this.params)},setEnabled:function(e){this.params.enable=typeof e=="boolean"?e:this.params.enable;app.pullDown(this.params)},start:function(){app.exec("pullDownLoadingStart")},stop:function(){app.exec("pullDownLoadingStop")}},BottomBar:{buttons:{},show:function(){},hide:function(){},addButton:function(e){}},PopupLoader:{show:function(e){app.exec("showPopupLoader",{text:e})},hide:function(){app.exec("hidePopupLoader")}},LoadingScreen:{show:function(){app.showLoadingScreen()},hide:function(){app.hideLoadingScreen()},setEnabled:function(e){app.enableLoadingScreen(!(typeof e=="boolean"&&e===false))}},TextPanel:{defaultParams:{placeholder:"Text here...",button_name:"Send",mentionDataSource:{},action:function(){},smileButton:{},plusAction:"",callback:"-1",useImageButton:true},params:{},isAboutToShow:false,temporaryParams:{},timeout:0,setParams:function(e){if(typeof e=="undefined"&&this.params=={}){this.params=this.defaultParams}else{this.params=e}if(this.isAboutToShow){this.redraw()}},show:function(e){if(typeof e=="object"&&e!=null){this.setParams(e)}else if(this.params=={}){this.params=this.defaultParams}var t=this.getParams();if(!this.isAboutToShow){for(var a in this.temporaryParams){t[a]=this.temporaryParams[a]}this.temporaryParams={}}if(BXMobileApp.apiVersion>=10){clearTimeout(this.showTimeout);this.showTimeout=setTimeout(function(){app.textPanelAction("show",t)},100)}else{delete t["text"];app.showInput(t)}this.isAboutToShow=true},hide:function(){if(BXMobileApp.apiVersion>=10)app.textPanelAction("hide");else app.hideInput()},focus:function(){if(BXMobileApp.apiVersion>=10)app.textPanelAction("focus",this.getParams())},clear:function(){if(BXMobileApp.apiVersion>=10)app.textPanelAction("clear",this.getParams());else app.clearInput()},setUseImageButton:function(e){this.params["useImageButton"]=!(typeof e=="boolean"&&e===false);this.redraw()},setAction:function(e){this.params["action"]=e;this.redraw()},setText:function(e){if(!this.isAboutToShow){this.temporaryParams["text"]=e}else{var t=app.clone(this.params,true);t["text"]=e;app.textPanelAction("setParams",t)}},getText:function(e){app.textPanelAction("getText",{callback:e})},showLoading:function(e){app.showInputLoading(e)},getParams:function(){var e={};for(var t in this.params){e[t]=this.params[t]}return e},redraw:function(){if(this.timeout>0)clearTimeout(this.timeout);this.timeout=setTimeout(BX.proxy(this._applyParams,this),100)},_applyParams:function(){app.textPanelAction("setParams",this.params);this.timeout=0;if(this.isAboutToShow)this.show()}},Scroll:{setEnabled:function(e){app.enableScroll(e)}}};window.BXMPage=BXMobileApp.UI.Page;window.BXMSlider=BXMobileApp.UI.Slider;window.BXMUI=BXMobileApp.UI;window.BXMPager=BXMobileApp.PageManager})();
//# sourceMappingURL=mobile_lib.map.js