%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/bitrix/www/bitrix/components/bitrix/landing.site_edit/templates/.default/
Upload File :
Create Path :
Current File : /home/bitrix/www/bitrix/components/bitrix/landing.site_edit/templates/.default/landing-forms.min.js

(function(){"use strict";BX.namespace("BX.Landing");BX.Landing.EditDomainForm=function(e,t){this.domain=e.querySelector(".ui-domain-input-btn-js");this.postfix=e.querySelectorAll(".ui-postfix");this.domains=e.querySelectorAll(".ui-domainname");this.content=t.content||"";this.messages=t.messages||{};this.popup=BX.Landing.UI.Tool.ActionDialog.getInstance();BX.bind(this.domain,"click",BX.delegate(this.editDomain,this))};BX.Landing.EditDomainForm.prototype={editDomain:function(e){e.stopPropagation();var t=this.popup.show({title:this.messages.title,content:this.content,contentColor:"grey"});this.content.style.display="block";t.then(function(){var t="";for(var i=0,n=this.postfix.length;i<n;i++){if(this.postfix[i].checked&&typeof this.domains[i]!=="undefined"){this.domains[i].value=BX.util.trim(this.domains[i].value);if(this.domains[i].value!==""){t=this.domains[i].value+this.postfix[i].value}}}if(t===""){alert(this.messages.errorEmpty);this.editDomain(e)}else{BX("ui-domainname-title").textContent=t;BX("ui-domainname-text").value=t}}.bind(this),function(){})}};BX.Landing.EditTitleForm=function(e,t,i){this.btn=e.querySelector(".ui-title-input-btn-js");this.label=e.querySelector(".ui-editable-field-label-js");this.input=e.querySelector(".ui-editable-field-input-js");this.additionalWidth=t||0;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)};BX.Landing.EditTitleForm.prototype={showInput:function(e){e.stopPropagation();this.input.style.width=this.label.offsetWidth+this.additionalWidth+17+"px";if(this.input.tagName==="TEXTAREA"){this.input.style.height=this.label.offsetHeight+"px"}this.label.style.display="none";this.btn.style.display="none";this.input.style.display="block";this.input.focus();BX.bind(document,"click",this.hideInput)},hideInput:function(e){if(e.target==this.input)return;this.label.textContent=this.input.value;this.label.style.display="inline-block";this.input.style.display="none";this.btn.style.display="block";BX.unbind(document,"click",this.hideInput)}};BX.Landing.ToggleFormFields=function(e){this.form=e;this.toggleBtn=e.querySelector(".landing-form-collapse-block-js");this.formInner=e.querySelector(".landing-form-inner-js");this.tableWparp=e.querySelector(".landing-form-table-wrap-js");this.startHeight=0;this.endHeight=0;this.isHidden=true;this.clickHandler=this.clickHandler.bind(this);this.setHeightAuto=this.setHeightAuto.bind(this);this.removeClassName=this.removeClassName.bind(this);BX.bind(this.toggleBtn,"click",this.clickHandler)};BX.Landing.ToggleFormFields.prototype={showRows:function(){this.startHeight=this.formInner.offsetHeight;this.formInner.style.height=this.startHeight+"px";this.form.classList.add("landing-form-collapsed-open");this.endHeight=this.tableWparp.offsetHeight+parseInt(BX.style(this.tableWparp,"marginBottom"));this.formInner.style.height=this.endHeight+"px";BX.bind(this.formInner,"transitionend",this.setHeightAuto);this.isHidden=false},closeRows:function(){this.formInner.style.height=this.endHeight+"px";setTimeout(function(){this.formInner.style.height=this.startHeight+"px"}.bind(this),70);BX.bind(this.formInner,"transitionend",this.removeClassName);this.isHidden=true},clickHandler:function(){if(this.isHidden)this.showRows();else this.closeRows()},setHeightAuto:function(){this.formInner.style.height="auto";BX.unbind(this.formInner,"transitionend",this.setHeightAuto)},removeClassName:function(){this.form.classList.remove("landing-form-collapsed-open");BX.unbind(this.formInner,"transitionend",this.removeClassName)}};BX.Landing.ColorPicker=function(e){this.picker=new BX.ColorPicker({bindElement:e,popupOptions:{angle:false,offsetTop:5},onColorSelected:this.onColorSelected.bind(this),colors:this.setColors()});this.colorPickerNode=e;this.colorIcon=e.querySelector(".ui-colorpicker-color-js");this.clearBtn=e.querySelector(".ui-colorpicker-clear");this.input=e.querySelector(".landing-colorpicker-inp-js");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},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)},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]})})}};BX.Landing.CustomFields=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.DomainNamePopup=function(e){var t=e.messages||{};var i=new BX.Landing.EditDomainForm(BX("ui-editable-domain"),{messages:{title:t.title||"",errorEmpty:t.errorEmpty||""},content:BX("ui-editable-domain-content")});BX.addCustomEvent(i.popup.popup,"onPopupShow",function(e){var t=e.contentContainer.querySelector("#landing-form-domain-name-field");var i=e.contentContainer.querySelector("#landing-form-domain-name-text");var n=e.contentContainer.querySelector("#landing-form-domain-any-name-text");BX.bind(t,"keyup",BX.debounce(function(){var e=t.value;var o=function(e){var o=t.value.split(".");var a=/^(com|net|org)\.[a-z]{2}$/;n.parentNode.style.display="none";i.textContent=e?e:"landing.mydomain";if(o.length===2||o.length===3&&o[0]==="www"||o.length===3&&(o[1]+"."+o[2]).match(a)){n.parentNode.style.display="table-row";if(o.length===3&&o[0]==="www"){n.textContent=o[1]+"."+o[2]}else{i.textContent="www."+e;n.textContent=e}}i.textContent=BX.util.trim(i.textContent)+".";n.textContent=BX.util.trim(n.textContent)+"."};if(e.match(/[^a-z0-9\.\-]+/i)===null){o(e)}else{BX.ajax({url:"/bitrix/tools/landing/ajax.php?action=Domain::punycode",method:"POST",data:{data:{domain:e},sessid:BX.message("bitrix_sessid")},dataType:"json",onsuccess:function(e){if(typeof e.result!=="undefined"){if(e.result!==false){o(e.result)}}}})}},200));BX.fireEvent(t,"keyup");var o=e.contentContainer.querySelectorAll("input.ui-domainname");for(var a=0;a<o.length;a++){BX.bind(o[a],"focus",function(){this.parentNode.parentNode.querySelector("input").checked=true})}})};BX.Landing.Favicon=function(){var e=BX("landing-form-favicon-change");var t=BX("landing-form-favicon-input");var i=BX("landing-form-favicon-value");var n=BX("landing-form-favicon-form");var o=BX("landing-form-favicon-src");var a=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{a.style.color="red"}}});BX.PreventDefault(e)})};BX.Landing.Custom404=function(){var e=BX("landing-form-404-select");BX.bind(e,"change",function(){if(this.value===""){this.parentNode.style.height=getComputedStyle(this.parentNode).height;BX("checkbox-404-use").checked=false}});BX.bind(BX("checkbox-404-use"),"change",function(){if(!this.checked){e.value=""}})};BX.Landing.Custom503=function(){var e=BX("landing-form-503-select");BX.bind(e,"change",function(){if(this.value===""){this.parentNode.style.height=getComputedStyle(this.parentNode).height;BX("checkbox-503-use").checked=false}});BX.bind(BX("checkbox-503-use"),"change",function(){if(!this.checked){e.value=""}})};BX.Landing.Layout=function(e){var t=document.querySelector(".landing-form-layout-block-container");var i=[];var n=document.querySelectorAll(".landing-form-layout-item");var o=document.querySelector(".landing-form-layout-detail");var a=document.querySelector(".landing-form-page-layout");n=Array.prototype.slice.call(n,0);e.messages=e.messages||{};d(n[0].dataset.block);n.forEach(function(e){e.addEventListener("click",s.bind(this))});function s(e){var t=e.target.parentNode;var i=document.querySelector(".landing-form-layout-item-selected");if(i){i.classList.remove("landing-form-layout-item-selected")}l(t.dataset.block,t.dataset.layout)}function l(e,t){a.classList.remove("landing-form-page-layout-short");o.classList.remove("landing-form-layout-detail-hidden");d(e);if(typeof t!=="undefined"){r(t)}BX("layout-tplrefs").value=""}if(typeof e.areasCount!=="undefined"){l(e.areasCount,e.current)}function r(e){var t=document.querySelectorAll(".landing-form-layout-img");for(var i=0;i<t.length;i++){if(t[i].dataset.layout===e){t[i].style.display="block"}else{t[i].style.display="none"}}}function d(n){var o=BX("layout-tplrefs").value.split(",");i=[];t.innerHTML="";for(var a=0;a<n;a++){var s=BX.create("div",{attrs:{className:"landing-form-layout-block-item"}});var l=a+1;var r="";if(typeof o[a]!=="undefined"&&o[a].indexOf(":")!==-1){r=parseInt(o[a].split(":")[1]);if(r>0){r="#landing"+r}else{r=""}}var d=new BX.Landing.UI.Field.LinkURL({title:e.messages.area+" #"+l,content:r,textOnly:true,disableCustomURL:true,disableBlocks:true,disallowType:true,enableAreas:true,allowedTypes:[BX.Landing.UI.Field.LinkURL.TYPE_PAGE],options:{siteId:e.siteId,landingId:e.landingId,filter:{"=TYPE":e.type}},onInput:function(){var e="";for(var t=0,n=i.length;t<n;t++){e+=t+1+":"+(i[t].getValue()?i[t].getValue().substr(8):0)+","}BX("layout-tplrefs").value=e}});i[a]=d;s.appendChild(d.layout);t.appendChild(s)}}var c=BX("layout-tplrefs-check");c.addEventListener("click",f.bind(this));function f(){BX("layout-tplrefs").value="";o.classList.add("landing-form-layout-detail--hidden");a.classList.add("landing-form-page-layout-short");var e=document.querySelectorAll(".layout-switcher");e=Array.prototype.slice.call(e,0);e.forEach(function(e){e.checked=false})}var u=document.querySelector(".landing-form-select-buttons");var h=document.querySelector(".landing-form-list-inner");var p=BX("layout-radio-6");u.addEventListener("click",m.bind(this));function m(e){if(e.target.classList.contains("landing-form-select-next")){h.classList.add("landing-form-list-inner-prev")}else{h.classList.remove("landing-form-list-inner-prev")}}if(p.checked){h.classList.add("landing-form-list-inner-prev")}};BX.Landing.Metrika=function(){var e=BX("field-gacounter_counter-use");var t=BX("field-gacounter_send_click-use");var i=BX("field-gacounter_send_show-use");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.IblockSelect=function(){this.section=BX("row_section_id");this.init(this.section)};BX.Landing.IblockSelect.prototype={init:function(e){if(!BX("settings_iblock_id").value){e.classList.add("landing-form-field-section-hidden")}else{e.classList.remove("landing-form-field-section-hidden")}}}})();

Zerion Mini Shell 1.0