This repository has been archived on 2022-06-23. You can view files and clone it, but cannot push or open issues or pull requests.
divi/js/theme-customizer-controls.js
2021-12-07 11:08:05 +00:00

1 line
14 KiB
JavaScript

!function(e){var t={};function i(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(o,n,function(t){return e[t]}.bind(null,n));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=92)}({92:function(e,t){!function(e){e((function(){var t,i=function(t,i){this.element=t,this.custom_select_link=null,this.custom_dropdown=null,this.frontend_customizer=!!e("body").hasClass("et_frontend_customizer"),this.options=jQuery.extend({},this.defaults,i),this.create_dropdown()},o="old"===et_divi_customizer_data.is_old_wp?e("#customize-preview"):e(".wp-full-overlay"),n="old"===et_divi_customizer_data.is_old_wp?"et_divi_phone et_divi_tablet":"preview-tablet preview-mobile preview-desktop",s="old"===et_divi_customizer_data.is_old_wp?"et_divi_tablet":"preview-tablet",c="old"===et_divi_customizer_data.is_old_wp?"et_divi_phone":"preview-mobile",a="old"===et_divi_customizer_data.is_old_wp?"":"preview-desktop";function _(e,i){var o=e,n=o.parent().find('input[type="range"]'),s=parseFloat(o.val()),c=parseFloat(n.attr("data-reset_value")),a=parseFloat(o.attr("step")),_=parseFloat(o.attr("min")),l=parseFloat(o.attr("max"));clearTimeout(t),t=setTimeout((function(){if(isNaN(s))return o.val(c),void n.val(c).trigger("change");a>=1&&s%1!=0&&(s=Math.round(s),o.val(s),n.val(s)),s>l&&(o.val(l),n.val(l).trigger("change")),s<_&&(o.val(_),n.val(_).trigger("change"))}),i),n.val(s).trigger("change")}void 0!==window.location.search&&-1!==window.location.search.search("et_customizer_option_set=module")?e("body").addClass("et_modules_customizer_option_set"):e("body").addClass("et_theme_customizer_option_set"),i.prototype={defaults:{apply_value_to:"body"},create_dropdown:function(){var t,i,o=this.element,n="";if(o.length&&(o.hide().addClass("et_select_image_main_select"),o.on("change",this.change_option.bind(this)),o.find("option").each((function(){var t=e(this),i=e(this).is(":selected")?' class="et_select_image_active"':"",o=0===t.attr("value").indexOf("_")?t.attr("value"):"_"+t.attr("value");n+='<li class="et_si'+o+'_column" data-value="'+t.attr("value")+'"'+i+">"+t.text()+"</li>"})),o.after('<a href="#" class="et_select_image_custom_select"><span class="et_filter_text"></span></a><ul class="et_select_image_options '+this.esc_classname(o.attr("data-customize-setting-link"))+'">'+n+"</ul>")),this.custom_select_link=o.next(".et_select_image_custom_select"),this.custom_dropdown=this.custom_select_link.next(".et_select_image_options"),(t=o.find(":selected")).length){var s=0===t.attr("value").indexOf("_")?t.attr("value"):"_"+t.attr("value");this.custom_select_link.find(".et_filter_text").text(t.text()).addClass("et_si"+s+"_column"),i="none"==t.val()?this.custom_dropdown.find("li").eq(0):this.custom_dropdown.find('li[data-value="'+t.text()+'"]'),this.custom_select_link.find(".et_filter_text").addClass(i.attr("class")).attr("data-si-class",i.attr("class")),i.addClass("et_select_image_active")}this.custom_select_link.on("click",this.open_dropdown.bind(this)),this.custom_dropdown.find("li").on("click",this.select_option.bind(this))},open_dropdown:function(t){var i=e(t.target);return this.custom_dropdown.hasClass("et_select_image_open")||(this.custom_dropdown.show().addClass("et_select_image_open"),i.hide()),!1},select_option:function(t){var i=e(t.target),o=i.attr("data-value"),n=this.custom_select_link.find(".et_filter_text"),s=this.element.find('option[value="'+o+'"]');return i.hasClass("et_select_image_active")?(this.close_dropdown(),!1):(i.siblings().removeClass("et_select_image_active"),n.removeClass((function(e,t){return(t.match(/\bet_si_\S+/g)||[]).join(" ")})),n.addClass(i.attr("class")).attr("data-si-class",i.attr("class")),i.addClass("et_select_image_active"),this.close_dropdown(),s.length?this.element.val(o).trigger("change"):this.element.val("none").trigger("change"),!1)},close_dropdown:function(){this.custom_select_link.find(".et_filter_text").show(),this.custom_dropdown.hide().removeClass("et_select_image_open")},change_option:function(){var e=this.element.find("option:selected").val(),t=this.custom_dropdown.find('li[data-value="'+e+'"]'),i=this.custom_select_link.find(".et_filter_text"),o=i.attr("data-si-class");this.custom_dropdown.find("li.et_select_image_active").data("value")!==e&&(this.custom_dropdown.find("li").removeClass("et_select_image_active"),i.removeClass(o).addClass(t.attr("class")).attr("data-si-class",t.attr("class")),t.addClass("et_select_image_active"))},esc_classname:function(e){return"et_si_"+e.replace(/[ +\/\[\]]/g,"_").toLowerCase()}},e.fn.et_select_image=function(e){return new i(this,e),this},e('select[data-customize-setting-link="et_divi[footer_columns]"]').et_select_image({apply_value_to:"body"}),e(".et_divi_reset_slider").on("click",(function(){var t=e(this).closest("label").find("input"),i=(t.data("customize-setting-link"),t.data("reset_value"));t.val(i),t.trigger("change")})),e("#accordion-section-et_divi_mobile_tablet h3, #accordion-panel-et_divi_mobile h3").on("click",(function(){o.removeClass(n).addClass(s),"old"!==et_divi_customizer_data.is_old_wp&&e("#customize-footer-actions .devices").css({display:"none"})})),e("#accordion-section-et_divi_mobile_phone h3, #accordion-section-et_divi_mobile_menu h3").on("click",(function(){o.removeClass(n).addClass(c),"old"!==et_divi_customizer_data.is_old_wp&&e("#customize-footer-actions .devices").css({display:"none"})})),e(".control-panel-back, .customize-panel-back").on("click",(function(){o.removeClass(n).addClass(a),"old"!==et_divi_customizer_data.is_old_wp&&e("#customize-footer-actions .devices").css({display:"block"})})),e("input[type=range]").on("mousedown",(function(){var t=e(this).parent().children(".et-pb-range-input");t.val(e(this).val()),e(this).on("mousemove",(function(){t.val(e(this).val())}))})),e("input.et-pb-range-input").on("change keyup",(function(){_(e(this),1e3)})).on("focusout",(function(){_(e(this),0)})),e("input.et_font_style_checkbox[type=checkbox]").on("change",(function(){var t=e(this),i=t.closest("span").siblings("input.et_font_styles"),o=t.val(),n=i.val(),s="false"!=n?n.split("|"):[],c=e.inArray(o,s),a="";!0===t.prop("checked")?n.length?c<0&&(s.push(o),a=s.join("|")):a=o:0!==n.length&&(c>=0?(s.splice(c,1),a=s.join("|")):a=n),i.val(a).trigger("change")})),e("span.et_font_style").on("click",(function(){var t=e(this).find("input");e(this).toggleClass("et_font_style_checked"),t.is(":checked")?t.prop("checked",!1):t.prop("checked",!0),t.trigger("change")}));var l=e("#customize-control-et_divi-vertical_nav"),d=l.find("input[type=checkbox]"),r=e("#customize-control-et_divi-nav_fullwidth"),u=e("#customize-control-et_divi-hide_nav"),v=e("#customize-control-et_divi-header_style select"),h=e("#accordion-section-et_divi_header_secondary"),m=e("#accordion-section-et_divi_header_slide"),p=e("#customize-control-et_divi-slide_nav_show_top_bar input[type=checkbox]"),f=e("#customize-control-et_divi-slide_nav_bg_top, #customize-control-et_divi-slide_nav_top_color, #customize-control-et_divi-slide_nav_search, #customize-control-et_divi-slide_nav_search_bg"),g=e("#customize-control-et_divi-primary_nav_font_size, #customize-control-et_divi-primary_nav_font_spacing, #customize-control-et_divi-primary_nav_font, #customize-control-et_divi-primary_nav_font_style, #customize-control-et_divi-menu_link_active, #customize-control-et_divi-primary_nav_dropdown_bg, #customize-control-et_divi-primary_nav_dropdown_line_color, #customize-control-et_divi-primary_nav_dropdown_link_color, #customize-control-et_divi-primary_nav_dropdown_animation, #customize-control-et_divi-fixed_primary_nav_font_size, #customize-control-et_divi-fixed_secondary_nav_bg, #customize-control-et_divi-fixed_menu_link, #customize-control-et_divi-fixed_secondary_menu_link, #customize-control-et_divi-fixed_menu_link_active"),b=e("#customize-control-et_divi-slide_nav_width, #customize-control-et_divi-slide_nav_search, #customize-control-et_divi-slide_nav_search_bg, #customize-control-et_divi-slide_nav_font_size, #customize-control-et_divi-slide_nav_top_font_size"),w=e("#customize-control-et_divi-fullscreen_nav_font_size, #customize-control-et_divi-fullscreen_nav_top_font_size"),z=e("#customize-control-et_divi-vertical_nav_orientation"),k=e("#customize-control-et_divi-menu_height"),y=e("#customize-control-et_divi-menu_margin_top");function C(){var t=e('#customize-control-et_divi-use_sidebar_width input[type="checkbox"]'),i=e("#customize-control-et_divi-sidebar_width");t.is(":checked")?i.fadeIn():i.fadeOut()}d.is(":checked")?(r.hide(),u.hide(),z.show(),k.hide(),y.show()):(r.show(),u.show(),z.hide(),k.show(),y.hide()),"slide"===v.val()||"fullscreen"===v.val()?(l.hide(),d.attr("checked",!1),d.trigger("change"),h.addClass("et_hidden_section"),g.hide(),m.removeClass("et_hidden_section"),"slide"===v.val()?(b.removeClass("et_hidden_section"),w.addClass("et_hidden_section")):(b.addClass("et_hidden_section"),w.removeClass("et_hidden_section"))):(l.show(),h.removeClass("et_hidden_section"),g.show(),m.addClass("et_hidden_section")),p.is(":checked")?f.show():f.hide(),e("#customize-theme-controls").on("change","#customize-control-et_divi-vertical_nav input[type=checkbox]",(function(){e(this).is(":checked")?(k.hide(),y.show()):(k.show(),y.hide())})),e("#customize-theme-controls").on("change","#customize-control-et_divi-vertical_nav input[type=checkbox]",(function(){e(this).is(":checked")?(r.hide(),u.hide(),z.show()):(r.show(),u.show(),z.hide())})),e("#customize-theme-controls").on("change","#customize-control-et_divi-header_style select",(function(){var t=e(this);"slide"===t.val()||"fullscreen"===t.val()?(l.hide(),d.attr("checked",!1),d.trigger("change"),h.addClass("et_hidden_section"),g.hide(),m.removeClass("et_hidden_section"),"slide"===v.val()?(b.removeClass("et_hidden_section"),w.addClass("et_hidden_section")):(b.addClass("et_hidden_section"),w.removeClass("et_hidden_section"))):(l.show(),h.removeClass("et_hidden_section"),g.show(),m.addClass("et_hidden_section"))})),e("#customize-theme-controls").on("change","#customize-control-et_divi-slide_nav_show_top_bar input[type=checkbox]",(function(){e(this).is(":checked")?f.show():f.hide()})),C(),e("#customize-theme-controls").on("change","#customize-control-et_divi-use_sidebar_width input[type=checkbox]",(function(){C()}))}));var t=wp.customize;t.ET_ColorAlphaControl=t.Control.extend({ready:function(){var e=this,i=e.container.find(".color-picker-hex");i.val(e.setting()).wpColorPicker({palettes:et_divi_customizer_data.color_palette.split("|"),change:function(){var t=i.wpColorPicker("color");if(""!==t&&"string"==typeof t)try{e.setting.set(t.toLowerCase())}catch(i){/^[\da-z]{3}([\da-z]{3})?$/i.test(t)&&(t="#"+t.toLowerCase(),e.setting.set(t))}},clear:function(){e.setting.set("")}}),e.setting.bind((function(e){i.val(e),i.wpColorPicker("color",e)})),"et_divi[footer_menu_text_color]"===this.id&&this.setting.bind("change",(function(e){t("et_divi[footer_menu_active_link_color]").set(e),t.control("et_divi[footer_menu_active_link_color]").container.find(".color-picker-hex").data("data-default-color",e).wpColorPicker({defaultColor:e,color:e})}))}}),e("body").on("click",".et_font_icon li",(function(){var t,i=e(this);i.hasClass("active")||(e(".et_font_icon li").removeClass("et_active"),i.addClass("et_active"),(t=i.closest("label").find(".et_selected_icon")).val(i.data("icon")),t.trigger("change"))})),t.controlConstructor.et_coloralpha=t.ET_ColorAlphaControl,wp.customize.bind("ready",(function(){function i(i,o){_.each(i,(function(i){t.control(i,(function(t){o?e(t.container).show().removeClass("et_hidden_section"):e(t.container).hide().addClass("et_hidden_section")}))}))}function o(){var i=["et_divi[cover_background]"];return t.control("et_divi[cover_background]").setting.get()||(i=e.merge(i,["background_repeat","background_position_x"])),i}_.each(["background_repeat","background_attachment"],(function(e){var i=t.control(e);if(!_.isUndefined(i)){i.container.find("input").off();var o=new t.Element(i.container.find("input"));o.bind((function(e){i.setting.set(e)})),i.setting.bind((function(e){o.set(e)}))}})),t.control("et_divi[cover_background]",(function(e){var o=e.setting.get(),n=""!==t.control("background_image").setting.get(),s=["background_repeat","background_position_x"];i(s,!o&&n),e.setting.bind("change",(function(e){var o=""!==t.control("background_image").setting.get();i(s,!e&&o)}))})),t.control("background_image",(function(e){var t=""!==e.setting.get();i(o(),t),e.setting.bind("change",(function(e){var t=""!==e;i(o(),t)}))}))})),e((function(){var t=e("#customize-control-et_divi-disable_custom_footer_credits input"),i=e("#customize-control-et_divi-custom_footer_credits");if(t.is(":checked")&&i.hide(),t.on("change",(function(){e(this).is(":checked")?i.hide():i.show()})),e("#accordion-section-et_divi_buttons").length){var o=e("#customize-control-et_divi-all_buttons_icon select"),n=o.val();s(n),o.on("change",(function(){s(n=e(this).val())}))}function s(t){e.each(["all_buttons_icon_color","all_buttons_icon_placement","all_buttons_icon_hover","all_buttons_selected_icon"],(function(i,o){"yes"===t?e("#customize-control-et_divi-"+o).show():e("#customize-control-et_divi-"+o).hide()}))}e(".et_font_icon").length&&e(".et_font_icon").each((function(){var t=e(this),i=t.closest("label").find(".et_selected_icon").val();t.find('li[data-icon="'+i+'"]').addClass("et_active")}))}))}(jQuery)}});