Your IP : 3.143.205.184


Current Path : /home/bitrix/ext_www/crm.klimatlend.ua/bitrix/js/disk/document/
Upload File :
Current File : /home/bitrix/ext_www/crm.klimatlend.ua/bitrix/js/disk/document/local.min.js

(function(){"use strict";BX.namespace("BX.Disk.Document");BX.Disk.Document.Local=function(e){this.secondsToWaitDesktop=17;this.fallbacks={};this.disableLocalEdit=false;this.bindEvents()};BX.Disk.Document.Local.prototype={bindEvents:function(){BX.addCustomEvent("BX.UI.Viewer.Controller:onItemError",this.handleViewerItemError.bind(this));BX.addCustomEvent("BX.UI.Viewer.Controller:onAfterProcessItemError",this.handleAfterViewerItemError.bind(this));BX.addCustomEvent("onPullEvent-disk",this.handlePullEvent.bind(this));BX.addCustomEvent("onPullClientEvent-disk",this.handlePullEvent.bind(this))},handleAfterViewerItemError:function(e,t,i){if(t.idViewFileLink){BX.bind(BX(t.idViewFileLink),"click",function(e){e.preventDefault();this.viewFile({url:i.src,name:i.getTitle()})}.bind(this))}},handleViewerItemError:function(e,t,i){if(!this.isSetWorkWithLocalBDisk()){return}var n="runLocal"+(Math.floor(Math.random()*1e4)+1);t.message=BX.message("JS_DISK_DOC_TRY_TO_OPEN_BY_LOCAL_PROGRAM_TITLE").replace("#ID#",n);t.description=BX.message("JS_DISK_DOC_TRY_TO_OPEN_BY_LOCAL_PROGRAM_OR_DOWNLOAD").replace("#DOWNLOAD_LINK#",i.getSrc());t.idViewFileLink=n},handlePullEvent:function(e,t){console.log("handlePullEvent or handleClientEvent",e,t);if(e==="bdisk"&&t.uidRequest){this.stopWaiting(t.uidRequest)}},isSetWorkWithLocalBDisk:function(){return BX.Disk.getDocumentService()==="l"&&this.isEnabled()},disable:function(){this.disableLocalEdit=true},isEnabled:function(){if(this.disableLocalEdit){return false}return true},editFile:function(e){console.log("editFile",e);e=this.prepareParametersToWorkWithFile(e);this.goToBx("v2openFile",{objectId:e.objectId,url:e.url,name:e.name})},createFile:function(e){var t=new BX.Promise;var i="/bitrix/tools/disk/document.php";i=BX.util.add_url_param(i,{service:"l",type:e.type,document_action:"publishBlank",primaryAction:"publishBlank",action:""});BX.Disk.ajaxPromise({method:"POST",dataType:"json",url:i,data:{targetFolderId:e.targetFolderId||""}}).then(function(e){if(!e||e.status!=="success"){t.reject({status:"error"});return}t.fulfill(e);this.editFile({objectId:e.object.id,url:e.link,name:e.object.name})}.bind(this));return t},viewFile:function(e){console.log("viewFile",e);e=this.prepareParametersToWorkWithFile(e);this.goToBx("v2viewFile",{objectId:e.objectId,url:e.url,name:e.name})},prepareParametersToWorkWithFile:function(e){if(!e.objectId&&!e.attachedObjectId&&!e.url){return}e.name=e.name||"Unknown document";e.objectId=e.objectId||0;e.attachedObjectId=e.attachedObjectId||0;var t=e.url;if(!t){t=e.objectId?"/bitrix/tools/disk/document.php":"/bitrix/tools/disk/uf.php";t=BX.util.add_url_param(t,{objectId:e.objectId,attachedId:e.attachedObjectId,service:"l",document_action:"download",primaryAction:"download",action:""})}if(t.substring(0,1)==="/"){t=(window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""))+t}e.url=t;return e},goToBx:function(e,t){var i="bx://"+e;t=BX.type.isPlainObject(t)?t:{};t.uidRequest=BX.util.getRandomString(16);if(BX.type.isPlainObject(t)){for(var n in t){if(!t.hasOwnProperty(n)){continue}i+="/"+n+"/"+encodeURIComponent(t[n])}}console.log("runningCheck to go to bx",i);top.BX.desktopUtils.runningCheck(function(){console.log("Ok, there is running desktop");top.BX.desktopUtils.goToBx(i)},function(){console.log("Oh no, try to run desktop");this.registerFallback(t.uidRequest);top.BX.desktopUtils.goToBx(i)}.bind(this))},registerFallback:function(e){top.BX.loadExt("disk").then(function(){var t=BX.getClass("BX.SidePanel.Instance")&&BX.SidePanel.Instance.isOpen()?BX.SidePanel.Instance.getTopSlider().getZindex():null;if(BX.getClass("BX.UI.Viewer.Instance")&&BX.UI.Viewer.Instance.getZindex()>t){t=BX.UI.Viewer.Instance.getZindex()}top.BX.Disk.showLoader({text:BX.message("JS_DISK_DOC_WAITING_FOR_BITRIX24_DESKTOP"),zIndex:t});var i=setTimeout(function(){top.BX.Disk.hideLoader();var e=new BX.PopupWindow("b24-desktop",null,{titleBar:BX.message("JS_DISK_DOC_WAITING_FOR_BITRIX24_DESKTOP_TITLE"),content:BX.message("JS_DISK_DOC_WAITING_FOR_BITRIX24_DESKTOP_DESCR"),closeIcon:true,closeByEsc:true,width:500,zIndex:t,overlay:{backgroundColor:"rgba(0,0,0,0.5)"},buttons:[new BX.PopupWindowCustomButton({text:BX.message("JS_DISK_DOC_WAITING_FOR_BITRIX24_DESKTOP_DOWNLOAD"),className:"ui-btn ui-btn-primary",events:{click:function(e){document.location.href=BX.browser.IsMac()?"http://dl.bitrix24.com/b24/bitrix24_desktop.dmg":"http://dl.bitrix24.com/b24/bitrix24_desktop.exe"}}}),new BX.PopupWindowCustomButton({text:BX.message("JS_DISK_DOC_WAITING_FOR_BITRIX24_DESKTOP_HELP"),className:"ui-btn ui-btn-link",events:{click:function(t){if(top.BX.Helper)top.BX.Helper.show("redirect=detail&code=8626407");e.destroy()}}})]});e.show()}.bind(this),this.secondsToWaitDesktop*1e3);this.fallbacks[e]={timeoutId:i}}.bind(this))},stopWaiting:function(e){if(BX.getClass("top.BX.Disk")){top.BX.Disk.hideLoader()}if(this.fallbacks.hasOwnProperty(e)){clearTimeout(this.fallbacks[e].timeoutId);delete this.fallbacks[e]}}};var e=null;Object.defineProperty(BX.Disk.Document.Local,"Instance",{enumerable:false,get:function(){if(e===null){e=new BX.Disk.Document.Local({})}return e}});BX.Disk.Document.Local.Instance.isEnabled()})();
//# sourceMappingURL=local.map.js