File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/components/bitrix/landing.site_edit/templates/.default/landing-forms.min.js
Back
(function(){"use strict";BX.namespace("BX.Landing");const e=BX.Landing.Utils.slice;const t=BX.Landing.Utils.proxy;const i=BX.Landing.Utils.bind;const n=BX.Landing.Utils.addClass;const o=BX.Landing.Utils.removeClass;const s=BX.Landing.Utils.isNumber;const l=BX.Landing.Utils.data;const a=BX.Landing.Utils.onTransitionEnd;BX.Landing.EditTitleForm=function(e,t,i,n){this.btn=e.querySelector(".ui-title-input-btn-js");this.label=e.querySelector(".landing-editable-field-label-js");this.input=e.querySelector(".landing-editable-field-input-js");this.additionalWidth=t||0;this.input.IsWidthSet=false;this.display=n;this.hideInput=this.hideInput.bind(this);this.showInput=this.showInput.bind(this);if(i){BX.bind(e,"click",this.showInput)}else{BX.bind(this.btn,"click",this.showInput)}this.input.setAttribute("data-height",this.label.offsetHeight)};BX.Landing.EditTitleForm.prototype={showInput:function(e){e.stopPropagation();if(!this.input.IsWidthSet){this.input.style.width=this.label.offsetWidth+this.additionalWidth+17+"px"}if(this.input.tagName==="TEXTAREA"){this.input.style.height=this.input.getAttribute("data-height")+"px"}this.label.style.display="none";this.btn.style.display="none";this.input.style.display="block";this.input.focus();if(!BX.Dom.hasClass(this.input,"landing-editable-field-input-js-init")){this.input.selectionStart=this.input.value.length;BX.Dom.addClass(this.input,"landing-editable-field-input-js-init")}this.input.IsWidthSet=true;BX.bind(document,"mousedown",this.hideInput)},hideInput:function(e){if(e.target===this.input)return;this.label.textContent=this.input.value;if(this.display){this.label.style.display="inline-block"}else{this.label.style.display="inline"}this.input.style.display="none";this.btn.style.display="inline-block";this.input.IsWidthSet=false;this.input.setAttribute("data-height",this.label.offsetHeight);BX.unbind(document,"mousedown",this.hideInput)}};BX.Landing.FieldLengthLimited=function(e){e.forEach((function(e){BX.bind(e.field,"keyup",(function(){if(e.length){if(e.field.value.length<=e.length){e.node.textContent=e.field.value}else{e.node.textContent=e.field.value.substring(0,e.length)}}else{e.node.textContent=e.field.value}}))}))};BX.Landing.Favicon=function(){const e=BX("landing-form-favicon-change");const t=BX("landing-form-favicon-input");const i=BX("landing-form-favicon-value");const n=BX("landing-form-favicon-form");const o=BX("landing-form-favicon-src");const s=BX("landing-form-favicon-error");if(!n||!t||!e){return}BX.bind(e,"click",(function(e){BX.fireEvent(t,"click");BX.PreventDefault(e)}));BX.bind(t,"change",(function(e){BX.ajax.submitAjax(n,{method:"POST",dataType:"json",onsuccess:function(e){if(e.type==="success"&&typeof e.result!=="undefined"&&e.result!==false){i.value=e.result.id;o.setAttribute("src",e.result.src)}else{s.style.color="red"}}});BX.PreventDefault(e)}))};BX.Landing.Custom404And503=function(e,t){BX.bind(e,"change",(e=>{if(e.currentTarget.value===""){t.checked=false;t.click()}else{t.checked=true}}));BX.addCustomEvent("BX.UI.LayoutForm:onToggle",(i=>{if(i.getData().checkbox&&i.getData().checkbox===t){if(!i.getData().checkbox.checked){e.value=""}}}))};BX.Landing.Copyright=function(e,t){BX.bind(t,"change",(function(){let t=e.getAttribute("action");t=t.replace(/&feature_copyright=[YN]/,"");t+="&feature_copyright="+(this.checked?"Y":"N");e.setAttribute("action",t)}))};BX.Landing.Access=function(e){BX.Landing.Access.selected=e.selected;this.table=e.table;const t="RIGHTS";const i=e.form;const n=e.select;let o=e.inc;BX.Access.Init({other:{disabled_cr:true}});BX.Access.SetSelected(BX.Landing.Access.selected,t);function s(){BX.Access.ShowForm({callback:e=>{for(let i in e){if(e.hasOwnProperty(i)){for(let s in e[i]){if(e[i].hasOwnProperty(s)){let l=this.table.rows.length;let a=this.table.insertRow(l-1);a.classList.add("landing-form-rights");BX.Landing.Access.selected[s]=true;a.insertCell(-1);a.insertCell(-1);a.cells[0].innerHTML=BX.Access.GetProviderName(i)+" "+BX.util.htmlspecialchars(e[i][s].name)+":"+'<input type="hidden" name="fields['+t+"][ACCESS_CODE]["+o+']" value="'+s+'">';a.cells[0].classList.add("landing-form-rights-right");a.cells[1].classList.add("landing-form-rights-left");a.cells[1].innerHTML=n.replace("#inc#",o)+' <a href="javascript:void(0);" onclick="BX.Landing.Access.onRowDelete(this);"'+' data-id="'+s+'" class="landing-form-rights-delete"></a>';o++}}}}},bind:t})}i.addEventListener("click",s.bind(this))};BX.Landing.Access.selected=[];BX.Landing.Access.onRowDelete=function(e){BX.Landing.Access.selected[BX.data(BX(e),"id")]=false;BX.remove(BX.findParent(BX(e),{tag:"tr"},true))};BX.Landing.Layout=function(e){this.params=e;this.params.messages=this.params.messages||{};this.container=this.params.container;this.areas=[];const t=[].slice.call(this.container.querySelectorAll(".landing-form-layout-item"));t.forEach((e=>{e.addEventListener("click",this.handleLayoutClick.bind(this))}));this.createBlocks(t[0].dataset.block);if(typeof this.params.areasCount!=="undefined"){this.changeLayout(this.params.areasCount,this.params.current)}const i=this.container.querySelector(".landing-form-select-buttons");i.addEventListener("click",this.handlerOnArrowClick.bind(this));if(this.params.tplUse){this.useCheck=this.params.tplUse;this.inputs=this.container.querySelectorAll(".layout-switcher");BX.addCustomEvent("BX.UI.LayoutForm:onToggle",(e=>{if(e.getData().checkbox&&e.getData().checkbox===this.useCheck){this.container.classList.add("landing-form-page-layout-short");this.inputs.forEach((e=>{e.checked=false}))}}))}};BX.Landing.Layout.prototype={handlerOnArrowClick:function(e){const t=this.container.querySelector(".landing-form-list-inner");if(e.target.classList.contains("landing-form-select-next")){t.classList.add("landing-form-list-inner-prev")}else{t.classList.remove("landing-form-list-inner-prev")}},createBlocks:function(e){const t=this.params.tplRefs.value.split(",");this.areas=[];const i=this.container.querySelector(".landing-form-layout-block-container");i.innerHTML="";for(let n=0;n<e;n++){const e=BX.create("div",{attrs:{className:"landing-form-layout-block-item"}});let o=n+1;let s="";if(typeof t[n]!=="undefined"&&t[n].indexOf(":")!==-1){s=parseInt(t[n].split(":")[1]);if(s>0){s="#landing"+s}else{s=""}}const l=new BX.Landing.UI.Field.LinkUrl({title:this.params.messages.area+" #"+o,content:s,textOnly:true,disableCustomURL:true,disableBlocks:true,disallowType:true,enableAreas:true,allowedTypes:[BX.Landing.UI.Field.LinkUrl.TYPE_PAGE],typeData:{button:{className:"fa fa-chevron-right",text:"",action:BX.Landing.UI.Field.LinkUrl.TYPE_PAGE},hideInput:false,contentEditable:false},settingMode:true,options:{siteId:this.params.siteId,landingId:this.params.landingId,filter:{"=TYPE":this.params.type}},onInit:this.rebuildHiddenField.bind(this),onInput:this.rebuildHiddenField.bind(this),onValueChange:this.rebuildHiddenField.bind(this)});this.areas[n]=l;e.appendChild(l.layout);i.appendChild(e)}},rebuildHiddenField:function(){let e="";for(let t=0,i=this.areas.length;t<i;t++){e+=t+1+":"+(this.areas[t].getValue()?this.areas[t].getValue().substr(13):0)+","}this.params.tplRefs.value=e},handleLayoutClick:function(e){const t=e.target.parentNode;const i=this.container.querySelector(".landing-form-layout-item-selected");if(i){i.classList.remove("landing-form-layout-item-selected")}this.changeLayout(t.dataset.block,t.dataset.layout)},changeLayout:function(e,t){const i=this.container.querySelector(".landing-form-layout-detail");this.container.classList.remove("landing-form-page-layout-short");i.classList.remove("landing-form-layout-detail-hidden");this.createBlocks(e);if(typeof t!=="undefined"){this.changeLayoutImg(t)}this.params.tplRefs.value=""},changeLayoutImg:function(e){const t=this.container.querySelectorAll(".landing-form-layout-img");for(let i=0;i<t.length;i++){if(t[i].dataset.layout===e){t[i].style.display="block"}else{t[i].style.display="none"}}}};BX.Landing.ToggleAdditionalFields=function(e){this.isOpen=false;this.form=e;this.hiddenRows=BX.convert.nodeListToArray(this.form.querySelectorAll(BX.Landing.ToggleAdditionalFields.SELECTOR_ROWS));this.toggleContainer=this.form.querySelector(BX.Landing.ToggleAdditionalFields.SELECTOR_CONTAINER);BX.Event.bind(this.toggleContainer,"click",this.onToggleClick.bind(this));if(window.location.hash){const e=window.location.hash.substr(1);this.hiddenRows.forEach((t=>{const i=t.dataset[BX.Landing.ToggleAdditionalFields.DATA_ROW_OPTION];if(i&&i===e){this.highlightHiddenRow(t)}}));const t=this.form.querySelector("["+BX.Landing.ToggleAdditionalFields.DATA_MAIN_OPTION_NAME+'="'+e+'"]');if(t){this.highlightRow(t)}}};BX.Landing.ToggleAdditionalFields.SELECTOR_ROWS=".landing-form-additional-row";BX.Landing.ToggleAdditionalFields.SELECTOR_CONTAINER=".landing-form-additional-fields-js";BX.Landing.ToggleAdditionalFields.DATA_OPTION="landingAdditionalOption";BX.Landing.ToggleAdditionalFields.DATA_ROW_OPTION="landingAdditionalDetail";BX.Landing.ToggleAdditionalFields.DATA_ROW_OPTION_NAME="data-landing-additional-detail";BX.Landing.ToggleAdditionalFields.DATA_MAIN_OPTION_NAME="data-landing-main-option";BX.Landing.ToggleAdditionalFields.CLASS_HIGHLIGHT="landing-form-row-highlight";BX.Landing.ToggleAdditionalFields.prototype={onToggleClick:function(e){if(e.target.dataset[BX.Landing.ToggleAdditionalFields.DATA_OPTION]){this.onHeaderClick(e)}else{this.toggleRows()}},toggleRows:function(){return this.isOpen?this.hideRows():this.showRows()},hideRows:function(){const e=[];this.hiddenRows.forEach((t=>{if(t.scrollHeight>0){t.style.height=0;e.push(a(t))}}));BX.Dom.removeClass(this.form,"landing-form-additional-open");this.isOpen=false;return Promise.all(e)},showRows:function(){const e=[];this.hiddenRows.forEach((t=>{if(t.scrollHeight>0){t.style.height="auto";e.push(a(t))}}));BX.Dom.addClass(this.form,"landing-form-additional-open");this.isOpen=true;return Promise.all(e)},onHeaderClick:function(e){const t=e.target.dataset[BX.Landing.ToggleAdditionalFields.DATA_OPTION];if(t){const e="["+BX.Landing.ToggleAdditionalFields.DATA_ROW_OPTION_NAME+' = "'+t+'"]';const i=this.form.querySelector(e);if(i){this.highlightHiddenRow(i)}}},highlightHiddenRow:function(e){const t=this.isOpen?Promise.resolve():this.showRows();t.then((()=>{this.highlightRow(e)}))},highlightRow:function(e){BX.Dom.addClass(e,BX.Landing.ToggleAdditionalFields.CLASS_HIGHLIGHT);window.scrollTo({top:BX.pos(e).top,behavior:"smooth"});setTimeout((()=>{BX.Dom.removeClass(e,BX.Landing.ToggleAdditionalFields.CLASS_HIGHLIGHT)}),2500)}};BX.Landing.ExternalMetrika=function(e,t,i){if(e.value===""){t.disabled=true;i.disabled=true}e.addEventListener("input",n.bind(this));function n(){if(e.value===""){t.disabled=true;t.checked=false;i.disabled=true;i.checked=false}else{t.disabled=false;i.disabled=false}}};BX.Landing.SaveBtn=function(e){e.addEventListener("click",t.bind(this));function t(){e.classList.add("ui-btn-clock");e.style.cursor="default";e.style.pointerEvents="none"}};BX.Landing.Cookies=function(){this.bgPickerBtn=document.querySelector(".landing-form-cookies-color-bg");this.textPickerBtn=document.querySelector(".landing-form-cookies-color-text");this.simplePreview=document.querySelector(".landing-form-cookies-settings-type-simple");this.advancedPreview=document.querySelector(".landing-form-cookies-settings-type-advanced");this.positions=document.querySelectorAll(".landing-form-cookies-position-item");this.inputApp=document.querySelector("#radio-cookies-mode-A");this.inputInfo=document.querySelector("#radio-cookies-mode-I");this.settings=document.querySelector(".landing-form-cookies-settings-wrapper");this.bgPicker=new BX.ColorPicker({bindElement:this.bgPickerBtn,popupOptions:{angle:false,offsetTop:5},onColorSelected:this.onBgColorSelected.bind(this),colors:BX.Landing.ColorPicker.prototype.setColors()});this.textPicker=new BX.ColorPicker({bindElement:this.textPickerBtn,popupOptions:{angle:false,offsetTop:5},onColorSelected:this.onTextColorSelected.bind(this),colors:BX.Landing.ColorPicker.prototype.setColors()});this.setSelectedBgColor(this.bgPickerBtn.value);this.setSelectedTextColor(this.textPickerBtn.value);this.hideCookiesSettings();this.bindEvents()};BX.Landing.Cookies.prototype={bindEvents:function(){this.positions.forEach(function(e){e.addEventListener("click",this.onSelectCookiesPosition.bind(this))}.bind(this));this.bgPickerBtn.addEventListener("click",this.showBgPicker.bind(this));this.textPickerBtn.addEventListener("click",this.showTextPicker.bind(this));this.inputInfo.addEventListener("change",this.hideCookiesSettings.bind(this));this.inputApp.addEventListener("change",this.showCookiesSettings.bind(this))},onBgColorSelected:function(){var e=this.bgPicker.getSelectedColor();this.setSelectedBgColor(e)},onTextColorSelected:function(){var e=this.textPicker.getSelectedColor();this.setSelectedTextColor(e)},onSelectCookiesPosition:function(e){this.positions.forEach(function(e){if(e.classList.contains("landing-form-cookies-position-item-selected")){e.classList.remove("landing-form-cookies-position-item-selected")}}.bind(this));e.currentTarget.classList.add("landing-form-cookies-position-item-selected")},showBgPicker:function(){this.bgPicker.open()},showTextPicker:function(){this.textPicker.open()},setSelectedBgColor:function(e){this.bgPickerBtn.style.background=e;this.bgPickerBtn.value=e;this.simplePreview.style.background=e;this.advancedPreview.style.background=e},setSelectedTextColor:function(e){this.textPickerBtn.style.background=e;this.textPickerBtn.value=e;this.advancedPreview.style.color=e;var t=document.querySelectorAll(".landing-form-cookies-settings-preview-svg");t.forEach((function(t){t.style.fill=e}))},hideCookiesSettings:function(){if(this.inputInfo.checked){this.settings.style.height="0";this.settings.style.opacity="0"}},showCookiesSettings:function(){if(this.inputApp.checked){this.settings.style.height=this.settings.scrollHeight+"px";this.settings.style.opacity="1";a(this.settings).then((()=>{this.settings.height="auto"}))}}};BX.Landing.B24ButtonColor=function(e,t){this.typeSelector=e;this.colorInput=t;this.valueControlWrap=BX.findParent(t,{class:"ui-ctl"});i(e,"change",this.checkVisibility.bind(this));this.checkVisibility()};BX.Landing.B24ButtonColor.prototype={checkVisibility:function(){this.valueControlWrap.hidden=this.typeSelector.value!=="custom";this.colorInput.labels.forEach((e=>{e.hidden=this.typeSelector.value!=="custom"}))}};BX.Landing.NeedPublicationField=function(e){e.forEach((function(e){var t=BX(e);if(t){BX.bind(t,"click",(function(){BX.UI.Dialogs.MessageBox.alert(BX.Loc.getMessage("LANDING_EDIT_NEED_PUBLICATION"))}))}}))};BX.Landing.ColorPalette=function(e,t){this.allColorsNode=e;this.customColorNode=null;this.colorPickerNode=null;if(typeof t!=="undefined"&&t){this.customColorNode=t;this.colorPickerNode=t.querySelector('input[type="text"]')}this.init();return this};BX.Landing.ColorPalette.prototype={init:function(){let t;if(this.allColorsNode){t=e(this.allColorsNode.children)}if(this.customColorNode){t=t.concat([this.customColorNode])}if(t){t.forEach(this.initSelectableItem,this)}if(t){this.setColor()}},setColor:function(e){if(e===undefined){this.color=l(this.getActiveColorNode(),"data-value")}else{this.color=e}if(this.colorPickerNode){this.colorPickerNode.setAttribute("value",this.color)}},getActiveColorNode:function(){let e;if(this.allColorsNode){e=this.allColorsNode.querySelector(".active")}if(!e&&this.customColorNode&&BX.Dom.hasClass(this.customColorNode,"active")){e=this.customColorNode}if(!e&&this.allColorsNode){e=this.allColorsNode.firstElementChild}return e},initSelectableItem:function(e){i(e,"click",t(this.onSelectableItemClick,this))},onSelectableItemClick:function(e){e.preventDefault();if(e.currentTarget.parentElement===this.allColorsNode){if(e.currentTarget.hasAttribute("data-value")){o(this.getActiveColorNode(),"active");n(e.currentTarget,"active");this.setColor(l(e.currentTarget,"data-value"))}}this.currentTarget=e.currentTarget;BX.Event.EventEmitter.subscribe("BX.Landing.ColorPickerTheme:onSelectColor",(()=>{if(this.currentTarget.hasAttribute("data-value")){o(this.getActiveColorNode(),"active");n(this.currentTarget,"active");this.setColor(l(this.currentTarget,"data-value"))}}))}};BX.Landing.ColorPicker=function(e,t){let i;if(t){i=t.defaultColor}this.picker=new BX.ColorPicker({bindElement:e,popupOptions:{angle:false,offsetTop:5},onColorSelected:this.onColorSelected.bind(this),colors:this.setColors(),selectedColor:i});this.input=e;this.colorPickerNode=e.parentElement;BX.addClass(this.colorPickerNode,"ui-colorpicker");this.colorIcon=BX.create("span",{props:{className:"ui-colorpicker-color"}});BX.insertBefore(this.colorIcon,this.input);this.colorValue=e.value;if(!this.colorValue&&i){e.value=i;this.colorValue=e.value}if(this.colorValue){BX.adjust(this.colorIcon,{attrs:{style:"background-color:"+this.colorValue}});BX.addClass(this.colorPickerNode,"ui-colorpicker-selected")}this.clearBtn=BX.create("span",{props:{className:"ui-colorpicker-clear"}});BX.insertAfter(this.clearBtn,this.input);BX.bind(this.colorPickerNode,"click",this.show.bind(this));BX.bind(this.clearBtn,"click",this.clear.bind(this))};BX.Landing.ColorPicker.prototype={onColorSelected:function(e){this.colorPickerNode.classList.add("ui-colorpicker-selected");this.colorIcon.style.backgroundColor=e;this.input.value=e;BX.Event.EventEmitter.emit(this,"BX.Landing.ColorPicker:onSelectColor")},show:function(e){if(e.target===this.clearBtn){return}this.picker.open()},clear:function(){this.colorPickerNode.classList.remove("ui-colorpicker-selected");this.input.value="";this.picker.setSelectedColor(null);BX.Event.EventEmitter.emit(this,"BX.Landing.ColorPicker:onClearColorPicker")},setColors:function(){return[["#f5f5f5","#eeeeee","#e0e0e0","#9e9e9e","#757575","#616161","#212121"],["#cfd8dc","#b0bec5","#90a4ae","#607d8b","#546e7a","#455a64","#263238"],["#d7ccc8","#bcaaa4","#a1887f","#795548","#6d4c41","#5d4037","#3e2723"],["#ffccbc","#ffab91","#ff8a65","#ff5722","#f4511e","#e64a19","#bf360c"],["#ffe0b2","#ffcc80","#ffb74d","#ff9800","#fb8c00","#f57c00","#e65100"],["#ffecb3","#ffe082","#ffd54f","#ffc107","#ffb300","#ffa000","#ff6f00"],["#fff9c4","#fff59d","#fff176","#ffeb3b","#fdd835","#fbc02d","#f57f17"],["#f0f4c3","#e6ee9c","#dce775","#cddc39","#c0ca33","#afb42b","#827717"],["#dcedc8","#c5e1a5","#aed581","#8bc34a","#7cb342","#689f38","#33691e"],["#c8e6c9","#a5d6a7","#81c784","#4caf50","#43a047","#388e3c","#1b5e20"],["#b2dfdb","#80cbc4","#4db6ac","#009688","#00897b","#00796b","#004d40"],["#b2ebf2","#80deea","#4dd0e1","#00bcd4","#00acc1","#0097a7","#006064"],["#b3e5fc","#81d4fa","#4fc3f7","#03a9f4","#039be5","#0288d1","#01579b"],["#bbdefb","#90caf9","#64b5f6","#2196f3","#1e88e5","#1976d2","#0d47a1"],["#c5cae9","#9fa8da","#7986cb","#3f51b5","#3949ab","#303f9f","#1a237e"],["#d1c4e9","#b39ddb","#9575cd","#673ab7","#5e35b1","#512da8","#311b92"],["#e1bee7","#ce93d8","#ba68c8","#9c27b0","#8e24aa","#7b1fa2","#4a148c"],["#f8bbd0","#f48fb1","#f06292","#e91e63","#d81b60","#c2185b","#880e4f"],["#ffcdd2","#ef9a9a","#e57373","#f44336","#e53935","#d32f2f","#b71c1c"]].map((function(e,t,i){return i.map((function(e){return e[t]}))}))}}})(); //# sourceMappingURL=landing-forms.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.26 |
proxy
|
phpinfo
|
Settings