File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/js/im/component/settings/call-background/dist/call-background.bundle.min.js
Back
this.BX=this.BX||{};(function(t,e,i,s,a,o,n,r,l,d,u){"use strict"; /** * Bitrix Messenger * File element Vue component * * @package bitrix * @subpackage im * @copyright 2001-2021 Bitrix */var c={props:{selected:{type:Boolean,default:false},item:{type:Object,default:{}}},mounted:function t(){this.createProgressbar()},beforeDestroy:function t(){this.removeProgressbar()},methods:{createProgressbar:function t(){var e=this;if(this.uploader){return true}if(!this.item.state){return true}if(this.item.state.progress===100){return false}this.uploader=new d.Uploader({container:this.$refs.container,labels:{loading:this.localize["BX_IM_COMPONENT_SETTINGS_CALL_BG_FILE_UPLOAD_LOADING"],completed:this.localize["BX_IM_COMPONENT_SETTINGS_CALL_BG_FILE_UPLOAD_COMPLETED"],canceled:this.localize["BX_IM_COMPONENT_SETTINGS_CALL_BG_FILE_UPLOAD_CANCELED"],cancelTitle:this.localize["BX_IM_COMPONENT_SETTINGS_CALL_BG_FILE_UPLOAD_CANCEL_TITLE"],megabyte:this.localize["BX_IM_COMPONENT_SETTINGS_CALL_BG_FILE_SIZE_MB"]},cancelCallback:this.item.state.progress<0?null:function(t){e.$emit("cancel",{item:e.item,event:t})},destroyCallback:function t(){if(e.uploader){e.uploader=null}}});this.uploader.start();if(this.item.state.size&&this.item.state.size/1024/1024<=2||this.$refs.container.offsetHeight<=54&&this.$refs.container.offsetWidth<240){this.uploader.setProgressTitleVisibility(false)}this.updateProgressbar();return true},updateProgressbar:function t(){if(!this.uploader){var e=this.createProgressbar();if(!e){return false}}if(this.item.state.status===u.FileStatus.error){this.uploader.setProgress(0);this.uploader.setCancelDisable(false);this.uploader.setIcon(d.Uploader.icon.error);this.uploader.setProgressTitle(this.localize["BX_IM_COMPONENT_SETTINGS_CALL_BG_FILE_UPLOAD_ERROR"])}else if(this.item.state.status===u.FileStatus.wait){this.uploader.setProgress(this.item.state.progress>5?this.item.state.progress:5);this.uploader.setCancelDisable(true);this.uploader.setIcon(d.Uploader.icon.cloud);this.uploader.setProgressTitle(this.localize["BX_IM_COMPONENT_SETTINGS_CALL_BG_FILE_UPLOAD_SAVING"])}else if(this.item.state.progress===100){this.uploader.setProgress(100)}else if(this.item.state.progress===-1){this.uploader.setProgress(10);this.uploader.setProgressTitle(this.localize["BX_IM_COMPONENT_SETTINGS_CALL_BG_FILE_UPLOAD_WAITING"])}else{if(this.item.state.progress===0){this.uploader.setIcon(d.Uploader.icon.cancel)}var i=this.item.state.progress>5?this.item.state.progress:5;this.uploader.setProgress(i);if(this.item.state.size/1024/1024<=2){this.uploader.setProgressTitle(this.localize["BX_IM_COMPONENT_SETTINGS_CALL_BG_FILE_UPLOAD_LOADING"])}else{this.uploader.setByteSent(this.item.state.size/100*this.item.state.progress,this.item.state.size)}}},removeProgressbar:function t(){if(!this.uploader){return true}this.uploader.destroy(false);return true}},computed:{uploadProgress:function t(){if(!this.item.state){return""}return this.item.state.status+" "+this.item.state.progress},localize:function t(){return l.BitrixVue.getFilteredPhrases("BX_IM_COMPONENT_SETTINGS_CALL_BG_",this)}},watch:{uploadProgress:function t(){this.updateProgressbar()}},template:'\n\t\t<div :key="item.id" @click="$emit(\'select\')" :class="[\'bx-im-settings-video-background-dialog-item\', {\'bx-im-settings-video-background-dialog-item-selected\': selected, \'bx-im-settings-video-background-dialog-item-unsupported\': !item.isSupported , \'bx-im-settings-video-background-dialog-item-loading\': item.isLoading }]" ref="container">\n\t\t\t<div class="bx-im-settings-video-background-dialog-item-image" :style="{backgroundImage: item.preview? \'url(\'+item.preview+\')\': \'\'}"></div>\n\t\t\t<div v-if="item.isSupported && item.isVideo" class="bx-im-settings-video-background-dialog-item-video"></div>\n\t\t\t<div v-if="!item.isLoading" class="bx-im-settings-video-background-dialog-item-title">\n\t\t\t\t<span class="bx-im-settings-video-background-dialog-item-title-text">{{item.title}}</span>\n\t\t\t\t<div v-if="item.canRemove" class="bx-im-settings-video-background-dialog-item-remove" :title="localize.BX_IM_COMPONENT_SETTINGS_CALL_BG_REMOVE" @click="$emit(\'remove\')"></div>\n\t\t\t</div>\n\t\t</div>\n\t'};var g=Object.freeze({none:"none",upload:"upload",blur:"blur",gaussianBlur:"gaussianBlur"});var p=Object.freeze({blur:"call_blur_background",image:"call_background"});l.BitrixVue.component("bx-im-component-settings-call-background",{props:{isDesktop:{type:Boolean,default:false},width:{default:0},height:{default:450}},data:function t(){return{actions:[],standard:[],custom:[],selected:"",ActionType:g,loading:true,diskFolderId:0}},components:{"bx-im-component-settings-call-background-item":c},created:function t(){var i=this;this.defaultValue=this.isDesktop?window.BX.desktop.getBackgroundImage():{id:g.none,background:""};this.selected=this.defaultValue.id;this.limit={};a.rest.callMethod("im.v2.call.background.get").then((function(t){i.loading=false;i.diskFolderId=t.data().upload.folderId;t.data().backgrounds["default"].forEach((function(t){t.isVideo=t.id.includes(":video");t.isCustom=false;t.canRemove=false;t.isSupported=true;i.standard.push(t)}));t.data().backgrounds.custom.forEach((function(t){t.isCustom=true;t.canRemove=true;if(t.isSupported){t.title=e.Loc.getMessage("BX_IM_COMPONENT_SETTINGS_CALL_BG_CUSTOM")}else{t.title=e.Loc.getMessage("BX_IM_COMPONENT_SETTINGS_CALL_BG_UNSUPPORTED")}i.custom.push(t)}));t.data().limits.forEach((function(t){i.limit[t.id]=t}));if(i.diskFolderId){i.actions=i.actions.map((function(t){t.isSupported=true;return t}))}else{i.actions=i.actions.filter((function(t){return t.id!==g.upload}))}if(!window.BX.UI.InfoHelper.isInited()){window.BX.UI.InfoHelper.init({frameUrlTemplate:t.data().infoHelperParams.frameUrlTemplate})}if(i.isDesktop){window.BX.desktop.hideLoader()}}))["catch"]((function(){i.loading=false}));this.actions.push({id:g.none,title:e.Loc.getMessage("BX_IM_COMPONENT_SETTINGS_CALL_BG_ACTION_NONE"),background:g.none});this.actions.push({id:g.upload,title:e.Loc.getMessage("BX_IM_COMPONENT_SETTINGS_CALL_BG_ACTION_UPLOAD")});this.actions.push({id:g.gaussianBlur,title:e.Loc.getMessage("BX_IM_COMPONENT_SETTINGS_CALL_BG_ACTION_BLUR"),background:g.gaussianBlur});this.actions.push({id:g.blur,title:e.Loc.getMessage("BX_IM_COMPONENT_SETTINGS_CALL_BG_ACTION_BLUR_MAX"),background:g.blur})},mounted:function t(){var s=this;this.uploader=new i.Uploader({inputNode:this.$refs.uploadInput,generatePreview:true,fileMaxSize:100*1024*1024});this.uploader.subscribe("onFileMaxSizeExceeded",(function(t){var i=t.getData();var s=i.file;BX.UI.Notification.Center.notify({content:e.Loc.getMessage("BX_IM_COMPONENT_SETTINGS_CALL_BG_FILE_SIZE_EXCEEDED").replace("#LIMIT#",100).replace("#FILE_NAME#",s.name),autoHideDelay:5e3})}));this.uploader.subscribe("onSelectFile",(function(t){var i=t.getData();var a=i.file;if(!s.isAllowedType(a.type)||!i.previewData){BX.UI.Notification.Center.notify({content:e.Loc.getMessage("BX_IM_COMPONENT_SETTINGS_CALL_BG_UNSUPPORTED_FILE").replace("#FILE_NAME#",a.name),autoHideDelay:5e3});return false}s.uploader.addTask({taskId:"custom:".concat(Date.now()),chunkSize:1024*1024,fileData:a,fileName:a.name,diskFolderId:s.diskFolderId,generateUniqueName:true,previewBlob:i.previewData})}));this.uploader.subscribe("onStartUpload",(function(t){var i=t.getData();var a=URL.createObjectURL(i.previewData);s.custom.unshift({id:i.id,background:a,preview:a,title:e.Loc.getMessage("BX_IM_COMPONENT_SETTINGS_CALL_BG_CUSTOM"),isVideo:i.file.type.startsWith("video"),isCustom:true,canRemove:false,isSupported:true,isLoading:true,state:{progress:0,status:u.FileStatus.upload,size:i.file.size}})}));this.uploader.subscribe("onProgress",(function(t){var e=t.getData();var i=s.custom.find((function(t){return t.id===e.id}));if(!i){return}i.state.progress=e.progress}));this.uploader.subscribe("onComplete",(function(t){var e=t.getData();var i=s.custom.find((function(t){return t.id===e.id}));if(!i){return}i.id=e.result.data.file.id;if(i.isVideo){i.background=e.result.data.file.links.download}i.isLoading=false;i.canRemove=true;s.select(i);a.rest.callMethod("im.v2.call.background.commit",{fileId:i.id})}));this.uploader.subscribe("onUploadFileError",(function(t){var e=t.getData();var i=s.custom.find((function(t){return t.id===e.id}));if(!i){return}i.state.status=u.FileStatus.error;i.state.progress=0}));this.uploader.subscribe("onCreateFileError",(function(t){var e=t.getData();var i=s.custom.find((function(t){return t.id===e.id}));if(!i){return}i.state.status=u.FileStatus.error;i.state.progress=0}))},computed:{isMaskAvailable:function t(){if(window.BX.getClass("BX.desktop")){return window.BX.desktop.getApiVersion()>=72}else if(window.BX.getClass("BX.Messenger.Lib.Utils.platform")){return window.BX.Messenger.Lib.Utils.platform.getDesktopVersion()>=72}},containerSize:function t(){var e={};if(this.isDesktop){e.height="calc(100vh - 79px)"}else{e.height=this.height+"px"}if(this.width>0){e.width=this.width+"px"}return e},backgrounds:function t(){return[].concat(this.custom).concat(this.standard)},uploadTypes:function t(){if(s.Utils.platform.isBitrixDesktop()){return""}return".png, .jpg, .jpeg, .avi, .mp4"}},methods:{hasLimit:function t(e){if(e===g.none){return true}if([g.blur,g.gaussianBlur].includes(e)){if(this.limit[p.blur]&&this.limit[p.blur].active&&this.limit[p.blur].articleCode&&window.BX.UI.InfoHelper){window.BX.UI.InfoHelper.show(this.limit[p.blur].articleCode);return false}return true}if(this.limit[p.image]&&this.limit[p.image].active&&this.limit[p.image].articleCode&&window.BX.UI.InfoHelper){window.BX.UI.InfoHelper.show(this.limit[p.image].articleCode);return false}return true},select:function t(e){if(!this.hasLimit(e.id)){return false}if(!e.isSupported||e.isLoading){return false}if(e.id===g.upload){this.$refs.uploadInput.click();return false}this.selected=e.id;if(this.isDesktop){window.BX.desktop.setCallBackground(e.id,e.background)}return true},remove:function t(i){if(i.id===this.selected){this.selected=g.none;if(this.isDesktop){window.BX.desktop.setCallBackground(g.none,g.none)}}if(i.isLoading){this.uploader.deleteTask(i.id)}else{e.ajax.runAction("disk.api.file.delete",{data:{fileId:i.id}})}this.custom=this.custom.filter((function(t){return t.id!==i.id}));return true},save:function t(){window.close()},cancel:function t(){if(this.defaultValue.id===this.selected){window.close();return true}if(this.isDesktop){window.BX.desktop.setCallBackground(this.defaultValue.id,this.defaultValue.background).then((function(){window.close()}))}else{window.close()}return true},isAllowedType:function t(e){return["image/png","image/jpeg","video/avi","video/mp4","video/quicktime"].includes(e)}},template:'\n\t\t<div class="bx-im-settings-video-background-dialog">\n\t\t\t<div class="bx-im-settings-video-background-dialog-inner" :style="containerSize">\n\t\t\t\t<div class="bx-im-settings-video-background-dialog-container">\n\t\t\t\t\t<div class="bx-im-settings-video-background-upload-input"><input type="file" :accept="uploadTypes" ref="uploadInput"/></div>\n\t\t\t\t\t<template v-if="loading">\n\t\t\t\t\t\t<div class="bx-im-settings-video-background-dialog-loader">\n\t\t\t\t\t\t\t<svg class="bx-desktop-loader-circular" viewBox="25 25 50 50">\n\t\t\t\t\t\t\t\t<circle class="bx-desktop-loader-path" cx="50" cy="50" r="20" fill="none" stroke-miterlimit="10"/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</template>\n\t\t\t\t\t<template v-else>\n\t\t\t\t\t\t<div class="bx-im-settings-video-background-dialog-content">\n\t\t\t\t\t\t<template v-for="(element in actions">\n\t\t\t\t\t\t\t<div :key="element.id" @click="select(element)" :class="[\'bx-im-settings-video-background-dialog-item\', \'bx-im-settings-video-background-dialog-action\', \'bx-im-settings-video-background-dialog-action-\'+element.id, {\'bx-im-settings-video-background-dialog-item-selected\': selected === element.id }]">\n\t\t\t\t\t\t\t\t<div class="bx-im-settings-video-background-dialog-action-title">{{element.title}}</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t<template v-for="(item in backgrounds">\n\t\t\t\t\t\t\t<bx-im-component-settings-call-background-item \n\t\t\t\t\t\t\t\t:key="item.id" \n\t\t\t\t\t\t\t\t:item="item" \n\t\t\t\t\t\t\t\t:selected="selected === item.id" \n\t\t\t\t\t\t\t\t@select="select(item)" \n\t\t\t\t\t\t\t\t@cancel="remove(item)"\n\t\t\t\t\t\t\t\t@remove="remove(item)"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</template>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="ui-btn-container ui-btn-container-center">\n\t\t\t\t<button :class="[\'ui-btn\', \'ui-btn-success\', {\'ui-btn-wait ui-btn-disabled\': loading}]" @click="save">{{$Bitrix.Loc.getMessage(\'BX_IM_COMPONENT_SETTINGS_CALL_BG_SAVE\')}}</button>\n\t\t\t\t<button class="ui-btn ui-btn-link" @click="cancel">{{$Bitrix.Loc.getMessage(\'BX_IM_COMPONENT_SETTINGS_CALL_BG_CANCEL\')}}</button>\n\t\t\t</div>\n\t\t</div>\n\t'})})(this.BX.Messenger=this.BX.Messenger||{},BX,BX.Messenger.Lib,BX.Messenger.Lib,BX,BX,BX,BX,BX,BX.ProgressBarJs,BX.Messenger.Const); //# sourceMappingURL=call-background.bundle.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.25 |
proxy
|
phpinfo
|
Settings