Файловый менеджер - Редактировать - /var/www/axolotl/data/www/axolotls.ru/www/bitrix/js/landing/ui/field/link_field.min.js
Назад
(function(){"use strict";BX.namespace("BX.Landing.UI.Field");var e=BX.Landing.Utils.trim;var t=BX.Landing.Utils.clone;var i=BX.Landing.Utils.isPlainObject;var n=BX.Landing.Utils.decodeDataValue;var a=BX.Landing.Utils.fireCustomEvent;var s=BX.Landing.Utils.htmlToElement;var d=BX.Landing.Utils.style;var l=BX.Landing.Utils.escapeText;BX.Landing.UI.Field.Link=function(n){BX.Landing.UI.Field.BaseField.apply(this,arguments);this.options=n.options||{};BX.remove(this.input);this.onValueChangeHandler=n.onValueChange?n.onValueChange:function(){};this.content=i(this.content)?this.content:{};this.content=t(this.content);this.content.text=e(this.content.text);this.content.href=e(l(this.content.href));this.content.target=e(l(this.content.target));this.skipContent=n.skipContent;this.customUrlDisabled=n.disableCustomURL;this.detailPageMode=n.detailPageMode===true;if(!this.containsImage()&&!this.containsHtml()){this.content.text=l(this.content.text)}this.input=new BX.Landing.UI.Field.Text({placeholder:BX.Landing.Loc.getMessage("FIELD_LINK_TEXT_LABEL"),selector:this.selector,content:this.content.text,textOnly:true,onValueChange:function(){this.onValueChangeHandler(this);var e=this.hrefInput.getValue();if(e==="#landing0"){var t=this.input.getValue();var i=this.hrefInput.input.firstElementChild;if(i){var n=i.querySelector(".landing-ui-field-url-placeholder-text");n.innerText=BX.Text.decode(t.replace(/ /g," "))}}var a=new BX.Event.BaseEvent({data:{value:this.getValue()},compatData:[this.getValue()]});this.emit("change",a)}.bind(this)});if(this.skipContent){this.input.layout.hidden=true;this.header.hidden=true}this.hrefInput=new BX.Landing.UI.Field.LinkURL({title:BX.Landing.Loc.getMessage("FIELD_LINK_HREF_LABEL"),placeholder:BX.Landing.Loc.getMessage("FIELD_LINK_HREF_PLACEHOLDER"),selector:this.selector,content:this.content.href,onInput:this.onHrefInput.bind(this),textOnly:true,options:this.options,disallowType:n.disallowType,disableBlocks:n.disableBlocks,disableCustomURL:n.disableCustomURL,allowedTypes:n.allowedTypes,detailPageMode:n.detailPageMode===true,sourceField:n.sourceField,onValueChange:function(){this.onValueChangeHandler(this);this.onHrefValueChange();var e=new BX.Event.BaseEvent({data:{value:this.getValue()},compatData:[this.getValue()]});this.emit("change",e)}.bind(this),onNewPage:function(){var e=this.input.getValue();var t=this.hrefInput.input.firstElementChild;if(t){var i=t.querySelector(".landing-ui-field-url-placeholder-text");i.innerHTML=e.replace(/ /g," ")}}.bind(this)});this.targetInput=new BX.Landing.UI.Field.DropdownInline({title:BX.Landing.Loc.getMessage("FIELD_LINK_TARGET_LABEL"),selector:this.selector,className:"landing-ui-field-dropdown-inline",content:this.content.target,items:{_self:BX.Landing.Loc.getMessage("FIELD_LINK_TARGET_SELF"),_blank:BX.Landing.Loc.getMessage("FIELD_LINK_TARGET_BLANK"),_popup:BX.Landing.Loc.getMessage("FIELD_LINK_TARGET_POPUP")},onValueChange:function(){this.onValueChangeHandler(this);var e=new BX.Event.BaseEvent({data:{value:this.getValue()},compatData:[this.getValue()]});this.emit("change",e)}.bind(this)});this.mediaButton=new BX.Landing.UI.Button.BaseButton(this.selector+"_media",{html:'<span class="fa fa-bolt"></span> '+BX.Landing.Loc.getMessage("LANDING_CONTENT_URL_MEDIA_BUTTON"),className:"landing-ui-field-link-media",onClick:this.onMediaClick.bind(this),disabled:true});this.mediaLayout=BX.create("div",{props:{className:"landing-ui-field-link-media-layout"}});this.mediaHelpButton=new BX.Landing.UI.Button.BaseButton(this.selector+"_media_qa",{html:'<span class="fa fa-question-circle"></span> ',className:"landing-ui-field-link-media-help"});this.mediaHelpButton.layout.addEventListener("mouseover",this.onMediaHelpButtonMouseover.bind(this));this.mediaHelpButton.layout.addEventListener("mouseout",this.onMediaHelpButtonMouseout.bind(this));if(this.containsImage()||this.containsHtml()){this.input.layout.hidden=true;this.header.hidden=true;this.hrefInput.header.innerHTML=this.header.innerHTML}this.wrapper=BX.Landing.UI.Field.Link.createWrapper();this.left=BX.Landing.UI.Field.Link.createLeft();this.center=BX.Landing.UI.Field.Link.createCenter();this.right=BX.Landing.UI.Field.Link.createRight();this.left.appendChild(this.input.layout);this.center.appendChild(this.hrefInput.layout);this.right.appendChild(this.targetInput.layout);this.right.appendChild(this.mediaButton.layout);this.right.appendChild(this.mediaHelpButton.layout);this.wrapper.appendChild(this.left);this.wrapper.appendChild(this.center);this.wrapper.appendChild(this.right);this.layout.appendChild(this.wrapper);this.layout.appendChild(this.mediaLayout);this.layout.classList.add("landing-ui-field-link");if(!this.customUrlDisabled){this.adjustVideo()}if(this.content.target==="_popup"){this.adjustVideo()}this.adjustEditLink();this.adjustTarget()};BX.Landing.UI.Field.Link.createWrapper=function(){return BX.create("div",{props:{className:"landing-ui-field-link-wrapper"}})};BX.Landing.UI.Field.Link.createCenter=function(){return BX.create("div",{props:{className:"landing-ui-field-link-center"}})};BX.Landing.UI.Field.Link.createLeft=function(){return BX.create("div",{props:{className:"landing-ui-field-link-left"}})};BX.Landing.UI.Field.Link.createRight=function(){return BX.create("div",{props:{className:"landing-ui-field-link-right"}})};BX.Landing.UI.Field.Link.prototype={constructor:BX.Landing.UI.Field.Link,__proto__:BX.Landing.UI.Field.BaseField.prototype,superClass:BX.Landing.UI.Field.BaseField,onHrefValueChange:function(){},adjustEditLink:function(){var e=this.hrefInput.getPlaceholderType();var t=BX.Landing.Env.getInstance().getType();if(e==="PAGE"&&t!=="KNOWLEDGE"&&t!=="GROUP"){var i=this.hrefInput.getValue();if(BX.type.isString(i)&&i.length>0){this.hrefInput.getPageData(i).then(function(e){var t=BX.Landing.Main.getInstance().options.params.sef_url.landing_view;var i=t.replace("#site_show#",e.siteId).replace("#landing_edit#",e.id);[].slice.call(this.layout.querySelectorAll(".landing-ui-field-edit-link")).forEach(BX.remove);this.editLink=this.createEditLink(BX.Landing.Loc.getMessage("LANDING_LINK_FILED__EDIT_PAGE_LINK_LABEL"),i);this.layout.appendChild(this.editLink)}.bind(this))}}},createEditLink:function(e,t){return BX.create("div",{props:{className:"landing-ui-field-edit-link"},children:[BX.create("a",{attrs:{href:t,target:"_blank",title:BX.Landing.Loc.getMessage("LANDING_LINK_FILED__EDIT_LINK_TITLE")},text:e})]})},isChanged:function(){return JSON.stringify(this.content)!==JSON.stringify(this.getValue())},containsImage:function(){return!!BX.create("div",{html:this.content.text}).querySelector("img")},containsHtml:function(){var e=s(this.content.text);return!!e&&!e.matches("br")},getValue:function(){var t=this.input.getValue().replace(/ /g," ");var a={text:n(e(t)),href:e(this.hrefInput.getValue()),target:e(this.targetInput.getValue())};if(this.isAvailableMedia()&&this.isEnabledMedia()){a.attrs={"data-url":e(this.mediaService.getEmbedURL())}}if(this.hrefInput.getDynamic()){if(!i(a.attrs)){a.attrs={}}if(this.hrefInput.input.firstElementChild){a.attrs["data-url"]=this.hrefInput.input.firstElementChild.getAttribute("data-url")}a.attrs["data-dynamic"]=this.hrefInput.getDynamic()}if(this.skipContent){delete a["text"]}return a},setValue:function(e){if(i(e)){this.input.setValue(l(e.text));this.hrefInput.setValue(e.href);this.targetInput.setValue(l(e.target))}this.adjustEditLink();this.adjustTarget()},adjustTarget:function(){if(!this.isAvailableMedia()){var e=BX.Landing.Env.getInstance().getType();var t=this.getValue();if(e==="KNOWLEDGE"||e==="GROUP"){this.targetInput.disable();if(/^#(\w+)([0-9])$/.test(t.href)){this.targetInput.setValue("_self")}else{this.targetInput.setValue("_blank")}}}},reset:function(){this.setValue({text:"",href:"",target:"_self"})},enableMedia:function(){this.mediaButton.enable();this.targetInput.disable();this.targetInput.closePopup();this.targetInput.setValue("_popup");this.showMediaPreview()},disableMedia:function(){if(this.isEnabledMedia()){this.mediaButton.disable();this.targetInput.enable();this.targetInput.closePopup();this.targetInput.setValue("_self");this.hideMediaPreview();this.hideMediaSettings()}},isEnabledMedia:function(){return this.mediaButton.isEnabled()},showMediaSettings:function(){if(this.isAvailableMedia()){this.hideMediaSettings();this.mediaSettings=this.mediaService.getSettingsForm();if(this.mediaSettings){this.mediaLayout.appendChild(this.mediaSettings.layout)}}},hideMediaSettings:function(){if(this.mediaSettings){BX.remove(this.mediaSettings.layout)}},isAvailableMedia:function(){var e=new BX.Landing.MediaService.Factory;return!!e.create(this.hrefInput.getValue())},onMediaClick:function(){if(this.isAvailableMedia()){if(!this.isEnabledMedia()){if(!this.mediaService){this.adjustVideo()}else{this.enableMedia()}}else{this.disableMedia()}}},onMediaHelpButtonMouseover:function(e){BX.Landing.UI.Tool.Suggest.getInstance().show(this.mediaHelpButton.layout,{description:BX.create("div",{props:{className:"landing-ui-field-link-media-help-popup-content"},children:[BX.create("div",{props:{className:"landing-ui-field-link-media-help-popup-content-title"},html:BX.Landing.Loc.getMessage("LANDING_CONTENT_URL_MEDIA_HELP_TITLE")}),BX.create("div",{props:{className:"landing-ui-field-link-media-help-popup-content-content"},html:BX.Landing.Loc.getMessage("LANDING_CONTENT_URL_MEDIA_HELP")})]}).outerHTML,angleOffset:53})},onMediaHelpButtonMouseout:function(){BX.Landing.UI.Tool.Suggest.getInstance().hide()},onVideoPreviewClick:function(){$.fancybox.open({src:this.mediaService.getEmbedURL(),type:"iframe",afterShow:function(e,t){var i=t.$slide.find("iframe")[0];void BX.Landing.MediaPlayer.Factory.create(i)}},{iframe:{scrolling:"auto"}})},showMediaPreview:function(){var e=new BX.Loader({target:this.mediaLayout,mode:"inline",offset:{top:"calc(50% - 55px)",left:"calc(50% - 55px)"}});this.video=e.layout;e.show();this.mediaService.getURLPreviewElement().then(function(e){BX.remove(this.video);this.video=e;this.video.title=BX.Landing.Loc.getMessage("LANDING_CONTENT_URL_PREVIEW_TITLE");this.mediaLayout.appendChild(this.video);this.video.addEventListener("click",this.onVideoPreviewClick.bind(this));this.showMediaSettings()}.bind(this),function(){this.hideMediaSettings();BX.remove(this.video)}.bind(this))},hideMediaPreview:function(){if(this.video){BX.remove(this.video)}},adjustVideo:function(){var e=BX.Landing.Env.getInstance().getType();if(e!=="KNOWLEDGE"&&e!=="GROUP"){var t="attrs"in this.content&&"data-url"in this.content.attrs?this.content.attrs["data-url"]:"";var i=new BX.Landing.MediaService.Factory;this.mediaService=i.create(this.hrefInput.getValue(),BX.Landing.Utils.getQueryParams(t));if(this.mediaService){this.mediaService.url=this.hrefInput.getValue();this.disableMedia();if(this.isAvailableMedia()){this.enableMedia()}}else{this.disableMedia()}}},onHrefInput:function(){if(!this.customUrlDisabled){this.adjustVideo()}this.adjustEditLink();this.adjustTarget()}}})(); //# sourceMappingURL=link_field.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.8 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка