File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/js/landing/settingsform/designpreview/dist/designpreview.bundle.min.js
Back
this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};(function(t,e,o){"use strict";var n=function(){function t(e){babelHelpers.classCallCheck(this,t);this.node=e;return this}babelHelpers.createClass(t,[{key:"setParent",value:function t(e){this.parent=e;return this}},{key:"setDefaultValue",value:function t(e){this.defaultValue=e;return this}},{key:"setChangeHandler",value:function t(o){e.Event.bind(this.node,"change",o)}},{key:"setClickHandler",value:function t(o){e.Event.bind(this.node,"click",o)}},{key:"getValue",value:function t(){return this.parent&&this.parent.getValue()!==true?this.defaultValue:this.getValueInternal()}},{key:"getValueInternal",value:function t(){return this.node}}]);return t}();var i,r;var s=function(t){babelHelpers.inherits(s,t);function s(t){var e;var o;var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;babelHelpers.classCallCheck(this,s);o=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(s).call(this));o.setEventNamespace("BX.Landing.SettingsForm.DesignPreview");o.form=t;o.phrase=i;o.id=r;o.options=n;o.fontProxyUrl=(e=window.fontsProxyUrl)!==null&&e!==void 0?e:"fonts.googleapis.com";o.initControls();o.initLayout();o.applyStyles();o.onApplyStyles=o.applyStyles.bind(babelHelpers.assertThisInitialized(o));return o}babelHelpers.createClass(s,[{key:"initLayout",value:function t(){var o=this;this.createLayout();this.styleNode=document.createElement("style");e.Dom.append(this.styleNode,this.layout);e.Dom.append(this.layout,this.form);var n={threshold:1};var i=new IntersectionObserver((function(t){t.forEach((function(t){var e=document.documentElement.clientHeight-s.HEIGHT_PAGE_TITLE_WRAP;if(t.target.getBoundingClientRect().height<=e){if(t.isIntersecting){if(!o.hasOwnProperty("defaultIntersecting")){o.defaultIntersecting=true}if(o.defaultIntersecting){o.unFixElement()}}else{if(!o.hasOwnProperty("defaultIntersecting")){o.defaultIntersecting=false}if(o.defaultIntersecting){o.fixElement()}}}}))}),n);i.observe(this.layoutContent.parentNode)}},{key:"initControls",value:function t(){this.controls={};for(var i in this.options){if(!this.options.hasOwnProperty(i)){continue}for(var r in this.options[i]){if(!this.options[i].hasOwnProperty(r)){continue}if(!this.controls[i]){this.controls[i]={}}var s=new n(this.options[i][r]["control"]);s.setChangeHandler(this.applyStyles.bind(this));if(i==="theme"&&r!=="use"){s.setClickHandler(this.applyStyles.bind(this))}if(i==="background"&&r==="field"){s.setClickHandler(this.applyStyles.bind(this))}this.controls[i][r]=s}}for(var l in this.controls){if(!this.controls.hasOwnProperty(l)){continue}for(var a in this.controls[l]){if(!this.controls[l].hasOwnProperty(a)){continue}if(a!=="use"&&this.controls[l]["use"]){this.controls[l][a].setParent(this.controls[l]["use"]);if(this.options[l][a]["defaultValue"]){this.controls[l][a].setDefaultValue(this.options[l][a]["defaultValue"])}}}}if(this.controls.theme.corporateColor.node){this.controls.theme.corporateColor.node.subscribe("onSelectCustomColor",this.applyStyles.bind(this))}if(this.controls.background.image.node){this.controls.background.image.node.subscribe("change",this.onApplyStyles.bind(this))}if(this.controls.typo.textColor.node){o.EventEmitter.subscribe(this.controls.typo.textColor.node,"BX.Landing.ColorPicker:onSelectColor",this.onApplyStyles.bind(this));o.EventEmitter.subscribe(this.controls.typo.textColor.node,"BX.Landing.ColorPicker:onClearColorPicker",this.onApplyStyles.bind(this))}if(this.controls.typo.hColor.node){o.EventEmitter.subscribe(this.controls.typo.hColor.node,"BX.Landing.ColorPicker:onSelectColor",this.onApplyStyles.bind(this));o.EventEmitter.subscribe(this.controls.typo.hColor.node,"BX.Landing.ColorPicker:onClearColorPicker",this.onApplyStyles.bind(this))}if(this.controls.background.color.node){o.EventEmitter.subscribe(this.controls.background.color.node,"BX.Landing.ColorPicker:onSelectColor",this.onApplyStyles.bind(this));o.EventEmitter.subscribe(this.controls.background.color.node,"BX.Landing.ColorPicker:onClearColorPicker",this.onApplyStyles.bind(this))}this.panel=BX.Landing.UI.Panel.GoogleFonts.getInstance();e.Dom.append(this.panel.layout,document.body);var c=this.controls.typo.textFont.node;var h=this.controls.typo.hFont.node;if(c&&h){c.setAttribute("value",this.convertFont(c.value));h.setAttribute("value",this.convertFont(h.value));e.Event.bind(c,"click",this.onCodeClick.bind(this));e.Event.bind(h,"click",this.onCodeClick.bind(this))}}},{key:"onCodeClick",value:function t(e){var o=this;this.panel.show({hideOverlay:true,context:window}).then((function(t){var n=e.target;n.setAttribute("value",t.family);o.onApplyStyles()}))}},{key:"onApplyStyles",value:function t(){this.applyStyles()}},{key:"applyStyles",value:function t(){this.styleNode.innerHTML=this.generateCss()}},{key:"generateSelectorStart",value:function t(e){return"#"+e+" {"}},{key:"generateSelectorEnd",value:function t(e){return e+" }"}},{key:"getCSSPart1",value:function t(o){var n;var i=this.controls.theme.baseColors.node;var r;if(this.controls.theme.corporateColor.node){r=this.controls.theme.corporateColor.node.element}var s;if(i){s=i.querySelector(".active")}var l;if(r){l=e.Dom.hasClass(r,"active")}if(s){n=s.dataset.value}if(l){n=r.dataset.value}if(this.controls.theme.use.node){if(this.controls.theme.use.node.checked===false){n=this.controls.theme.corporateColor.defaultValue}}if(n){if(n[0]!=="#"){n="#"+n}o+="--design-preview-primary: ".concat(n,";")}return o}},{key:"getCSSPart2",value:function t(o){var n;var i;var r;var l;var a;var c;var h;var u;if(this.controls.typo.textColor.node){n=this.controls.typo.textColor.node.input.value}if(this.controls.typo.textFont.node){i=this.controls.typo.textFont.node.value}if(this.controls.typo.hFont.node){r=this.controls.typo.hFont.node.value}if(this.controls.typo.textSize.node){l=Math.round(this.controls.typo.textSize.node.value*s.DEFAULT_FONT_SIZE)+"px"}if(this.controls.typo.textWeight.node){a=this.controls.typo.textWeight.node.value}if(this.controls.typo.textLineHeight.node){c=this.controls.typo.textLineHeight.node.value}if(this.controls.typo.hColor.node){h=this.controls.typo.hColor.node.input.value}if(this.controls.typo.hWeight.node){u=this.controls.typo.hWeight.node.value}if(this.controls.typo.use.node){if(this.controls.typo.use.node.checked===false){n=this.controls.typo.textColor.defaultValue;i=this.controls.typo.textFont.defaultValue;r=this.controls.typo.hFont.defaultValue;l=Math.round(this.controls.typo.textSize.defaultValue*s.DEFAULT_FONT_SIZE)+"px";a=this.controls.typo.textWeight.defaultValue;c=this.controls.typo.textLineHeight.defaultValue;h=this.controls.typo.hColor.defaultValue;u=this.controls.typo.hWeight.defaultValue}}if(i){e.Dom.append(this.createFontLink(i),this.form)}if(r){e.Dom.append(this.createFontLink(r),this.form)}o+="--design-preview-color: ".concat(n,";");o+="--design-preview-font-theme: ".concat(i,";");o+="--design-preview-font-size: ".concat(l,";");o+="--design-preview-font-weight: ".concat(a,";");o+="--design-preview-line-height: ".concat(c,";");if(h){o+="--design-preview-color-h: ".concat(h,";")}else{o+="--design-preview-color-h: ".concat(n,";")}if(u){o+="--design-preview-font-weight-h: ".concat(u,";")}else{o+="--design-preview-font-weight-h: ".concat(a,";")}if(this.controls.typo.hFont.node){o+="--design-preview-font-h-theme: ".concat(r,";")}else{o+="--design-preview-font-h-theme: ".concat(i,";")}return o}},{key:"createFontLink",value:function t(e){var o=document.createElement("link");o.rel="stylesheet";o.href="https://"+this.fontProxyUrl+"/css2?family=";o.href+=e.replace(" ","+");o.href+=":wght@100;200;300;400;500;600;700;800;900";return o}},{key:"getCSSPart3",value:function t(e){var o=this.controls.background.color.node.input.value;var n=this.controls.background.field.node;var i=n.getElementsByClassName("landing-ui-field-image-hidden");var r=i[0].getAttribute("src");var s=this.controls.background.position.node.value;if(this.controls.background.use.node.checked===true){e+="--design-preview-bg: ".concat(o,";")}else{r="";if(this.controls.background.useSite){if(this.controls.background.useSite.defaultValue==="Y"){o=this.controls.background.color.defaultValue;r=this.controls.background.field.defaultValue;s=this.controls.background.position.defaultValue;e+="--design-preview-bg: ".concat(o,";")}}}if(this.controls.background.position){if(s==="center"){e+="background-image: url(".concat(r,");");e+="background-attachment: scroll;";e+="background-position: center;";e+="background-repeat: no-repeat;";e+="background-size: cover;"}if(s==="repeat"){e+="background-image: url(".concat(r,");");e+="background-attachment: scroll;";e+="background-position: center;";e+="background-repeat: repeat;";e+="background-size: 50%;"}if(s==="center_repeat_y"){e+="background-image: url(".concat(r,");");e+="background-attachment: scroll;";e+="background-position: top;";e+="background-repeat: repeat-y;";e+="background-size: 100%;"}}return e}},{key:"generateCss",value:function t(){var e;e=this.generateSelectorStart(this.id);e=this.getCSSPart1(e);e=this.getCSSPart2(e);e=this.getCSSPart3(e);e=this.generateSelectorEnd(e);return e}},{key:"createLayout",value:function t(){this.layout=e.Tag.render(i||(i=babelHelpers.taggedTemplateLiteral(['<div class="landing-design-preview-wrap"></div>'])));this.layoutContent=e.Tag.render(r||(r=babelHelpers.taggedTemplateLiteral(['<div id="','" class="landing-design-preview"><h2 class="landing-design-preview-title">','</h2><h4 class="landing-design-preview-subtitle">','</h4><p class="landing-design-preview-text">','</p><p class="landing-design-preview-text">','</p><div class=""><a class="landing-design-preview-button">',"</a></div></div>"])),this.id,this.phrase.title,this.phrase.subtitle,this.phrase.text1,this.phrase.text2,this.phrase.button);e.Dom.append(this.layoutContent,this.layout)}},{key:"fixElement",value:function t(){var e=this.layoutContent.parentNode;var o=e.getBoundingClientRect();var n=20;var i=o.width-n*2;var r=e.parentNode;var s=r.getBoundingClientRect();var l=this.layoutContent.getBoundingClientRect();var a=document.body.clientWidth;var c=20;var h=a-s.right+c;if(s.height>l.height){var u;u="position: fixed; ";u+="top: 20px; ";u+="margin-top: 0; ";u+="right: "+h+"px;";u+="max-width: "+i+"px;";this.layoutContent.setAttribute("style",u)}}},{key:"unFixElement",value:function t(){this.layoutContent.setAttribute("style","")}},{key:"convertFont",value:function t(e){e=e.replace("g-font-","");e=e.replaceAll("-"," ");e=e.replace("ibm ","IBM ");e=e.replace("pt ","PT ");e=e.replace(/sc(?:(?![a-z]))/i,"SC");e=e.replace(/jp(?:(?![a-z]))/i,"JP");e=e.replace(/kr(?:(?![a-z]))/i,"KR");e=e.replace(/tc(?:(?![a-z]))/i,"TC");e=e.replace(/(^|\s)\S/g,(function(t){return t.toUpperCase()}));return e}}]);return s}(o.EventEmitter);babelHelpers.defineProperty(s,"DEFAULT_FONT_SIZE",14);babelHelpers.defineProperty(s,"HEIGHT_PAGE_TITLE_WRAP",74);t.DesignPreview=s})(this.BX.Landing.SettingsForm=this.BX.Landing.SettingsForm||{},BX,BX.Event); //# sourceMappingURL=designpreview.bundle.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.25 |
proxy
|
phpinfo
|
Settings