Your IP : 3.144.85.61


Current Path : /home/bitrix/ext_www/coffe.land/bitrix/js/rest/
Upload File :
Current File : /home/bitrix/ext_www/coffe.land/bitrix/js/rest/marketplace.min.js

BX.namespace("BX.rest.Marketplace");BX.rest.Marketplace=function(){var e="/bitrix/tools/rest.php";var t=function(t,n,o){n.action=t;n.sessid=BX.bitrix_sessid();BX.ajax({dataType:"json",method:"POST",url:e,data:n,onsuccess:o,onfailure:function(e,t){o({error:e+(!!t?": "+t:"")})}})};return{install:function(e){e=e||{url:location.href};var n=false;var o=BX.PopupWindowManager.create("BXAppInstallPopup|"+e.url,null,{autoHide:false,zIndex:0,offsetLeft:0,offsetTop:0,overlay:true,draggable:{restrict:true},closeByEsc:true,closeIcon:{right:"12px",top:"10px"},buttons:[button=new BX.PopupWindowButton({text:BX.message("REST_MP_APP_INSTALL"),className:"popup-window-button-accept",events:{click:function(){if(!n){return}if(BX("mp_detail_license")&&!BX("mp_detail_license").checked||BX("mp_detail_confidentiality")&&!BX("mp_detail_confidentiality").checked){BX("mp_detail_error").innerHTML=BX.message("MARKETPLACE_LICENSE_ERROR");return}if(BX.hasClass(button.buttonNode,"popup-window-button-wait")){return}var o=document.forms["left-menu-preset-form"];BX.addClass(button.buttonNode,"popup-window-button-wait");var i={code:e.CODE};if(!!e.VERSION){i.version=e.VERSION}if(!!e.CHECK_HASH){i.check_hash=e.CHECK_HASH;i.install_hash=e.INSTALL_HASH}t("install",i,BX.delegate(function(t){if(!!t.error){BX("mp_error").innerHTML=t.error+(!!t.error_description?"<br /><br />"+t.error_description:"");BX.show(BX("mp_error"))}else if(!e.IFRAME){if(!!t.redirect){top.location.href=t.redirect}else{top.location.href=BX.util.remove_url_param(top.location.href,["install"])}}else{if(t.installed){var n={};top.BX.onCustomEvent(top,"Rest:AppLayout:ApplicationInstall",[true,n],false)}if(!!t.open){BX.SidePanel.Instance.close(false,function(){top.BX.rest.AppLayout.openApplication(t.id,{})})}else{location.reload()}}},this))}}}),new BX.PopupWindowButtonLink({text:BX.message("REST_MP_APP_INSTALL_CANCEL"),className:"popup-window-button-link-cancel",events:{click:function(){this.popupWindow.close()}}})],content:'<div style="width:450px;height:230px; background: url(/bitrix/js/rest/images/loader.gif) no-repeat center;"></div>',events:{onAfterPopupShow:function(){BX.ajax.post(e.url||location.href,{install:1,sessid:BX.bitrix_sessid()},BX.delegate(function(e){n=true;this.setContent(e);BX.defer(this.adjustPosition,this)()},this))}}});o.show()},uninstallConfirm:function(e){var t=BX.PopupWindowManager.create("mp_delete_confirm_popup",null,{content:'<div class="mp_delete_confirm"><div class="mp_delete_confirm_text">'+BX.message("REST_MP_DELETE_CONFIRM")+'</div><div class="mp_delete_confirm_cb"><input type="checkbox" name="delete_data" id="delete_data">&nbsp;<label for="delete_data">'+BX.message("REST_MP_DELETE_CONFIRM_CLEAN")+"</label></div></div>",closeByEsc:true,closeIcon:{top:"1px",right:"10px"},buttons:[new BX.PopupWindowButton({text:BX.message("REST_MP_APP_DELETE"),className:"popup-window-button-decline",events:{click:function(){BX.rest.Marketplace.uninstall(e,BX("delete_data").checked,BX.delegate(this.popupWindow.close,this.popupWindow))}}}),new BX.PopupWindowButtonLink({text:BX.message("JS_CORE_WINDOW_CANCEL"),className:"popup-window-button-link-cancel",events:{click:function(){this.popupWindow.close()}}})]});t.show()},uninstall:function(e,n,o){t("uninstall",{code:e,clean:n},function(e){var t={};top.BX.onCustomEvent(top,"Rest:AppLayout:ApplicationInstall",[false,t],false);if(!!o){o()}if(!!e.error){alert(e.error)}else{location.reload()}})},reinstall:function(e,n){t("reinstall",{id:e},function(e){if(!!e.error){alert(e.error)}else if(!!e.redirect){BX.reload(e.redirect)}else{alert(BX.message("REST_MP_APP_REINSTALLED"))}if(!!n){n()}})},buy:function(e,t){var n=[];for(var o=0;o<t.length;o++){n.push({text:t[o].TEXT,href:t[o].LINK,target:"_blank",className:"menu-popup-no-icon"})}BX.PopupMenu.show("user-menu",e,n,{offsetTop:9,offsetLeft:43,angle:true})},setRights:function(e,n){BX.Access.Init({other:{disabled:false,disabled_g2:true,disabled_cr:true},groups:{disabled:true},socnetgroups:{disabled:true}});var o={app_id:e};if(!!n){o.site_id=n}t("get_app_rigths",o,function(o){BX.Access.SetSelected(o,"bind");BX.Access.ShowForm({bind:"bind",showSelected:true,callback:function(o){var i={app_id:e,rights:o};if(!!n){i.site_id=n}t("set_app_rights",i,function(e){})}})})},open:function(e,t){if(!t){t="all"}var n="/bitrix/components/bitrix/rest.marketplace/lazyload.ajax.php";if(!!e&&!!e.PLACEMENT){n=BX.util.add_url_param(n,{placement:e.PLACEMENT,category:t})}else{n=BX.util.add_url_param(n,{category:t})}BX.SidePanel.Instance.open(n,{cacheable:false,allowChangeHistory:false,requestMethod:"post",requestParams:{sessid:BX.bitrix_sessid()}});var o=BX.SidePanel.Instance.getTopSlider();top.BX.addCustomEvent(top,"Rest:AppLayout:ApplicationInstall",function(e,t){t.redirect=false})},bindPageAnchors:function(e){BX.ready(function(){BX.SidePanel.Instance.bindAnchors(top.BX.clone({rules:[{condition:["/marketplace/detail/","/bitrix/components/bitrix/rest.marketplace/lazyload.ajax.php"],options:{cacheable:false,allowChangeHistory:e.allowChangeHistory}}]}))})}}}();