How to use et method in wpt

Best JavaScript code snippet using wpt

theme-customizer.js

Source:theme-customizer.js Github

copy

Full Screen

1/**2 * Theme Customizer enhancements for a better user experience.3 *4 * Contains handlers to make Theme Customizer preview reload changes asynchronously.5 */6( function( $ ) {7 var $et_pb_section = $( '.et_pb_section' ),8 $et_transparent_nav = $( '.et_transparent_nav' ),9 $et_footer_info = $('#footer-info'),10 et_footer_info_original_html = et_main_customizer_data.original_footer_credits;11 var isCustomPostType = false;12 var selectorWrapper = '';13 if ( ! $et_footer_info.length ) {14 $( '#footer-bottom .container' ).prepend( '<p id="footer-info"></p>' );15 $et_footer_info = $('#footer-info');16 }17 function et_remove_element_class( prefix, el ) {18 var $element = typeof el === 'undefined' ? $( 'body' ) : $( el ),19 el_classes = $element.attr( 'class' ),20 el_class;21 regex = new RegExp( prefix + '[^\\s]+', 'g' );22 el_class = el_classes.replace( regex, '' );23 $element.attr( 'class', $.trim( el_class ) );24 }25 function et_fix_page_top_padding() {26 setTimeout( function() {27 var $body = $( 'body' ),28 $pagecontainer = $( '#page-container' ),29 $top_header = $( '#top-header' ),30 $main_header = $( '#main-header' ),31 secondary_nav_height = $top_header.length && $top_header.is(':visible') ? $top_header.innerHeight() : 0;32 if ( !$body.hasClass('et_hide_nav') && ! window.et_is_vertical_nav && $body.hasClass( 'et_fixed_nav' ) ) {33 $pagecontainer.css( 'paddingTop', $main_header.innerHeight() + secondary_nav_height );34 $main_header.css( 'top', secondary_nav_height );35 } else if ( window.et_is_vertical_nav ) {36 $pagecontainer.css( 'paddingTop', 0 );37 $main_header.css( 'top', 0 );38 } else {39 $pagecontainer.css( 'paddingTop', 0 );40 }41 et_fix_page_container_position();42 }, 550 );43 }44 // Fixing logo height size45 function et_fix_logo_height() {46 var header_style = typeof wp.customize.value( 'et_divi[header_style]' )() === 'undefined' ? 'left' : wp.customize.value( 'et_divi[header_style]' )(),47 menu_height = typeof wp.customize.value( 'et_divi[menu_height]' )() === 'undefined' ? 66 : parseInt( wp.customize.value( 'et_divi[menu_height]' )() ),48 fixed_menu_height = ! $('#fixed_menu_height').length || typeof wp.customize.value( 'et_divi[minimized_menu_height]' )() === 'undefined' ? 40 : parseInt( wp.customize.value( 'et_divi[minimized_menu_height]' )() ),49 logo_height = typeof wp.customize.value( 'et_divi[logo_height]' )() === 'undefined' ? 54 : parseInt( wp.customize.value( 'et_divi[logo_height]' )() ),50 $body = $('body'),51 is_rtl = $body.hasClass( 'rtl' ),52 $et_top_navigation = $('#et-top-navigation'),53 et_top_nav_padding = is_rtl ? 'paddingRight' : 'paddingLeft',54 logo_width = 30;55 style_id = "style#logo_height_style",56 style_content = '<style id="logo_height_style">',57 top_nav_padding_value = '';58 if ( header_style === 'left' || header_style === 'slide' || header_style === 'fullscreen' ) {59 style_content += "#logo { max-height: " + logo_height + "%; }\ ";60 style_content += ".et_pb_svg_logo #logo { height: " + logo_height + "%; }\ ";61 }62 if ( header_style === 'centered' ) {63 style_content += ".et_header_style_centered #logo { max-height: " + logo_height + "%; }\ ";64 style_content += ".et_pb_svg_logo.et_header_style_centered #logo { height: " + logo_height + "%; }\ ";65 }66 if ( header_style === 'split' ) {67 style_content += "body.et_header_style_split .centered-inline-logo-wrap { width: auto; height: " + ( ( ( menu_height / 100 ) * logo_height ) + 14 ) + "px; }\ ";68 style_content += "body.et_header_style_split .et-fixed-header .centered-inline-logo-wrap { width: auto; height: " + ( ( ( fixed_menu_height / 100 ) * logo_height ) + 14 ) + "px; }\ ";69 style_content += "body.et_header_style_split .centered-inline-logo-wrap #logo { height: auto; max-height: 100%; }\ ";70 style_content += "body.et_header_style_split .et-fixed-header .centered-inline-logo-wrap #logo { height: auto; max-height: 100%; }\ ";71 // Removes inline width styling72 $( '.et_header_style_split .centered-inline-logo-wrap' ).css({ 'width' : '' });73 }74 if ( window.et_is_vertical_nav ) {75 style_content += "#main-header .logo_container { width: " + logo_height + "%; }\ ";76 style_content += ".et_header_style_centered #main-header .logo_container, .et_header_style_split #main-header .logo_container { margin: 0 auto; }\ ";77 }78 style_content += '</style>';79 // Append / refresh logo height80 et_customizer_update_styles( style_id, style_content );81 setTimeout( function() {82 // Update inline styling83 if ( header_style === 'left' && ! window.et_is_vertical_nav || header_style === 'slide' || header_style === 'fullscreen' ) {84 // Update logo height85 logo_width += $( '#logo' ).width();86 top_nav_padding_value = logo_width;87 }88 $et_top_navigation.css( et_top_nav_padding, top_nav_padding_value );89 }, 700 );90 }91 // Retrieving padding/margin value based on formatted saved padding/margin strings92 function et_get_saved_padding_margin_value( saved_value, order ) {93 if ( typeof saved_value === 'undefined' ) {94 return false;95 }96 var values = saved_value.split('|');97 return typeof values[order] !== 'undefined' ? values[order] : false;98 }99 // Calculate fixed header height by cloning, emulating, and calculating its height100 function et_fix_saved_main_header_height( state ) {101 var is_desktop_view = $(window).width() > 980,102 main_header_height = 0,103 $main_header = $('#main-header'),104 data_attribute = state === 'fixed' ? 'data-fixed-height-onload' : 'data-height-onload',105 main_header_clone_classname = state === 'fixed' ? 'main-header-clone et-fixed-header' : 'main-header-clone',106 $main_header_clone = $main_header.clone().addClass( main_header_clone_classname );107 if ( is_desktop_view ) {108 if ( state === 'fixed' ) {109 $main_header_clone.css({110 opacity: 0,111 position: 'fixed',112 top: 'auto',113 right: 0,114 bottom: 0,115 left: 0116 }).appendTo( $('body') );117 } else {118 $main_header_clone.css({119 opacity: 0,120 position: 'absolute',121 top: 0,122 right: 0,123 bottom: 'auto',124 left: 0125 }).prependTo( $('body') );126 }127 main_header_height = $main_header_clone.height();128 $main_header_clone.remove();129 $main_header.attr( data_attribute, main_header_height );130 }131 }132 // Fixing main header's alpha to fixed background color transition133 function et_fix_page_container_position(){134 var $et_pb_slider = $( '.et_pb_slider' ),135 $top_header = $('#top-header'),136 $main_header = $('#main-header'),137 $main_header_innerheight = $main_header.innerHeight(),138 $main_container_wrapper = $( '#page-container' ),139 $et_transparent_nav = $( '.et_transparent_nav' ),140 $et_transparent_nav_length = $et_transparent_nav.length,141 $et_pb_first_row = $( 'body.et_pb_pagebuilder_layout .et_pb_section:first-child' ),142 $et_pb_first_row_length = $et_pb_first_row.length,143 $et_pb_first_row_first_module = $et_pb_first_row.children( '.et_pb_module:first' ),144 $et_main_content_first_row = $( '#main-content .container:first-child' ),145 $et_main_content_first_row_length = $et_main_content_first_row.length,146 $et_main_content_first_row_meta_wrapper = $et_main_content_first_row.find('.et_post_meta_wrapper:first'),147 $et_main_content_first_row_meta_wrapper_title = $et_main_content_first_row_meta_wrapper.find( 'h1' ),148 $et_main_content_first_row_content = $et_main_content_first_row.find('.entry-content:first'),149 $et_single_post = $( 'body.single-post' ),150 $et_window = $(window),151 et_window_width = $et_window.width(),152 secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHeight() : 0,153 inline_style = "<style id='et_fix_page_container_position'>",154 $inline_style = $('#et_fix_page_container_position'),155 $inline_style_length = $inline_style.length,156 $et_pb_post_fullwidth = $( '.single.et_pb_pagebuilder_layout.et_full_width_page' ),157 is_fixed_nav = $('body').hasClass('et_fixed_nav'),158 is_nav_vertical_to_horizontal = $('body').hasClass( 'nav-vertical-to-horizontal' );159 // Set data-height-onload for header if the page is loaded on large screen160 // If the page is loaded from small screen, rely on data-height-onload printed on the markup,161 // prevent window resizing issue from small to large162 if ( et_window_width > 980 && ! $main_header.attr( 'data-height-loaded' ) ) {163 $main_header.attr({ 'data-height-onload' : $main_header_innerheight, 'data-height-loaded' : true });164 }165 // Use on page load calculation for large screen. Use on the fly calculation for small screen (980px below)166 if ( et_window_width <= 980 ) {167 var header_height = $main_header_innerheight + secondary_nav_height - 1;168 // If transparent is detected, #main-content .container's padding-top needs to be added to header_height169 // And NOT a pagebuilder page170 if ( $et_transparent_nav_length && ! $et_pb_first_row_length ) {171 header_height += 58;172 }173 } else {174 // Get header height from header attribute175 var header_height = is_nav_vertical_to_horizontal ? $main_header.height() : parseInt( $main_header.attr( 'data-height-onload' ) );176 header_height += secondary_nav_height;177 // Non page builder page needs to be added by #main-content .container's fixed height178 if ( $et_transparent_nav_length && ! window.et_is_vertical_nav && $et_main_content_first_row_length ) {179 header_height += 58;180 }181 // If this is horizontal to vertical switching, update main header's data-height-onload182 if ( is_nav_vertical_to_horizontal ) {183 $main_header.attr({ 'data-height-onload' : $main_header.height() });184 }185 // Calculate fixed header height by cloning, emulating, and calculating its height186 }187 // Calculate fixed header height by cloning, emulating, and calculating its height188 et_fix_saved_main_header_height( 'fixed' );189 // Specific adjustment required for transparent nav + not vertical nav190 if ( $et_transparent_nav_length && ! window.et_is_vertical_nav ) {191 // Add class for first row for custom section padding purpose192 $et_pb_first_row.addClass( 'et_pb_section_first' );193 // List of conditionals194 var is_pb = $et_pb_first_row.length,195 is_post_pb = is_pb && $et_single_post.length,196 is_post_pb_full_layout_has_title = $et_pb_post_fullwidth.length && $et_main_content_first_row_meta_wrapper_title.length,197 is_post_pb_full_layout_no_title = $et_pb_post_fullwidth.length && 0 === $et_main_content_first_row_meta_wrapper_title.length,198 is_pb_fullwidth_section_first = $et_pb_first_row.is( '.et_pb_fullwidth_section' ),199 is_no_pb_mobile = $et_window.width() <= 980 && $et_main_content_first_row.length;200 if ( is_post_pb && ! ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first ) ) {201 /* Desktop / Mobile + Single Post */202 /*203 * EXCEPT for fullwidth layout + fullwidth section ( at the first row ).204 * It is basically the same as page + fullwidth section with few quirk.205 * Instead of duplicating the conditional for each module, it'll be simpler to negate206 * fullwidth layout + fullwidth section in is_post_pb and rely it to is_pb_fullwidth_section_first207 */208 // Remove main content's inline padding to styling to prevent looping padding-top calculation209 $et_main_content_first_row.css({ 'paddingTop' : '' });210 if ( $et_window.width() < 980 ) {211 header_height += 40;212 }213 if ( is_pb_fullwidth_section_first ) {214 // If the first section is fullwidth, restore the padding-top modified area at first section215 $et_pb_first_row.css({216 'paddingTop' : '0',217 });218 }219 if ( is_post_pb_full_layout_has_title ) {220 // Add header height to post meta wrapper as padding top221 $et_main_content_first_row_meta_wrapper.css({222 'paddingTop' : header_height223 });224 } else if ( is_post_pb_full_layout_no_title ) {225 $et_pb_first_row.css({226 'paddingTop' : header_height227 });228 } else {229 // Add header height to first row content as padding top230 $et_main_content_first_row.css({231 'paddingTop' : header_height232 });233 }234 } else if ( is_pb_fullwidth_section_first ){235 /* Desktop / Mobile + Pagebuilder + Fullwidth Section */236 var $et_pb_first_row_first_module = $et_pb_first_row.children( '.et_pb_module:first' );237 // Quirks: If this is post with fullwidth layout + no title + fullwidth section at first row,238 // Remove the added height at line 2656239 if ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first && $et_window.width() > 980 ) {240 header_height = header_height - 58;241 }242 if ( $et_pb_first_row_first_module.is( '.et_pb_slider' ) ) {243 /* Desktop / Mobile + Pagebuilder + Fullwidth slider */244 var $et_pb_first_row_first_module_slide_image = $et_pb_first_row_first_module.find( '.et_pb_slide_image' ),245 $et_pb_first_row_first_module_slide = $et_pb_first_row_first_module.find( '.et_pb_slide' ),246 $et_pb_first_row_first_module_slide_container = $et_pb_first_row_first_module.find( '.et_pb_slide .et_pb_container' ),247 et_pb_slide_image_margin_top = 0 - ( parseInt( $et_pb_first_row_first_module_slide_image.height() ) / 2 ),248 et_pb_slide_container_height = 0,249 $et_pb_first_row_first_module_slider_arrow = $et_pb_first_row_first_module.find( '.et-pb-slider-arrows a'),250 et_pb_first_row_slider_arrow_height = $et_pb_first_row_first_module_slider_arrow.height();251 // Adding padding top to each slide so the transparency become useful252 $et_pb_first_row_first_module_slide.css({253 'paddingTop' : header_height,254 });255 // delete container's min-height256 $et_pb_first_row_first_module_slide_container.css({257 'min-height' : ''258 });259 // Adjusting slider's image, considering additional top padding of slideshow260 $et_pb_first_row_first_module_slide_image.css({261 'marginTop' : et_pb_slide_image_margin_top262 });263 // Adjusting slider's arrow, considering additional top padding of slideshow264 $et_pb_first_row_first_module_slider_arrow.css({265 'marginTop' : ( ( header_height / 2 ) - ( et_pb_first_row_slider_arrow_height / 2 ) )266 });267 // Looping the slide and get the highest height of slide268 et_pb_first_row_slide_container_height_new = 0269 $et_pb_first_row_first_module.find( '.et_pb_slide' ).each( function(){270 var $et_pb_first_row_first_module_slide_item = $(this),271 $et_pb_first_row_first_module_slide_container = $et_pb_first_row_first_module_slide_item.find( '.et_pb_container' );272 // Make sure that the slide is visible to calculate correct height273 $et_pb_first_row_first_module_slide_item.show();274 // Remove existing inline css to make sure that it calculates the height275 $et_pb_first_row_first_module_slide_container.css({ 'min-height' : '' });276 var et_pb_first_row_slide_container_height = $et_pb_first_row_first_module_slide_container.innerHeight();277 if ( et_pb_first_row_slide_container_height_new < et_pb_first_row_slide_container_height ){278 et_pb_first_row_slide_container_height_new = et_pb_first_row_slide_container_height;279 }280 // Hide the slide back if it isn't active slide281 if ( $et_pb_first_row_first_module_slide_item.is( ':not(".et-pb-active-slide")' ) ){282 $et_pb_first_row_first_module_slide_item.hide();283 }284 });285 // Setting appropriate min-height, considering additional top padding of slideshow286 $et_pb_first_row_first_module_slide_container.css({287 'min-height' : et_pb_first_row_slide_container_height_new288 });289 } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_header' ) ) {290 /* Desktop / Mobile + Pagebuilder + Fullwidth header */291 // Remove existing inline stylesheet to prevent looping padding292 $et_pb_first_row_first_module.removeAttr( 'style' );293 // Get paddingTop from stylesheet294 var et_pb_first_row_first_module_fullwidth_header_padding_top = parseInt( $et_pb_first_row_first_module.css( 'paddingTop' ) );295 // Implement stylesheet's padding-top + header_height296 $et_pb_first_row_first_module.css({297 'paddingTop' : ( header_height + et_pb_first_row_first_module_fullwidth_header_padding_top )298 } );299 } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_portfolio' ) ) {300 /* Desktop / Mobile + Pagebuilder + Fullwidth Portfolio */301 $et_pb_first_row_first_module.css({ 'paddingTop' : header_height });302 } else if ( $et_pb_first_row_first_module.is( '.et_pb_map_container' ) ) {303 /* Desktop / Mobile + Pagebuilder + Fullwidth Map */304 var $et_pb_first_row_map = $et_pb_first_row_first_module.find( '.et_pb_map' );305 // Remove existing inline height to prevent looping height calculation306 $et_pb_first_row_map.css({ 'height' : '' });307 // Implement map height + header height308 $et_pb_first_row_first_module.find('.et_pb_map').css({309 'height' : header_height + parseInt( $et_pb_first_row_map.css( 'height' ) )310 });311 // Adding specific class to mark the map as first row section element312 $et_pb_first_row_first_module.addClass( 'et_beneath_transparent_nav' );313 } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_menu' ) ) {314 /* Desktop / Mobile + Pagebuilder + Fullwidth Menu */315 $et_pb_first_row_first_module.css({ 'marginTop' : header_height });316 } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_code' ) ) {317 /* Desktop / Mobile + Pagebuilder + Fullwidth code */318 var $et_pb_first_row_first_module_code = $et_pb_first_row_first_module;319 $et_pb_first_row_first_module_code.css({ 'paddingTop' : '' });320 var et_pb_first_row_first_module_code_padding_top = parseInt( $et_pb_first_row_first_module_code.css( 'paddingTop' ) );321 $et_pb_first_row_first_module_code.css({322 'paddingTop' : header_height + et_pb_first_row_first_module_code_padding_top323 });324 } else if ( $et_pb_first_row_first_module.is( '.et_pb_post_title' ) ) {325 /* Desktop / Mobile + Pagebuilder + Fullwidth Post Title */326 var $et_pb_first_row_first_module_title = $et_pb_first_row_first_module;327 $et_pb_first_row_first_module_title.css({328 'paddingTop' : header_height + 50329 });330 }331 } else if ( is_pb ) {332 /* Desktop / Mobile + Pagebuilder + Regular section */333 // Remove first row's inline padding top styling to prevent looping padding-top calculation334 $et_pb_first_row.css({ 'paddingTop' : '' });335 // Get saved custom padding from data-* attributes. Builder automatically adds336 // saved custom paddings to data-* attributes on first section337 var et_window_width = $et_window.width(),338 saved_custom_padding = $et_pb_first_row.attr('data-padding'),339 saved_custom_padding_top = et_get_saved_padding_margin_value( saved_custom_padding, 0 ),340 saved_custom_padding_tablet = $et_pb_first_row.attr('data-padding-tablet'),341 saved_custom_padding_tablet_top = et_get_saved_padding_margin_value( saved_custom_padding_tablet, 0 ),342 saved_custom_padding_phone = $et_pb_first_row.attr('data-padding-phone'),343 saved_custom_padding_phone_top = et_get_saved_padding_margin_value( saved_custom_padding_phone, 0 ),344 applied_saved_custom_padding;345 if ( saved_custom_padding_top || saved_custom_padding_tablet_top || saved_custom_padding_phone_top ) {346 // Applies padding top to first section to automatically convert saved unit into px347 if ( et_window_width > 980 && saved_custom_padding_top ) {348 $et_pb_first_row.css({349 paddingTop: saved_custom_padding_top350 });351 } else if ( et_window_width > 767 && saved_custom_padding_tablet_top ) {352 $et_pb_first_row.css({353 paddingTop: saved_custom_padding_tablet_top354 });355 } else if ( saved_custom_padding_phone_top ) {356 $et_pb_first_row.css({357 paddingTop: saved_custom_padding_phone_top358 });359 }360 // Get converted custom padding top value361 applied_saved_custom_padding = parseInt( $et_pb_first_row.css( 'paddingTop' ) );362 // Implemented saved & converted padding top + header height363 $et_pb_first_row.css({364 paddingTop: ( header_height + applied_saved_custom_padding )365 });366 } else {367 // Pagebuilder ignores #main-content .container's fixed height and uses its row's padding368 // Anticipate the use of custom section padding.369 et_pb_first_row_padding_top = header_height + parseInt( $et_pb_first_row.css( 'paddingBottom' ) );370 // Implementing padding-top + header_height371 $et_pb_first_row.css({372 'paddingTop' : et_pb_first_row_padding_top373 });374 }375 } else if ( is_no_pb_mobile ) {376 // Mobile + not pagebuilder377 $et_main_content_first_row.css({378 'paddingTop' : header_height379 });380 } else if ( is_fixed_nav ) {381 $('#main-content .container:first-child').css({382 'paddingTop' : header_height383 });384 }385 // Append inline style386 inline_style += "#page-container{padding-top: 0 !important; }";387 } else {388 // Remove class for first row for custom section padding purpose389 $et_pb_first_row.removeClass( 'et_pb_section_first' );390 // Add padding-top for #page-container if fixed nav is used391 if ( is_fixed_nav ) {392 $main_container_wrapper.css( 'paddingTop', header_height );393 }394 // Cleanup mechanism from transparent nav into fixed color nav for edge cases (e.g. fullwidth section)395 // List of conditionals396 var is_pb = $et_pb_first_row.length,397 is_post_pb = is_pb && $et_single_post.length,398 is_post_pb_full_layout_has_title = $et_pb_post_fullwidth.length && $et_main_content_first_row_meta_wrapper_title.length,399 is_post_pb_full_layout_no_title = $et_pb_post_fullwidth.length && 0 === $et_main_content_first_row_meta_wrapper_title.length,400 is_pb_fullwidth_section_first = $et_pb_first_row.is( '.et_pb_fullwidth_section' ),401 is_no_pb_mobile = $et_window.width() <= 980 && $et_main_content_first_row.length;402 if ( is_post_pb && ! ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first ) ) {403 /* Desktop / Mobile + Single Post */404 /*405 * EXCEPT for fullwidth layout + fullwidth section ( at the first row ).406 * It is basically the same as page + fullwidth section with few quirk.407 * Instead of duplicating the conditional for each module, it'll be simpler to negate408 * fullwidth layout + fullwidth section in is_post_pb and rely it to is_pb_fullwidth_section_first409 */410 // Remove main content's inline padding to styling to prevent looping padding-top calculation411 $et_main_content_first_row.css({ 'paddingTop' : '' });412 if ( is_pb_fullwidth_section_first ) {413 $et_pb_first_row.css({414 'paddingTop' : '',415 });416 }417 if ( is_post_pb_full_layout_has_title ) {418 // Add header height to post meta wrapper as padding top419 $et_main_content_first_row_meta_wrapper.css({420 'paddingTop' : ''421 });422 } else if ( is_post_pb_full_layout_no_title ) {423 $et_pb_first_row.css({424 'paddingTop' : ''425 });426 } else {427 // Add header height to first row content as padding top428 $et_main_content_first_row.css({429 'paddingTop' : ''430 });431 }432 } else if ( is_pb_fullwidth_section_first ){433 /* Desktop / Mobile + Pagebuilder + Fullwidth Section */434 var $et_pb_first_row_first_module = $et_pb_first_row.children( '.et_pb_module:first' );435 if ( $et_pb_first_row.children( '.et_pb_module:first' ).is( '.et_pb_slider' ) ) {436 /* Desktop / Mobile + Pagebuilder + Fullwidth slider */437 var $et_pb_first_row_slide_image = $et_pb_first_row.find( '.et_pb_slide_image' ),438 $et_pb_first_row_slide = $et_pb_first_row.find( '.et_pb_slide' ),439 $et_pb_first_row_slide_container = $et_pb_first_row.find( '.et_pb_slide .et_pb_container' ),440 et_pb_slide_image_margin_top = 0 - ( parseInt( $et_pb_first_row_slide_image.height() ) / 2 ),441 et_pb_slide_container_height = 0,442 $et_pb_first_row_slider_arrow = $et_pb_first_row.find( '.et-pb-slider-arrows a'),443 et_pb_first_row_slider_arrow_height = $et_pb_first_row_slider_arrow.height();444 // Adding padding top to each slide so the transparency become useful445 $et_pb_first_row_slide.css({446 'paddingTop' : '',447 });448 // delete container's min-height449 $et_pb_first_row_slide_container.css({450 'min-height' : ''451 });452 // Adjusting slider's image, considering additional top padding of slideshow453 $et_pb_first_row_slide_image.css({454 'marginTop' : ''455 });456 // Adjusting slider's arrow, considering additional top padding of slideshow457 $et_pb_first_row_slider_arrow.css({458 'marginTop' : ''459 });460 // Setting appropriate min-height, considering additional top padding of slideshow461 $et_pb_first_row_slide_container.css({462 'min-height' : ''463 });464 } else if ( $et_pb_first_row.children( '.et_pb_module:first' ).is( '.et_pb_fullwidth_header' ) ) {465 /* Desktop / Mobile + Pagebuilder + Fullwidth header */466 // Implement stylesheet's padding-top + header_height467 $et_pb_first_row_first_module.css({468 'paddingTop' : ''469 } );470 } else if ( $et_pb_first_row.children( '.et_pb_module:first' ).is( '.et_pb_fullwidth_portfolio' ) ) {471 /* Desktop / Mobile + Pagebuilder + Fullwidth Portfolio */472 $et_pb_first_row.find( '.et_pb_fullwidth_portfolio' ).css({ 'paddingTop' : '' });473 } else if ( $et_pb_first_row_first_module.is( '.et_pb_map_container' ) ) {474 /* Desktop / Mobile + Pagebuilder + Fullwidth Map */475 var $et_pb_first_row_map = $et_pb_first_row_first_module.find( '.et_pb_map' );476 // Remove existing inline height to prevent looping height calculation477 $et_pb_first_row_map.css({ 'height' : '' });478 // Implement map height + header height479 $et_pb_first_row_first_module.find('.et_pb_map').css({480 'height' : ''481 });482 // Adding specific class to mark the map as first row section element483 $et_pb_first_row_first_module.removeClass( 'et_beneath_transparent_nav' );484 } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_menu' ) ) {485 /* Desktop / Mobile + Pagebuilder + Fullwidth Menu */486 $et_pb_first_row_first_module.css({ 'marginTop' : '' });487 } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_code' ) ) {488 /* Desktop / Mobile + Pagebuilder + Fullwidth code */489 var $et_pb_first_row_code = $et_pb_first_row_first_module;490 $et_pb_first_row_code.css({ 'paddingTop' : '' });491 $et_pb_first_row_code.css({492 'paddingTop' : ''493 });494 } else if ( $et_pb_first_row_first_module.is( '.et_pb_post_title' ) ) {495 /* Desktop / Mobile + Pagebuilder + Fullwidth Post Title */496 var $et_pb_first_row_title = $et_pb_first_row_first_module;497 $et_pb_first_row_title.css({498 'paddingTop' : ''499 });500 }501 } else if ( is_pb ) {502 /* Desktop / Mobile + Pagebuilder + Regular section */503 // Remove first row's inline padding top styling to prevent looping padding-top calculation504 $et_pb_first_row.css({ 'paddingTop' : '' });505 // Implementing padding-top + header_height506 $et_pb_first_row.css({507 'paddingTop' : ''508 });509 } else if ( is_no_pb_mobile ) {510 // Mobile + not pagebuilder511 $et_main_content_first_row.css({512 'paddingTop' : ''513 });514 } else {515 $('#main-content .container:first-child').css({516 'paddingTop' : ''517 });518 }519 }520 // Print or update inline style on <head>521 inline_style += '</style>';522 if ( $inline_style_length ) {523 $inline_style.replaceWith( inline_style );524 } else {525 $( 'head' ).append( inline_style );526 }527 // Remove nav transition marking, if there's any. It should only used once during first transition528 $('body').removeClass( 'nav-vertical-to-horizontal nav-horizontal-to-vertical' );529 // et_change_primary_nav_position( 0 );530 }531 // Fixing main header's box-shadow based on primary_nav_bg and fixed_primary_nav_bg532 function et_fix_main_header_box_shadow() {533 var primary_nav_bg = wp.customize( 'et_divi[primary_nav_bg]' )(),534 fixed_primary_nav_bg = $( 'body' ).hasClass( 'et_fixed_nav' ) ? wp.customize( 'et_divi[fixed_primary_nav_bg]' )() : '',535 et_custom_header_shadow_style = $( '<style />', { id: 'et_custom_header_shadow_style' }),536 $et_custom_header_shadow_style = $( '#et_custom_header_shadow_style' ),537 $et_custom_header_shadow_style_length = $et_custom_header_shadow_style.length;538 // Append styling539 // main-header's rule: if it's transparent, remove box-shadow540 if ( 'string' === typeof primary_nav_bg && 'rgba' === primary_nav_bg.substr( 0, 4 ) ) {541 et_custom_header_shadow_style.append( '#main-header{ background: '+primary_nav_bg+' !important;\n box-shadow: none; }' );542 } else {543 et_custom_header_shadow_style.append( '#main-header{ background: '+primary_nav_bg+' !important;\n box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);\n -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);\n -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); }' );544 }545 // fixed main-header's rule: 1) remove box-shadow if transparent. 2) if it uses default (#ffffff) derive color from primary_nav_bg546 if ( 'string' === typeof fixed_primary_nav_bg && ( 'rgba' === fixed_primary_nav_bg.substr( 0, 4 ) || ( 'rgba' === primary_nav_bg.substr( 0, 4 ) && '#ffffff' === fixed_primary_nav_bg ) ) ) {547 et_custom_header_shadow_style.append( '.et-fixed-header#main-header{ box-shadow: none !important; }' );548 } else {549 et_custom_header_shadow_style.append( '.et-fixed-header#main-header{ box-shadow: 0 0 7px rgba(0, 0, 0, 0.1) !important; \n -moz-box-shadow: 0 0 7px rgba(0, 0, 0, 0.1) !important; \n -webkit-box-shadow: 0 0 7px rgba(0, 0, 0, 0.1) !important; }' );550 }551 if ( '#ffffff' === fixed_primary_nav_bg ) {552 et_custom_header_shadow_style.append( '.et-fixed-header#main-header{ background: '+primary_nav_bg+' !important; }' );553 } else {554 et_custom_header_shadow_style.append( '.et-fixed-header#main-header{ background: '+fixed_primary_nav_bg+' !important; }' );555 }556 // Print / replace the custom styling557 if ( $et_custom_header_shadow_style_length ) {558 $et_custom_header_shadow_style.replaceWith( et_custom_header_shadow_style );559 } else {560 $( 'head' ).append( et_custom_header_shadow_style );561 }562 }563 function et_maybe_fix_header_style( mode ) {564 var $et_window = $(window),565 $et_window_width = $et_window.width(),566 $main_header = $('#main-header'),567 $main_header_height = $main_header.height(),568 $et_top_navigation = $('#et-top-navigation'),569 $logo_container = $('#main-header > .container > .logo_container'),570 $logo_container_length = $logo_container.length,571 $logo_container_splitted = $('.centered-inline-logo-wrap > .logo_container'),572 et_top_navigation_li_size = $et_top_navigation.children('nav').children('ul').children('li').size(),573 et_top_navigation_li_break_index = Math.round( et_top_navigation_li_size / 2 ) - 1;574 if ( $et_window_width > 980 && $logo_container_length && mode == 'split' && ! window.et_is_vertical_nav ) {575 $('<li class="centered-inline-logo-wrap"></li>').insertAfter($et_top_navigation.find('nav > ul >li:nth('+et_top_navigation_li_break_index+')') );576 $logo_container.appendTo( $et_top_navigation.find('.centered-inline-logo-wrap') );577 }578 if ( $et_window_width <= 980 && $logo_container_splitted.length || mode != 'split' ) {579 $logo_container_splitted.prependTo('#main-header > .container');580 $('#main-header .centered-inline-logo-wrap').remove();581 }582 // Update initial header height attribute583 if ( $et_window_width > 980 ) {584 $main_header.attr({ 'data-height-onload' : $main_header_height });585 }586 }587 function et_fix_slider_height() {588 var $et_pb_slider = $( '.et_pb_slider' );589 if ( ! $et_pb_slider.length ) {590 return;591 }592 $et_pb_slider.each( function() {593 var $slide = $(this).find( '.et_pb_slide' ),594 $slide_container = $slide.find( '.et_pb_container' ),595 max_height = 0;596 $slide_container.css( 'min-height', 0 );597 $slide.each( function() {598 var $this_el = $(this),599 height = $this_el.innerHeight();600 if ( max_height < height )601 max_height = height;602 } );603 $slide_container.css( 'min-height', max_height );604 } );605 }606 function et_maybe_create_secondary_nav() {607 if ( $( '#top-header' ).length ) {608 return;609 }610 $( 'body' )611 .addClass( 'et_secondary_nav_enabled' )612 .prepend( '<div id="top-header" class="et_nav_text_color_light"><div class="container"></div></div>' );613 et_fix_page_top_padding();614 }615 function et_maybe_remove_secondary_nav() {616 if ( ! $( '#top-header' ).length ) {617 return;618 }619 setTimeout( function() {620 if ( $( '#top-header .container' ).children().filter( ':visible' ).length ) {621 return;622 }623 $( 'body' )624 .removeClass( 'et_secondary_nav_enabled' )625 .removeClass( 'et_secondary_nav_two_panels' )626 .find( '#top-header' )627 .remove();628 et_fix_page_top_padding();629 }, 500 );630 }631 function add_menu_styles( to, style_id, is_fixed ) {632 var $full_style_id = $( 'style#et_menu_preview_' + style_id ),633 fixed_class = 'fixed' === is_fixed ? '.et-fixed-header' : '',634 menu_styles = "<style id='et_menu_preview_" + style_id + "'>\ @media all and ( min-width: 981px ) {\ ";635 // Append menu styles636 menu_styles += ".et_header_style_left " + fixed_class + " #et-top-navigation nav > ul > li > a { padding-bottom: " + to / 2 + "px; }\ ";637 menu_styles += ".et_header_style_left " + fixed_class + " #et-top-navigation { padding: " + to / 2 + "px 0 0 0; }\ ";638 menu_styles += ".et_header_style_split " + fixed_class + " #et-top-navigation nav > ul > li > a { padding-bottom: " + to / 2 + "px; }\ ";639 menu_styles += ".et_header_style_split " + fixed_class + " .centered-inline-logo-wrap { width: "+to+"px; margin: -"+to+"px 0; }\ ";640 menu_styles += ".et_header_style_split " + fixed_class + " .centered-inline-logo-wrap #logo { max-height: "+to+"px; }\ ";641 menu_styles += ".et_header_style_split " + fixed_class + " #et-top-navigation { padding: " + to / 2 + "px 0 0 0; }\ ";642 menu_styles += ".et_header_style_centered header#main-header" + fixed_class + " .logo_container { height: " + to + "px; }\ ";643 menu_styles += ".et_header_style_centered header#main-header" + fixed_class + " #top-menu > li > a { padding-bottom: " + to * .18 + "px; }\ ";644 menu_styles += ".et_header_style_slide " + fixed_class + " #et-top-navigation, .et_header_style_fullscreen " + fixed_class + " #et-top-navigation { padding: " + ( to - 18 ) / 2 + "px 0 " + ( to - 18 ) / 2 + "px 0 !important; }\ ";645 menu_styles += '}\ </style>';646 if ( $full_style_id.length ) {647 $( $full_style_id ).replaceWith( menu_styles );648 } else {649 $( 'head' ).append( menu_styles );650 }651 }652 function et_slide_to_top() {653 $('html, body').animate({654 scrollTop : 0655 }, 100, function() {656 setTimeout( function() {657 et_fix_saved_main_header_height( 'initial' );658 $(window).trigger('resize');659 }, 300 );660 });661 }662 function add_content_sidebar_style( sidebar_width ) {663 var content_width = 100 - parseInt( sidebar_width ),664 content_sidebar_style = $( '<style />', { id : 'theme-customizer-sidebar-width-css' } ),665 $content_sidebar_style = $('#theme-customizer-sidebar-width-css');666 content_sidebar_style.text( 'body #page-container #sidebar{ width:' + sidebar_width + '%; }\667 body #page-container #left-area{ width:' + content_width + '%; }\668 .et_right_sidebar #main-content .container:before{ right:' + sidebar_width+'% !important }\669 .et_left_sidebar #main-content .container:before{ left:'+sidebar_width+'% !important }\670 ');671 if ( $content_sidebar_style.length ) {672 $( $content_sidebar_style ).replaceWith( content_sidebar_style );673 } else {674 $( 'head' ).append( content_sidebar_style );675 }676 }677 /**678 * This is a simplified version of {@see et_builder_maybe_wrap_css_selector()}.679 * If multiple selectors (eg. selector1, selector2) are provided they will each be wrapped.680 *681 * @param selector682 */683 function maybe_wrap_css_selector(selector) {684 if (! isCustomPostType) {685 return selector;686 }687 var selectors = selector.split(',');688 var result = '';689 _.forEach(selectors, function(css_selector) {690 result += selectorWrapper + ' ' + css_selector;691 });692 return result.join(',');693 }694 var css = maybe_wrap_css_selector;695 /**696 * Basically mimics et_pb_print_module_styles_css() on functions.php697 * Append to <head> instead of adding inline styling. Module's individual styling > Customizer's module styles698 */699 function et_print_module_styles_css( id, type, selector, value, important ){700 // sanitize id into safe style's ID701 var style_id = id.replace(/[ +\/\[\]]/g,'_').toLowerCase(),702 $style = $('#' + style_id),703 $style_length = $style.length;704 // create DOM705 var style = $( '<style />', {706 id : style_id707 } );708 // Determine important tag709 if ( typeof important !== 'undefined' ){710 var important_tag = '!important';711 } else {712 var important_tag = '';713 }714 // append style into DOM715 switch( type ){716 case 'font-size':717 style.text( css(selector) + "{ font-size: " + value + "px " + important_tag + ";}" );718 // Option with specific adjustment for smaller columns719 var smaller_title_sections = [720 'et_divi[et_pb_audio-header_font_size]',721 'et_divi[et_pb_blog-title_font_size]',722 'et_divi[et_pb_cta-header_font_size]',723 'et_divi[et_pb_contact_form-header_font_size]',724 'et_divi[et_pb_login-header_font_size]',725 'et_divi[et_pb_signup-header_font_size]',726 'et_divi[et_pb_slider-header_font_size]',727 'et_divi[et_pb_slider-body_font_size]',728 'et_divi[et_pb_countdown_timer-header_font_size]'729 ];730 if( $.inArray( id, smaller_title_sections ) ){731 // font size coefficient732 switch ( id ) {733 case 'et_divi[et_pb_slider-header_font_size]':734 var font_size = parseInt( value ) * .565217391; // 26/46735 break;736 case 'et_divi[et_pb_slider-body_font_size]':737 var font_size = parseInt( value ) * .777777778; // 14/16738 break;739 default:740 var font_size = parseInt( value ) * .846153846; // 22/26741 break;742 }743 style.append( ".et_pb_column_1_3 " + css(selector) + " { font-size: " + font_size + "px " + important_tag + "; }" );744 style.append( ".et_pb_column_1_4 " + css(selector) + " { font-size: " + font_size + "px " + important_tag + "; }" );745 }746 break;747 case 'font-styles':748 style.text( css(selector) + " { " + et_set_font_styles( value, important_tag ) + " }" );749 break;750 case 'letter-spacing':751 style.text( css(selector) + "{ letter-spacing: " + value + "px " + important_tag + ";}" );752 break;753 case 'line-height':754 style.text( css(selector) + "{ line-height: " + value + "em " + important_tag + ";}" );755 break;756 case 'color':757 style.text( css(selector) + "{ color: " + value + " " + important_tag + ";}" );758 break;759 case 'background-color':760 style.text( css(selector) + "{ background-color: " + value + " " + important_tag + ";}" );761 break;762 case 'border-radius':763 style.text( css(selector) + " { -moz-border-radius: " + value + "px; -webkit-border-radius: " + value + "px; border-radius: " + value + "px; }" );764 break;765 case 'width':766 style.text( css(selector) + "{ width: " + value + "px " + important_tag + ";}" );767 break;768 case 'height':769 style.text( css(selector) + "{ height: " + value + "px " + important_tag + ";}" );770 break;771 case 'padding':772 style.text( css(selector) + "{ padding: " + value + "px " + important_tag + ";}" );773 break;774 case 'padding-top-bottom':775 style.text( css(selector) + "{ padding: " + value + "px 0 " + important_tag + ";}" );776 break;777 case 'padding-tabs':778 var padding_tab_top_bottom = parseInt( value ) * 0.133333333,779 padding_tab_active_top = padding_tab_top_bottom + 1,780 padding_tab_active_bottom = padding_tab_top_bottom - 1,781 padding_tab_content = parseInt( value ) * 0.8;782 // negative result will cause layout issue783 if ( padding_tab_active_bottom < 0 ) {784 padding_tab_active_bottom = 0;785 }786 style.text( css('.et_pb_tabs_controls li') + " { padding: " + padding_tab_active_top + "px " + value + "px " + padding_tab_active_bottom + "px; }" );787 style.text( css('.et_pb_tabs_controls li.et_pb_tab_active') + " { padding: " + padding_tab_top_bottom + "px " + value + "px; }" );788 style.text( css('.et_pb_all_tabs') + " { padding: " + padding_tab_content + "px " + value + "px " + important_tag + "; }" );789 break;790 case 'padding-slider':791 style.text( css(selector) + "{ padding-top: " + value + "%; padding-bottom: " + value + "%; }" );792 if ( 'et_pagebuilder_slider_padding' === id ) {793 style.append( '@media only screen and ( max-width: 767px ) { ' + css(selector) + '{ padding-top: 16%; padding-bottom: 16%; } }' );794 }795 break;796 case 'padding-call-to-action':797 value = parseInt( value );798 style.text( css('.et_pb_promo') + " { padding: " + value + "px " + ( value * ( 60 / 40 ) ) + "px; }" );799 style.append( css('.et_pb_column_1_2 .et_pb_promo') + " { padding: " + value + "px; }" );800 style.append( css('.et_pb_column_1_3 .et_pb_promo') + " { padding: " + value + "px; }" );801 style.append( css('.et_pb_column_1_4 .et_pb_promo') + " { padding: " + value + "px; }" );802 break;803 case 'social-icon-size':804 var icon_margin = parseInt( value ) * 0.57;805 var icon_dimension = parseInt( value ) * 2;806 style.text( css('.et_pb_social_media_follow li a.icon') + " { margin-right: " + icon_margin + "px; width: " + icon_dimension + "px; height: " + icon_dimension + "px; }" );807 style.text( css('.et_pb_social_media_follow li a.icon::before') + " { width: " + icon_dimension + "px; height: " + icon_dimension + "px; font-size: " + value + "px; line-height: " + icon_dimension + "px; }" );808 style.text( css('.et_pb_social_media_follow li a.follow_button') + " { font-size:" + value + "px; }" );809 break;810 case 'border-top-style':811 style.text( css(selector) + "{ border-top-style: " + value + " " + important_tag + "; }" );812 break;813 case 'border-top-width':814 style.text( css(selector) + "{ border-top-width: " + value + "px " + important_tag + "; }" );815 break;816 }817 // Insert custom styling818 if ( $style_length ) {819 $style.replaceWith( style );820 } else {821 $( 'head' ).append( style );822 }823 }824 function et_set_font_styles( value, important_tag ) {825 var font_styles = value.split( '|' ),826 style = '';827 if ( $.inArray( 'bold', font_styles ) >= 0 ) {828 style += "font-weight: bold " + important_tag + ";";829 } else {830 style += "font-weight: inherit " + important_tag + ";";831 }832 if ( $.inArray( 'italic', font_styles ) >= 0 ) {833 style += "font-style: italic " + important_tag + ";";834 } else {835 style += "font-style: inherit " + important_tag + ";";836 }837 if ( $.inArray( 'underline', font_styles ) >= 0 ) {838 style += "text-decoration: underline " + important_tag + ";";839 } else {840 style += "text-decoration: inherit " + important_tag + ";";841 }842 if ( $.inArray( 'uppercase', font_styles ) >= 0 ) {843 style += "text-transform: uppercase " + important_tag + ";";844 } else {845 style += "text-transform: inherit " + important_tag + ";";846 }847 return style;848 }849 function et_fix_footer_widget_bullet_top(){850 var style = $( '<style />', { id : 'footer-widget-bullet-style' }),851 $style = $( '#footer-widget-bullet-style' ),852 line_height = parseFloat( $('.footer-widget .et_pb_widget div').css( 'line-height' ) ),853 footer_widget_bullet_top = ( line_height / 2 ) - 3;854 style.text( "#footer-widgets .footer-widget li:before { top: " + footer_widget_bullet_top + "px; }" );855 // Insert custom styling856 if ( $style.length ) {857 $style.replaceWith( style );858 } else {859 $( 'head' ).append( style );860 }861 }862 function et_customizer_update_styles( style_id, $style_content ) {863 if ( $( style_id ).length ) {864 if ( '' !== $style_content ) {865 $( style_id ).replaceWith( $style_content );866 } else {867 $( style_id ).remove();868 }869 } else {870 $( 'head' ).append( $style_content );871 }872 }873 function et_calculate_header_values() {874 var $top_header = $( '#top-header' ),875 secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHeight() : 0,876 admin_bar_height = $( '#wpadminbar' ).length ? $( '#wpadminbar' ).innerHeight() : 0,877 $slide_menu_container = $( '.et_header_style_slide .et_slide_in_menu_container' );878 et_header_height = $( '#main-header' ).innerHeight() + secondary_nav_height,879 et_header_modifier = et_header_height <= 90 ? et_header_height - 29 : et_header_height - 56,880 et_header_offset = et_header_modifier + admin_bar_height;881 et_primary_header_top = secondary_nav_height + admin_bar_height;882 if ( $slide_menu_container.length && ! $( 'body' ).hasClass( 'et_pb_slide_menu_active' ) ) {883 $slide_menu_container.css( { right: '-' + $slide_menu_container.innerWidth() + 'px' } );884 if ( $( 'body' ).hasClass( 'et_boxed_layout' ) ) {885 var page_container_margin = $( '#page-container' ).css( 'margin-left' );886 $( '#main-header' ).css( { left : page_container_margin } );887 }888 }889 }890 function et_fix_fullscreen_section() {891 var $et_window = $(window);892 $( 'section.et_pb_fullscreen' ).each( function(){893 var $this_section = $( this );894 $.proxy( window.et_calc_fullscreen_section, $this_section )();895 $et_window.on( 'resize', $.proxy( window.et_calc_fullscreen_section, $this_section ) );896 });897 }898 function et_set_right_vertical_menu() {899 var $body = $( 'body' );900 if ( $body.hasClass( 'et_boxed_layout' ) && $body.hasClass( 'et_vertical_fixed' ) && $body.hasClass( 'et_vertical_right' ) ) {901 var header_offset = parseFloat( $( '#page-container' ).css( 'margin-right' ) );902 header_offset += ( parseFloat( $( '#et-main-area' ).css( 'margin-right' ) ) - 225 );903 header_offset = 0 > header_offset ? 0 : header_offset;904 $( '#main-header' ).css( 'left', '' );905 $( '#main-header' ).css( 'right', header_offset );906 }907 }908 function et_fix_slide_in_top_bar() {909 var $body = $( 'body' );910 if ( 0 === $body.find( '.et_slide_menu_top' ).height() ) {911 $body.find( '.et_slide_menu_top' ).css( { 'display' : 'none' } );912 } else {913 $body.find( '.et_slide_menu_top' ).css( { 'display' : 'block' } );914 }915 }916 et_fix_slide_in_top_bar();917 wp.customize( 'blogname', function( value ) {918 value.bind( function( to ) {919 $('#logo').attr({ 'alt' : to });920 } );921 } );922 wp.customize( 'et_divi[link_color]', function( value ) {923 value.bind( function( to ) {924 $( 'article p:not(.post-meta) a, .comment-edit-link, .pinglist a, .pagination a' ).css( 'color', to );925 } );926 } );927 wp.customize( 'et_divi[body_font_size]', function( value ) {928 value.bind( function( to ) {929 var widget = $( '.footer-widget li' ).css( 'font-size' );930 $( '#main-content, .et_pb_column_1_2 .et_quote_content blockquote cite, .et_pb_column_1_2 .et_link_content a.et_link_main_url, .et_pb_column_1_3 .et_quote_content blockquote cite, .et_pb_column_3_8 .et_quote_content blockquote cite, .et_pb_column_1_4 .et_quote_content blockquote cite, .et_pb_blog_grid .et_quote_content blockquote cite, .et_pb_column_1_3 .et_link_content a.et_link_main_url, .et_pb_column_3_8 .et_link_content a.et_link_main_url, .et_pb_column_1_4 .et_link_content a.et_link_main_url, .et_pb_blog_grid .et_link_content a.et_link_main_url' ).css( 'font-size', to + 'px' );931 $( '.et_pb_slide_content, .et_pb_best_value' ).css( 'font-size', to * 1.14 + 'px' );932 if ( to == widget ) {933 $( '#main-footer li, #main-footer a, #main-footer p, #main-footer' ).css( 'font-size', to + 'px' );934 }935 } );936 } );937 wp.customize( 'et_divi[phone_body_font_size]', function( value ) {938 value.bind( function( to ) {939 $( 'head style#phone_body_font_size' ).remove(),940 custom_style = "<style id='phone_body_font_size'>\941 @media only screen and ( max-width: 767px ) {\942 #main-content, " + css('.et_pb_column_1_2 .et_quote_content blockquote cite, .et_pb_column_1_2 .et_link_content a.et_link_main_url, .et_pb_column_1_3 .et_quote_content blockquote cite, .et_pb_column_3_8 .et_quote_content blockquote cite, .et_pb_column_1_4 .et_quote_content blockquote cite, .et_pb_blog_grid .et_quote_content blockquote cite, .et_pb_column_1_3 .et_link_content a.et_link_main_url, .et_pb_column_3_8 .et_link_content a.et_link_main_url, .et_pb_column_1_4 .et_link_content a.et_link_main_url, .et_pb_blog_grid .et_link_content a.et_link_main_url') + ", #main-footer li, #main-footer a, #main-footer p, #main-footer { font-size:" + to + "px !important; }\943 " + css('.et_pb_slide_content, .et_pb_best_value') + " { font-size:" + to * 1.14 + "px !important; }\944 }\945 </style>",946 $( 'head' ).append( custom_style );947 } );948 } );949 wp.customize( 'et_divi[tablet_body_font_size]', function( value ) {950 value.bind( function( to ) {951 $( 'head style#tablet_body_font_size' ).remove(),952 custom_style = "<style id='tablet_body_font_size'>\953 @media only screen and ( max-width: 980px ) {\954 #main-content, " + css('.et_pb_column_1_2 .et_quote_content blockquote cite, .et_pb_column_1_2 .et_link_content a.et_link_main_url, .et_pb_column_1_3 .et_quote_content blockquote cite, .et_pb_column_3_8 .et_quote_content blockquote cite, .et_pb_column_1_4 .et_quote_content blockquote cite, .et_pb_blog_grid .et_quote_content blockquote cite, .et_pb_column_1_3 .et_link_content a.et_link_main_url, .et_pb_column_3_8 .et_link_content a.et_link_main_url, .et_pb_column_1_4 .et_link_content a.et_link_main_url, .et_pb_blog_grid .et_link_content a.et_link_main_url') + ", #main-footer li, #main-footer a, #main-footer p, #main-footer { font-size:" + to + "px !important; }\955 " + css('.et_pb_slide_content, .et_pb_best_value') + " { font-size:" + to * 1.14 + "px !important; }\956 }\957 </style>",958 $( 'head' ).append( custom_style );959 } );960 } );961 wp.customize( 'et_divi[section_padding]', function( value ) {962 value.bind( function( to ) {963 // Don't use cache selector as it might be modified by other controls964 var $et_transparent_nav = $( '.et_transparent_nav' );965 // Detect transparent nav & non vertical nav966 if ( $et_transparent_nav.length && ! window.et_is_vertical_nav ) {967 $( '.et_pb_section:nth-child(1)' ).css({968 'paddingBottom' : to + '%'969 });970 $( '.et_pb_section:gt(0)' ).css({971 'padding' : to + '% 0'972 });973 // first section's paddingTop has to be done after the other paddings have been added974 $( '.et_pb_section:nth-child(1)' ).css({975 'paddingTop' : ( parseInt( $( '#main-header' ).innerHeight() ) + parseInt( $( '#top-header' ).innerHeight() ) + parseInt( $( '.et_pb_section:nth-child(1)' ).css( 'paddingBottom' ) ) - 8 )976 });977 } else {978 $( '.et_pb_section' ).css( 'padding', to + '% 0' );979 }980 } );981 } );982 wp.customize( 'et_divi[row_padding]', function( value ) {983 value.bind( function( to ) {984 $( '.et_pb_row' ).css( 'padding', to + '% 0' );985 } );986 } );987 wp.customize( 'et_divi[phone_row_height]', function( value ) {988 value.bind( function( to ) {989 $( 'head style#phone_row_height' ).remove(),990 custom_style = "<style id='phone_row_height'>\991 @media only screen and ( max-width: 767px ) {\992 " + css('.et_pb_row, .et_pb_column .et_pb_row_inner') + " { padding: " + to + "px 0 !important; }\993 }\994 </style>",995 $( 'head' ).append( custom_style );996 } );997 } );998 wp.customize( 'et_divi[tablet_row_height]', function( value ) {999 value.bind( function( to ) {1000 $( 'head style#tablet_row_height' ).remove(),1001 custom_style = "<style id='tablet_row_height'>\1002 @media only screen and ( max-width: 980px ) {\1003 " + css('.et_pb_row, .et_pb_column .et_pb_row_inner') + " { padding: " + to + "px 0 !important; }\1004 }\1005 </style>",1006 $( 'head' ).append( custom_style );1007 } );1008 } );1009 wp.customize( 'et_divi[phone_section_height]', function( value ) {1010 value.bind( function( to ) {1011 $( 'head style#phone_section_height' ).remove(),1012 custom_style = "<style id='phone_section_height'>\1013 @media only screen and ( max-width: 767px ) {\1014 " + css('.et_pb_section') + " { padding: " + to + "px 0; }\1015 }\1016 </style>",1017 $( 'head' ).append( custom_style );1018 } );1019 } );1020 wp.customize( 'et_divi[tablet_section_height]', function( value ) {1021 value.bind( function( to ) {1022 $( 'head style#tablet_section_height' ).remove(),1023 custom_style = "<style id='tablet_section_height'>\1024 @media only screen and ( max-width: 980px ) {\1025 " + css('.et_pb_section') + " { padding: " + to + "px 0; }\1026 }\1027 </style>",1028 $( 'head' ).append( custom_style );1029 } );1030 } );1031 wp.customize( 'et_divi[body_header_size]', function( value ) {1032 value.bind( function( to ) {1033 var widget = $( '.footer-widget h4' ).css( 'font-size' );1034 $( 'h1' ).css( 'font-size', to + 'px' );1035 $( 'h2, .product .related h2, .et_pb_column_1_2 .et_quote_content blockquote p' ).css( 'font-size', to * 0.86 + 'px' );1036 $( 'h3' ).css( 'font-size', to * 0.73 + 'px' );1037 $( 'h5' ).css( 'font-size', to * 0.53 + 'px' );1038 $( 'h6' ).css( 'font-size', to * 0.47 + 'px' );1039 $( '.woocommerce ul.products li.product h3, .woocommerce-page ul.products li.product h3, .et_pb_gallery_grid .et_pb_gallery_item h3, .et_pb_portfolio_grid .et_pb_portfolio_item h2, .et_pb_filterable_portfolio_grid .et_pb_portfolio_item h2, .et_pb_column_1_4 .et_pb_audio_module_content h2 ' ).css( 'font-size', to * 0.53 + 'px' );1040 $( '#main-content h4, .et_pb_column_1_3 .et_pb_post h2, .et_pb_column_1_4 .et_pb_post h2, .et_pb_blog_grid h2, .et_pb_column_1_3 .et_quote_content blockquote p, .et_pb_column_3_8 .et_quote_content blockquote p, .et_pb_column_1_4 .et_quote_content blockquote p, .et_pb_blog_grid .et_quote_content blockquote p, .et_pb_column_1_3 .et_link_content h2, .et_pb_column_3_8 .et_link_content h2, .et_pb_column_1_4 .et_link_content h2, .et_pb_blog_grid .et_link_content h2, .et_pb_column_1_3 .et_audio_content h2, .et_pb_column_3_8 .et_audio_content h2, .et_pb_column_1_4 .et_audio_content h2, .et_pb_blog_grid .et_audio_content h2, .et_pb_column_3_8 .et_pb_audio_module_content h2, .et_pb_column_1_3 .et_pb_audio_module_content h2, .et_pb_gallery_grid .et_pb_gallery_item h3, .et_pb_portfolio_grid .et_pb_portfolio_item h2, .et_pb_filterable_portfolio_grid .et_pb_portfolio_item h2, .et_pb_circle_counter h3, .et_pb_number_counter h3' ).css( 'font-size', to * 0.6 + 'px' );1041 $( '.et_pb_slide_description .et_pb_slide_title' ).css( 'font-size', to * 1.53 + 'px' );1042 if ( to == widget ) {1043 $( '.footer-widget h4' ).css( 'font-size', to * 0.6 + 'px' );1044 }1045 } );1046 } );1047 wp.customize( 'et_divi[body_header_height]', function( value ) {1048 value.bind( function( to ) {1049 $( 'head style#body_header_height' ).remove(),1050 custom_style = "<style id='body_header_height'>\1051 h1, h2, h3, h4, h5, h6, " + css('h1, h2, h3, h4, h5, h6, .et_quote_content blockquote p, .et_pb_slide_description .et_pb_slide_title') + " { line-height: " + to + "em; }\1052 </style>",1053 $( 'head' ).append( custom_style );1054 } );1055 } );1056 wp.customize( 'et_divi[body_font_height]', function( value ) {1057 value.bind( function( to ) {1058 $( 'head style#body_font_height' ).remove(),1059 custom_style = "<style id='body_font_height'>\1060 body { line-height: " + to + "em; }\1061 </style>",1062 $( 'head' ).append( custom_style );1063 } );1064 } );1065 wp.customize( 'et_divi[body_header_spacing]', function( value ) {1066 value.bind( function( to ) {1067 $( 'head style#body_header_spacing' ).remove(),1068 custom_style = "<style id='body_header_spacing'>\1069 h1, h2, h3, h4, h5, h6, " + css('h1, h2, h3, h4, h5, h6, .et_quote_content blockquote p, .et_pb_slide_description .et_pb_slide_title') + " { letter-spacing: " + to + "px; }\1070 </style>",1071 $( 'head' ).append( custom_style );1072 } );1073 } );1074 wp.customize( 'et_divi[primary_nav_font_spacing]', function( value ) {1075 value.bind( function( to ) {1076 $( 'head style#primary_nav_font_spacing' ).remove(),1077 custom_style = "<style id='primary_nav_font_spacing'>\1078 #top-menu li a, .et_search_form_container input { letter-spacing: " + to + "px; }\1079 .et_search_form_container input::-moz-placeholder { letter-spacing: " + to + "px; }\1080 .et_search_form_container input::-webkit-input-placeholder { letter-spacing: " + to + "px; }\1081 .et_search_form_container input:-ms-input-placeholder { letter-spacing: " + to + "px; }\1082 </style>",1083 $( 'head' ).append( custom_style );1084 } );1085 } );1086 wp.customize( 'et_divi[secondary_nav_fullwidth]', function( value ) {1087 value.bind( function( to ) {1088 var $body = $('body');1089 if ( to ) {1090 $body.addClass('et_fullwidth_secondary_nav');1091 } else {1092 $body.removeClass('et_fullwidth_secondary_nav');1093 }1094 } );1095 } );1096 wp.customize( 'et_divi[secondary_nav_font_spacing]', function( value ) {1097 value.bind( function( to ) {1098 $( 'head style#secondary_nav_font_spacing' ).remove(),1099 custom_style = "<style id='secondary_nav_font_spacing'>\1100 #top-header, #top-header a, #et-secondary-nav li li a, #top-header .et-social-icon a:before { letter-spacing: " + to + "px; }\1101 </style>",1102 $( 'head' ).append( custom_style );1103 } );1104 } );1105 wp.customize( 'et_divi[phone_header_font_size]', function( value ) {1106 value.bind( function( to ) {1107 $( 'head style#phone_header_font_size' ).remove(),1108 custom_style = "<style id='phone_header_font_size'>\1109 @media only screen and ( max-width: 767px ) {\1110 h1, " + css('h1') + " { font-size: " + to + "px !important; }\1111 h2, " + css('h2') + " { font-size: " + to * 0.86 + "px !important; }\1112 h3, " + css('h3') + " { font-size: " + to * 0.73 + "px !important; }\1113 .woocommerce ul.products li.product h3, .woocommerce-page ul.products li.product h3, " + css('.et_pb_gallery_grid .et_pb_gallery_item h3, .et_pb_portfolio_grid .et_pb_portfolio_item h2, .et_pb_filterable_portfolio_grid .et_pb_portfolio_item h2, .et_pb_column_1_4 .et_pb_audio_module_content h2') + " { font-size: " + to * 0.53 + "px !important; }\1114 #main-content h4, " + css('#main-content h4, .et_pb_column_1_3 .et_pb_post h2, .et_pb_column_1_4 .et_pb_post h2, .et_pb_blog_grid h2, .et_pb_column_1_3 .et_quote_content blockquote p, .et_pb_column_3_8 .et_quote_content blockquote p, .et_pb_column_1_4 .et_quote_content blockquote p, .et_pb_blog_grid .et_quote_content blockquote p, .et_pb_column_1_3 .et_link_content h2, .et_pb_column_3_8 .et_link_content h2, .et_pb_column_1_4 .et_link_content h2, .et_pb_blog_grid .et_link_content h2, .et_pb_column_1_3 .et_audio_content h2, .et_pb_column_3_8 .et_audio_content h2, .et_pb_column_1_4 .et_audio_content h2, .et_pb_blog_grid .et_audio_content h2, .et_pb_column_3_8 .et_pb_audio_module_content h2, .et_pb_column_1_3 .et_pb_audio_module_content h2, .et_pb_gallery_grid .et_pb_gallery_item h3, .et_pb_portfolio_grid .et_pb_portfolio_item h2, .et_pb_filterable_portfolio_grid .et_pb_portfolio_item h2, .et_pb_circle_counter h3, .et_pb_number_counter h3') + " { font-size: " + to * 0.6 + "px !important; }\1115 " + css('.et_pb_slide_description .et_pb_slide_title') + " { font-size: " + to * 1.53 + "px !important; }\1116 .footer-widget h4 { font-size: " + to * 0.6 + "px !important; }\1117 h5, " + css('h5') + " { font-size: " + to * 0.53 + "px !important; }\1118 h6, " + css('h6') + " { font-size: " + to * 0.47 + "px !important; }\1119 }\1120 </style>",1121 $( 'head' ).append( custom_style );1122 } );1123 } );1124 wp.customize( 'et_divi[tablet_header_font_size]', function( value ) {1125 value.bind( function( to ) {1126 $( 'head style#tablet_header_font_size' ).remove(),1127 custom_style = "<style id='tablet_header_font_size'>\1128 @media only screen and ( max-width: 980px ) {\1129 h1, " + css('h1') + " { font-size: " + to + "px !important; }\1130 h2, " + css('h2') + " { font-size: " + to * 0.86 + "px !important; }\1131 h3, " + css('h3') + " { font-size: " + to * 0.73 + "px !important; }\1132 .woocommerce ul.products li.product h3, .woocommerce-page ul.products li.product h3, " + css('.et_pb_gallery_grid .et_pb_gallery_item h3, .et_pb_portfolio_grid .et_pb_portfolio_item h2, .et_pb_filterable_portfolio_grid .et_pb_portfolio_item h2, .et_pb_column_1_4 .et_pb_audio_module_content h2') + " { font-size: " + to * 0.53 + "px !important; }\1133 #main-content h4, " + css('#main-content h4, .et_pb_column_1_3 .et_pb_post h2, .et_pb_column_1_4 .et_pb_post h2, .et_pb_blog_grid h2, .et_pb_column_1_3 .et_quote_content blockquote p, .et_pb_column_3_8 .et_quote_content blockquote p, .et_pb_column_1_4 .et_quote_content blockquote p, .et_pb_blog_grid .et_quote_content blockquote p, .et_pb_column_1_3 .et_link_content h2, .et_pb_column_3_8 .et_link_content h2, .et_pb_column_1_4 .et_link_content h2, .et_pb_blog_grid .et_link_content h2, .et_pb_column_1_3 .et_audio_content h2, .et_pb_column_3_8 .et_audio_content h2, .et_pb_column_1_4 .et_audio_content h2, .et_pb_blog_grid .et_audio_content h2, .et_pb_column_3_8 .et_pb_audio_module_content h2, .et_pb_column_1_3 .et_pb_audio_module_content h2, .et_pb_gallery_grid .et_pb_gallery_item h3, .et_pb_portfolio_grid .et_pb_portfolio_item h2, .et_pb_filterable_portfolio_grid .et_pb_portfolio_item h2, .et_pb_circle_counter h3, .et_pb_number_counter h3') + " { font-size: " + to * 0.6 + "px !important; }\1134 " + css('.et_pb_slide_description .et_pb_slide_title') + " { font-size: " + to * 1.53 + "px !important; }\1135 .footer-widget h4 { font-size: " + to * 0.6 + "px !important; }\1136 h5, " + css('h5') + " { font-size: " + to * 0.53 + "px !important; }\1137 h6, " + css('h6') + " { font-size: " + to * 0.47 + "px !important; }\1138 }\1139 </style>",1140 $( 'head' ).append( custom_style );1141 } );1142 } );1143 wp.customize( 'et_divi[font_color]', function( value ) {1144 value.bind( function( to ) {1145 $( 'body' ).css( 'color', to );1146 } );1147 } );1148 wp.customize( 'et_divi[accent_color]', function( value ) {1149 value.bind( function( to ) {1150 var $accent_style = "<style id='accent_color'>" + css('.et_pb_counter_amount, .et_pb_featured_table .et_pb_pricing_heading, .et_pb_pricing_table_button') + ", .comment-reply-link, " + css('.form-submit .et_pb_button, .et_quote_content, .et_link_content, .et_audio_content, .et_pb_post_slider.et_pb_bg_layout_dark') + ", #page-container .et_slide_in_menu_container, " + css('.et_pb_contact p input[type=\'radio\']:checked + label i:before') + ", #top-header, .et-fixed-header#top-header, .et-fixed-header#top-header #et-secondary-nav li ul { background-color: " + to + "; }\1151 #et_search_icon:hover, .mobile_menu_bar:before" + css('.mobile_menu_bar:before') + ", .footer-widget h4, #main-footer .footer-widget h4, .et-social-icon a:hover, " + css('.et_pb_sum, .et_pb_pricing li a, .et_overlay:before, .et_pb_member_social_links a:hover, .et_pb_widget li a:hover, .et_pb_bg_layout_light .et_pb_promo_button, .et_pb_bg_layout_light .et_pb_more_button, .et_pb_filterable_portfolio .et_pb_portfolio_filters li a.active, .et_pb_filterable_portfolio .et_pb_portofolio_pagination ul li a.active, .et_pb_gallery .et_pb_gallery_pagination ul li a.active') + ", .wp-pagenavi span.current, .wp-pagenavi a:hover, " + css('.et_pb_contact_submit') + ", .et_password_protected_form .et_submit_button, " + css('.et_pb_bg_layout_light .et_pb_newsletter_button') + ", .nav-single a, .posted_in a, " + css('.nav-single a, .posted_in a, .et_pb_contact p input[type=\'checkbox\']:checked + label i:before') + ", .woocommerce .star-rating span::before, " + css('.woocommerce .star-rating span::before') + " { color:" + to + "; }\1152 .et-search-form, .nav li ul, .et_mobile_menu, " + css('.nav li ul, .et_mobile_menu') + ", .footer-widget li:before, .et_pb_pricing li:before { border-color: " + to + "; }\1153 </style>",1154 style_id = 'style#accent_color';1155 et_customizer_update_styles( style_id, $accent_style );1156 } );1157 } );1158 wp.customize( 'et_divi[primary_nav_bg]', function( value ) {1159 value.bind( function( to ) {1160 var $body = $('body'),1161 $body_has_et_transparent_nav = $body.hasClass( 'et_transparent_nav' );1162 $( '#main-header, #main-header .nav li ul, .et-search-form, #main-header .et_mobile_menu' ).css( 'background-color', to );1163 // Transition from fixed color to transparent color1164 if ( ! $body_has_et_transparent_nav && to.substr( 0, 4 ) === 'rgba' ) {1165 $body.addClass( 'et_transparent_nav' );1166 $( 'head' ).append( "<style id='remove_transparent_margin'>\1167 body #page-container { margin-top: 0 !important; }\1168 </style>" );1169 et_fix_page_container_position();1170 window.et_is_transparent_nav = true;1171 }1172 // Transition from transparent to fixed color1173 if ( $body_has_et_transparent_nav && to.substr( 0, 4 ) !== 'rgba' ) {1174 $body.removeClass( 'et_transparent_nav' );1175 et_fix_page_container_position();1176 $( '#remove_transparent_margin' ).remove();1177 window.et_is_transparent_nav = false;1178 }1179 // Always fix main header's background and box-shadow on change1180 et_fix_main_header_box_shadow();1181 // Fix full width header in fullscreen mode when transitioning from/to alpha color1182 et_fix_fullscreen_section();1183 } );1184 } );1185 wp.customize( 'et_divi[secondary_nav_bg]', function( value ) {1186 value.bind( function( to ) {1187 $( '#top-header, #et-secondary-nav li ul' ).css( 'background-color', to );1188 } );1189 } );1190 wp.customize( 'et_divi[secondary_nav_dropdown_bg]', function( value ) {1191 value.bind( function( to ) {1192 $( '#et-secondary-nav li ul' ).css( 'background-color', to );1193 } );1194 } );1195 wp.customize( 'et_divi[secondary_nav_dropdown_link_color]', function( value ) {1196 value.bind( function( to ) {1197 $( '#et-secondary-nav li ul a' ).css( 'color', to );1198 } );1199 } );1200 wp.customize( 'et_divi[primary_nav_dropdown_bg]', function( value ) {1201 value.bind( function( to ) {1202 $( '#et-top-navigation li ul' ).css( 'background-color', to );1203 } );1204 } );1205 wp.customize( 'et_divi[primary_nav_dropdown_line_color]', function( value ) {1206 value.bind( function( to ) {1207 $( '.nav li ul' ).css( 'border-color', to );1208 } );1209 } );1210 wp.customize( 'et_divi[primary_nav_dropdown_link_color]', function( value ) {1211 value.bind( function( to ) {1212 $( '#et-top-navigation li ul a' ).css( 'color', to );1213 } );1214 } );1215 wp.customize( 'et_divi[fixed_secondary_nav_bg]', function( value ) {1216 value.bind( function( to ) {1217 $( 'head style#fixed_secondary_nav_bg' ).remove(),1218 custom_style = "<style id='fixed_secondary_nav_bg'>\1219 @media only screen and ( min-width: 981px ) {\1220 .et-fixed-header#top-header, .et-fixed-header#top-header #et-secondary-nav li ul { background-color: " + to + " !important; }\1221 }\1222 </style>",1223 $( 'head' ).append( custom_style );1224 } );1225 } );1226 wp.customize( 'et_divi[fixed_primary_nav_bg]', function( value ) {1227 value.bind( function( to ) {1228 $( 'head style#fixed_primary_nav_bg' ).remove(),1229 custom_style = "<style id='fixed_primary_nav_bg'>\1230 @media only screen and ( min-width: 981px ) {\1231 .et-fixed-header#main-header .nav li ul, .et-fixed-header .et-search-form { background-color: " + to + " !important; }\1232 }\1233 </style>",1234 $( 'head' ).append( custom_style );1235 et_fix_main_header_box_shadow();1236 } );1237 } );1238 wp.customize( 'et_divi[mobile_primary_nav_bg]', function( value ) {1239 value.bind( function( to ) {1240 $( 'head style#mobile_primary_nav_bg' ).remove(),1241 custom_style = "<style id='mobile_primary_nav_bg'>\1242 @media only screen and ( max-width: 980px ) {\1243 body #main-header, #main-header .nav li ul, .et-search-form, #main-header .et_mobile_menu { background-color: " + to + " !important; }\1244 }\1245 </style>",1246 $( 'head' ).append( custom_style );1247 et_fix_main_header_box_shadow();1248 } );1249 } );1250 wp.customize( 'et_divi[fixed_primary_nav_font_size]', function( value ) {1251 value.bind( function( to ) {1252 $( 'head style#fixed_primary_nav_font_size' ).remove(),1253 custom_style = "<style id='fixed_primary_nav_font_size'>\1254 @media only screen and ( min-width: 981px ) {\1255 .et-fixed-header #top-menu li a { font-size: " + to + "px !important; }\1256 }\1257 </style>",1258 $( 'head' ).append( custom_style );1259 } );1260 } );1261 wp.customize( 'et_divi[fixed_menu_link]', function( value ) {1262 value.bind( function( to ) {1263 $( 'head style#fixed_menu_link' ).remove(),1264 custom_style = "<style id='fixed_menu_link'>\1265 @media only screen and ( min-width: 981px ) {\1266 .et-fixed-header #top-menu a, .et-fixed-header #et_search_icon:before, .et-fixed-header #et_top_search .et-search-form input, .et-fixed-header .et_search_form_container input,.et-fixed-header .et_close_search_field:after { color: " + to + " !important; }\1267 .et-fixed-header .et_search_form_container input::-moz-placeholder { color: " + to + " !important; }\1268 .et-fixed-header .et_search_form_container input::-webkit-input-placeholder { color: " + to + " !important; }\1269 .et-fixed-header .et_search_form_container input:-ms-input-placeholder { color: " + to + " !important; }\1270 }\1271 </style>",1272 $( 'head' ).append( custom_style );1273 } );1274 } );1275 wp.customize( 'et_divi[fixed_menu_link_active]', function( value ) {1276 value.bind( function( to ) {1277 $( 'head style#fixed_menu_link_active' ).remove(),1278 custom_style = "<style id='fixed_menu_link_active'>\1279 @media only screen and ( min-width: 981px ) {\1280 .et-fixed-header #top-menu li.current-menu-ancestor > a, .et-fixed-header #top-menu li.current-menu-item > a { color: " + to + " !important; }\1281 }\1282 </style>",1283 $( 'head' ).append( custom_style );1284 } );1285 } );1286 wp.customize( 'et_divi[fixed_secondary_menu_link]', function( value ) {1287 value.bind( function( to ) {1288 var $style = "<style id='fixed_secondary_menu_link'>.et-fixed-header#top-header, .et-fixed-header#top-header a { color: " + to + " !important; }\1289 </style>",1290 style_id = 'style#fixed_secondary_menu_link';1291 et_customizer_update_styles( style_id, $style );1292 } );1293 } );1294 wp.customize( 'et_divi[header_color]', function( value ) {1295 value.bind( function( to ) {1296 $( 'head style#header_color' ).remove(),1297 custom_style = "<style id='header_color'>\1298 h1,h2,h3,h4,h5,h6" + css('h1,h2,h3,h4,h5,h6') + " { color: " + to + "; }\1299 </style>",1300 $( 'head' ).append( custom_style );1301 } );1302 } );1303 wp.customize( 'et_divi[disable_custom_footer_credits]', function( value ) {1304 value.bind( function( to ) {1305 var footer_info_html = '';1306 if ( to === false ) {1307 var custom_footer_credits = wp.customize.value('et_divi[custom_footer_credits]')();1308 footer_info_html = $.trim( custom_footer_credits ) !== '' ? custom_footer_credits : et_footer_info_original_html;1309 }1310 $et_footer_info.html( footer_info_html );1311 } );1312 } );1313 wp.customize( 'et_divi[custom_footer_credits]', function( value ) {1314 value.bind( function( to ) {1315 if ( $.trim( to ) === '' ) {1316 to = et_footer_info_original_html;1317 }1318 $et_footer_info.html( to );1319 } );1320 } );1321 wp.customize( 'et_divi[footer_bg]', function( value ) {1322 value.bind( function( to ) {1323 $( '#main-footer' ).css( 'background-color', to );1324 } );1325 } );1326 wp.customize( 'et_divi[footer_columns]', function( value ) {1327 value.bind( function( to ) {1328 var $body = $('body');1329 if ( to ) {1330 $body.removeClass(function(index, css){1331 return (css.match (/\bet_pb_footer_columns\S+/g) || []).join(' ')1332 });1333 $body.addClass( 'et_pb_footer_columns' + to );1334 }1335 } );1336 } );1337 wp.customize( 'et_divi[footer_widget_link_color]', function( value ) {1338 value.bind( function( to ) {1339 $( '#footer-widgets .footer-widget a' ).css( 'color', to );1340 } );1341 } );1342 wp.customize( 'et_divi[footer_widget_text_color]', function( value ) {1343 value.bind( function( to ) {1344 $( '.footer-widget' ).css( 'color', to );1345 } );1346 } );1347 wp.customize( 'et_divi[footer_widget_header_color]', function( value ) {1348 value.bind( function( to ) {1349 $( '#main-footer .footer-widget h4' ).css( 'color', to );1350 } );1351 } );1352 wp.customize( 'et_divi[footer_widget_bullet_color]', function( value ) {1353 value.bind( function( to ) {1354 $( 'head style#footer_widget_bullet_color' ).remove(),1355 custom_style = "<style id='footer_widget_bullet_color'>\1356 .footer-widget li:before { border-color: " + to + "; }\1357 </style>",1358 $( 'head' ).append( custom_style );1359 } );1360 } );1361 wp.customize( 'et_divi[widget_header_font_size]', function( value ) {1362 value.bind( function( to ) {1363 $( '.footer-widget h4' ).css( 'font-size', to + 'px' );1364 } );1365 } );1366 wp.customize( 'et_divi[widget_header_font_style]', function( value ) {1367 value.bind( function( to ) {1368 et_print_module_styles_css(1369 'et_divi[widget_header_font_style]',1370 'font-styles',1371 '.footer-widget h4',1372 to1373 );1374 } );1375 } );1376 wp.customize( 'et_divi[widget_body_font_size]', function( value ) {1377 value.bind( function( to ) {1378 $( '.footer-widget li, .footer-widget li a, .footer-widget div, .footer-widget, #footer-info' ).css( 'font-size', to + 'px' );1379 et_fix_footer_widget_bullet_top();1380 } );1381 } );1382 wp.customize( 'et_divi[footer_menu_background_color]', function( value ) {1383 value.bind( function( to ) {1384 et_print_module_styles_css(1385 'et_divi[footer_menu_background_color]',1386 'background-color',1387 '#et-footer-nav',1388 to1389 );1390 } );1391 } );1392 wp.customize( 'et_divi[footer_menu_text_color]', function( value ) {1393 value.bind( function( to ) {1394 et_print_module_styles_css(1395 'et_divi[footer_menu_text_color]',1396 'color',1397 '.bottom-nav, .bottom-nav a, .bottom-nav li.current-menu-item a',1398 to1399 );1400 } );1401 } );1402 wp.customize( 'et_divi[footer_menu_active_link_color]', function( value ) {1403 value.bind( function( to ) {1404 et_print_module_styles_css(1405 'et_divi[footer_menu_active_link_color]',1406 'color',1407 '#et-footer-nav .bottom-nav li.current-menu-item a',1408 to1409 );1410 } );1411 } );1412 wp.customize( 'et_divi[footer_menu_letter_spacing]', function( value ) {1413 value.bind( function( to ) {1414 et_print_module_styles_css(1415 'et_divi[footer_menu_letter_spacing]',1416 'letter-spacing',1417 '.bottom-nav',1418 to1419 );1420 } );1421 } );1422 wp.customize( 'et_divi[footer_menu_font_style]', function( value ) {1423 value.bind( function( to ) {1424 et_print_module_styles_css(1425 'et_divi[footer_menu_font_style]',1426 'font-styles',1427 '.bottom-nav a',1428 to1429 );1430 } );1431 } );1432 wp.customize( 'et_divi[footer_menu_font_size]', function( value ) {1433 value.bind( function( to ) {1434 et_print_module_styles_css(1435 'et_divi[footer_menu_font_size]',1436 'font-size',1437 '.bottom-nav, .bottom-nav a',1438 to1439 );1440 } );1441 } );1442 wp.customize( 'et_divi[bottom_bar_background_color]', function( value ) {1443 value.bind( function( to ) {1444 et_print_module_styles_css(1445 'et_divi[bottom_bar_background_color]',1446 'background-color',1447 '#footer-bottom',1448 to1449 );1450 } );1451 } );1452 wp.customize( 'et_divi[bottom_bar_text_color]', function( value ) {1453 value.bind( function( to ) {1454 et_print_module_styles_css(1455 'et_divi[bottom_bar_text_color]',1456 'color',1457 '#footer-info, #footer-info a',1458 to1459 );1460 } );1461 } );1462 wp.customize( 'et_divi[bottom_bar_font_style]', function( value ) {1463 value.bind( function( to ) {1464 et_print_module_styles_css(1465 'et_divi[bottom_bar_font_style]',1466 'font-styles',1467 '#footer-info, #footer-info a',1468 to1469 );1470 } );1471 } );1472 wp.customize( 'et_divi[bottom_bar_font_size]', function( value ) {1473 value.bind( function( to ) {1474 et_print_module_styles_css(1475 'et_divi[bottom_bar_font_size]',1476 'font-size',1477 '#footer-info',1478 to,1479 true1480 );1481 } );1482 } );1483 wp.customize( 'et_divi[bottom_bar_social_icon_size]', function( value ) {1484 value.bind( function( to ) {1485 et_print_module_styles_css(1486 'et_divi[bottom_bar_social_icon_size]',1487 'font-size',1488 '#footer-bottom .et-social-icon a',1489 to1490 );1491 } );1492 } );1493 wp.customize( 'et_divi[bottom_bar_social_icon_color]', function( value ) {1494 value.bind( function( to ) {1495 et_print_module_styles_css(1496 'et_divi[bottom_bar_social_icon_color]',1497 'color',1498 '#footer-bottom .et-social-icon a',1499 to1500 );1501 } );1502 } );1503 wp.customize( 'et_divi[widget_body_font_style]', function( value ) {1504 value.bind( function( to ) {1505 et_print_module_styles_css(1506 'et_divi[widget_body_font_style]',1507 'font-styles',1508 '.footer-widget .et_pb_widget div, .footer-widget .et_pb_widget ul, .footer-widget .et_pb_widget ol, .footer-widget .et_pb_widget > label',1509 to1510 );1511 } );1512 } );1513 wp.customize( 'et_divi[widget_body_line_height]', function( value ) {1514 value.bind( function( to ) {1515 et_print_module_styles_css(1516 'et_divi[widget_body_line_height]',1517 'line-height',1518 '.footer-widget .et_pb_widget div, .footer-widget .et_pb_widget ul, .footer-widget .et_pb_widget ol, .footer-widget .et_pb_widget label',1519 to1520 );1521 et_fix_footer_widget_bullet_top();1522 } );1523 } );1524 wp.customize( 'et_divi[menu_link]', function( value ) {1525 value.bind( function( to ) {1526 $( 'head style#menu_link' ).remove(),1527 custom_style = "<style id='menu_link'>\1528 #et_search_icon:before, #et_top_search .et-search-form input, .et_search_form_container input, span.et_close_search_field:after, #et-top-navigation .et-cart-info { color: " + to + " !important; }\1529 .et_nav_text_color_light #top-menu > li > a, .et_nav_text_color_dark #top-menu > li > a, #top-menu a { color: " + to + "; }\1530 .et_search_form_container input::-moz-placeholder { color: " + to + "; }\1531 .et_search_form_container input::-webkit-input-placeholder { color: " + to + "; }\1532 .et_search_form_container input:-ms-input-placeholder { color: " + to + "; }\1533 </style>",1534 $( 'head' ).append( custom_style );1535 } );1536 } );1537 wp.customize( 'et_divi[secondary_nav_text_color_new]', function( value ) {1538 value.bind( function( to ) {1539 $( 'head style#secondary_nav_text_color_new' ).remove(),1540 custom_style = "<style id='secondary_nav_text_color_new'>\1541 #top-header, #top-header a { color: " + to + " !important; }\1542 </style>",1543 $( 'head' ).append( custom_style );1544 } );1545 } );1546 wp.customize( 'et_divi[mobile_menu_link]', function( value ) {1547 value.bind( function( to ) {1548 $( 'head style#mobile_menu_link' ).remove(),1549 custom_style = "<style id='mobile_menu_link'>\1550 @media only screen and ( max-width: 980px ) {\1551 .et_header_style_centered .mobile_nav .select_page, .et_header_style_split .mobile_nav .select_page, .et_mobile_menu li a, .mobile_menu_bar:before, .et_nav_text_color_light #top-menu > li > a, .et_nav_text_color_dark #top-menu > li > a, #top-menu a, #et_search_icon:before, #et_top_search .et-search-form input, .et_search_form_container input, .et_close_search_field:after, #et-top-navigation .et-cart-info { color: " + to + " !important; }\1552 .et_search_form_container input::-moz-placeholder { color: " + to + " !important; }\1553 .et_search_form_container input::-webkit-input-placeholder { color: " + to + " !important; }\1554 .et_search_form_container input:-ms-input-placeholder { color: " + to + " !important; }\1555 }\1556 </style>",1557 $( 'head' ).append( custom_style );1558 } );1559 } );1560 wp.customize( 'et_divi[menu_link_active]', function( value ) {1561 value.bind( function( to ) {1562 $( 'head style#menu_link_active' ).remove(),1563 custom_style = "<style id='menu_link_active'>\1564 #top-menu li.current-menu-ancestor > a, #top-menu li.current-menu-item > a, .bottom-nav li.current-menu-item > a { color: " + to + " !important; }\1565 </style>",1566 $( 'head' ).append( custom_style );1567 } );1568 } );1569 wp.customize( 'et_divi[content_width]', function( value ) {1570 value.bind( function( to ) {1571 $( '.container, .et_pb_row, .et_pb_slider .et_pb_container, .et_pb_fullwidth_section .et_pb_title_container, .et_pb_fullwidth_section .et_pb_title_featured_container' ).css( 'max-width', to + 'px' );1572 } );1573 value.bind( function( to ) {1574 $( '.et_boxed_layout #page-container, .et_boxed_layout #page-container #top-header, .et_boxed_layout #page-container #main-header, .et_boxed_layout #page-container .container, .et_boxed_layout #page-container .et_pb_row' ).css( 'max-width', parseInt(to) + 160 + 'px' );1575 } );1576 } );1577 wp.customize( 'et_divi[gutter_width]', function( value ) {1578 value.bind( function( to ) {1579 var $body = $('body');1580 if ( to ) {1581 $body.removeClass( 'et_pb_gutters1 et_pb_gutters2 et_pb_gutters3 et_pb_gutters4' );1582 $body.addClass( 'et_pb_gutters' + to );1583 }1584 } );1585 } );1586 wp.customize( 'et_divi[sidebar_width]', function( value ) {1587 value.bind( function( to ) {1588 add_content_sidebar_style( to );1589 } );1590 } );1591 wp.customize( 'et_divi[use_sidebar_width]', function( value ) {1592 value.bind( function( to ) {1593 var $body = $('body');1594 if ( to ) {1595 $body.removeClass( 'et_pb_gutter ' );1596 add_content_sidebar_style( wp.customize.value( 'et_divi[sidebar_width]' )() );1597 } else {1598 $body.addClass( 'et_pb_gutter' );1599 $( 'style#theme-customizer-sidebar-width-css').remove();1600 }1601 } );1602 } );1603 wp.customize( 'et_divi[boxed_layout]', function( value ) {1604 value.bind( function( to ) {1605 var $body = $('body');1606 if ( to ) {1607 $body.addClass( 'et_boxed_layout' );1608 } else {1609 $body.removeClass( 'et_boxed_layout' );1610 $( '#main-header, #page-container, #top-header' ).css( 'max-width', 'none' )1611 }1612 } );1613 } );1614 wp.customize( 'et_divi[cover_background]', function( value ) {1615 value.bind( function( to ) {1616 var $body = $('body');1617 if ( to ) {1618 $body.addClass( 'et_cover_background' );1619 } else {1620 $body.removeClass( 'et_cover_background' );1621 }1622 } );1623 } );1624 wp.customize( 'et_divi[show_header_social_icons]', function( value ) {1625 value.bind( function( to ) {1626 var $social_icons = $( '#top-header ul.et-social-icons, .et_slide_menu_top ul.et-social-icons' ),1627 $social_icons_container = $( '#et-info' ),1628 $social_icons_container_slide = $( '.et_slide_menu_top' ),1629 is_slide_header = $( 'body' ).hasClass( 'et_header_style_slide' ) || $( 'body' ).hasClass( 'et_header_style_fullscreen' );1630 if ( ! is_slide_header ) {1631 et_maybe_create_secondary_nav();1632 }1633 if ( to ) {1634 if ( $social_icons.length ) {1635 $social_icons.show();1636 } else {1637 var $social_icons_ul = $( 'body' ).find( '.et_customizer_social_icons .et-social-icons' ).clone();1638 $social_icons_container.append( $social_icons_ul );1639 $social_icons_container_slide.prepend( $social_icons_ul );1640 }1641 } else {1642 $social_icons.hide();1643 }1644 et_fix_slide_in_top_bar();1645 } );1646 } );1647 wp.customize( 'et_divi[show_search_icon]', function( value ) {1648 value.bind( function( to ) {1649 var $body = $('body');1650 if ( to ) {1651 $body.removeClass( 'et_hide_search_icon' );1652 } else {1653 $body.addClass( 'et_hide_search_icon' );1654 }1655 et_fix_slide_in_top_bar();1656 } );1657 } );1658 wp.customize( 'et_divi[show_footer_social_icons]', function( value ) {1659 value.bind( function( to ) {1660 var $social_icons = $('#main-footer ul.et-social-icons');1661 if ( to ) {1662 if ( $social_icons.length ) {1663 $social_icons.show();1664 } else {1665 var $social_icons_ul = $( 'body' ).find( '.et_customizer_social_icons .et-social-icons' ).clone();1666 $( '#footer-bottom .container' ).append( $social_icons_ul );1667 }1668 } else {1669 $social_icons.hide();1670 }1671 } );1672 } );1673 wp.customize( 'et_divi[header_style]', function( value ) {1674 value.bind( function( to ) {1675 var header_style_prefix = 'et_header_style_',1676 header_default_left = $( 'body' ).hasClass( 'et_boxed_layout' ) ? $( '#page-container' ).css( 'margin-left' ) : '0',1677 $header_toggle = $( '#et-top-navigation .et_pb_header_toggle' );1678 // Transitioning logo causes incorrect header height calculation. Hide logo to begin1679 $('#logo').hide();1680 et_remove_element_class( header_style_prefix );1681 $( 'body' ).addClass( header_style_prefix + to );1682 if ( 'slide' === to || 'fullscreen' === to ) {1683 $( 'body' ).addClass( header_style_prefix + 'left' );1684 if ( 'slide' === to ) {1685 $header_toggle.addClass( 'et_toggle_slide_menu' ).removeClass( 'et_toggle_fullscreen_menu' );1686 } else {1687 $header_toggle.addClass( 'et_toggle_fullscreen_menu' ).removeClass( 'et_toggle_slide_menu' );1688 }1689 // fix the unwanted appearance of slide in and fullscreen menus right after the header style switch1690 $( '.et_slide_in_menu_container' ).toggle();1691 $( '.et_slide_in_menu_container' ).toggle();1692 }1693 // close the slide in and fullscreen menus if they were opened1694 $( '.et_slide_in_menu_container' ).animate( { right : '-100%' } ).removeClass( 'et_pb_slide_menu_opened' );1695 $( '#page-container' ).animate( { left : '0' } );1696 $( '#main-header' ).animate( { left : header_default_left } );1697 $( 'body' ).removeClass( 'et_pb_slide_menu_active' );1698 $( 'body' ).removeClass( 'et_pb_fullscreen_menu_active' );1699 $( '.et_toggle_slide_menu' ).removeClass( 'et_pb_fullscreen_menu_opened' );1700 et_maybe_fix_header_style( to );1701 et_slide_to_top();1702 et_fix_logo_height();1703 et_fix_page_container_position();1704 et_fix_page_top_padding();1705 et_fix_fullscreen_section();1706 // Display the logo back1707 $('#logo').fadeIn();1708 } );1709 } );1710 wp.customize( 'et_divi[primary_nav_dropdown_animation]', function( value ) {1711 value.bind( function( to ) {1712 var primary_dropdown_animation_prefix = 'et_primary_nav_dropdown_animation_';1713 et_remove_element_class( primary_dropdown_animation_prefix );1714 $( 'body' ).addClass( primary_dropdown_animation_prefix + to );1715 } );1716 } );1717 wp.customize( 'et_divi[secondary_nav_dropdown_animation]', function( value ) {1718 value.bind( function( to ) {1719 var secondary_dropdown_animation_prefix = 'et_secondary_nav_dropdown_animation_';1720 et_remove_element_class( secondary_dropdown_animation_prefix );1721 $( 'body' ).addClass( secondary_dropdown_animation_prefix + to );1722 } );1723 } );1724 wp.customize( 'et_divi[phone_number]', function( value ) {1725 value.bind( function( to ) {1726 et_maybe_create_secondary_nav();1727 var $phone_number = $( '#et-info-phone' );1728 if ( ! $phone_number.length ) {1729 if ( ! $( '#et-info' ).length ) {1730 $( '#top-header .container' ).prepend( '<div id="et-info"></div>' );1731 }1732 $( '#et-info' ).prepend( '<span id="et-info-phone"></span>' );1733 $phone_number = $( '#et-info-phone' );1734 }1735 if ( to !== '' ) {1736 $phone_number.show().html( to );1737 } else {1738 $phone_number.hide();1739 et_maybe_remove_secondary_nav();1740 }1741 } );1742 } );1743 wp.customize( 'et_divi[header_email]', function( value ) {1744 value.bind( function( to ) {1745 et_maybe_create_secondary_nav();1746 var $email = $( '#et-info-email' );1747 if ( ! $email.length ) {1748 if ( ! $( '#et-info' ).length ) {1749 $( '#top-header .container' ).append( '<div id="et-info"></div>' );1750 }1751 $( '#et-info' ).append( '<span id="et-info-email"></span>' );1752 $email = $( '#et-info-email' );1753 }1754 if ( to !== '' ) {1755 $email.show().text( to );1756 } else {1757 $email.hide();1758 }1759 } );1760 } );1761 wp.customize( 'et_divi[primary_nav_text_color]', function( value ) {1762 value.bind( function( to ) {1763 var nav_color_prefix = 'et_nav_text_color_',1764 element = '#main-header';1765 et_remove_element_class( nav_color_prefix, element );1766 $( element ).addClass( nav_color_prefix + to );1767 } );1768 } );1769 wp.customize( 'et_divi[secondary_nav_text_color]', function( value ) {1770 value.bind( function( to ) {1771 var nav_color_prefix = 'et_nav_text_color_',1772 element = '#top-header';1773 et_remove_element_class( nav_color_prefix, element );1774 $( element ).addClass( nav_color_prefix + to );1775 } );1776 } );1777 wp.customize( 'et_divi[vertical_nav]', function( value ) {1778 value.bind( function( to ) {1779 var $body = $('body'),1780 $top_navigation = $( '#et-top-navigation' ),1781 main_header_bg = $( '#main-header').css( 'background-color' ),1782 menu_height = typeof wp.customize.value( 'et_divi[menu_height]' )() === 'undefined' ? 66 : parseInt( wp.customize.value( 'et_divi[menu_height]' )() );1783 $top_navigation.css( 'padding-left', 0 );1784 var header_style = ( $('.et_header_style_split').length ) ? 'split' : 'not-split';1785 if ( header_style == 'split' ) {1786 var $et_window = $(window),1787 $et_top_navigation = $('#et-top-navigation'),1788 $logo_container = $('#main-header > .container > .logo_container'),1789 $logo_container_splitted = $('.centered-inline-logo-wrap > .logo_container'),1790 et_top_navigation_li_size = $et_top_navigation.children('nav').children('ul').children('li').size(),1791 et_top_navigation_li_break_index = Math.round( et_top_navigation_li_size / 2 ) - 1;1792 if ( ! to && $et_window.width() >= 980 ) {1793 $('<li class="centered-inline-logo-wrap"></li>').insertAfter($et_top_navigation.find('nav > ul >li:nth('+et_top_navigation_li_break_index+')') );1794 $logo_container.appendTo( $et_top_navigation.find('.centered-inline-logo-wrap') );1795 } else {1796 $logo_container_splitted.prependTo('#main-header > .container');1797 $('#main-header .centered-inline-logo-wrap').remove();1798 }1799 }1800 if ( to ) {1801 $body.addClass( 'et_vertical_nav' );1802 window.et_is_vertical_nav = true;1803 if ( 'left' === wp.customize.value( 'et_divi[vertical_nav_orientation]' )() ) {1804 $body.removeClass( 'et_vertical_right' );1805 } else {1806 $body.addClass( 'et_vertical_right' );1807 }1808 if ( $body.hasClass( 'et_fixed_nav' ) ) {1809 $body.removeClass( 'et_fixed_nav' ).addClass( 'et_fixed_nav_temp' );1810 window.et_is_fixed_nav = false;1811 $('#main-header').css( { 'transform': 'translateY(0)', 'top': '0' } );1812 $('#top-header').css( { 'transform': 'translateY(0)', 'top': '0' } );1813 }1814 } else {1815 $body.find( '#main-header' ).removeClass( '.et-fixed-header' );1816 $body.removeClass( 'et_vertical_nav' );1817 window.et_is_vertical_nav = false;1818 if ( $body.hasClass( 'et_fixed_nav_temp' ) || $body.hasClass( 'et_vertical_fixed' ) ) {1819 $body.removeClass( 'et_fixed_nav_temp et_vertical_fixed' ).addClass( 'et_fixed_nav' );1820 window.et_is_fixed_nav = true;1821 } else {1822 window.et_is_fixed_nav = false;1823 }1824 et_fix_page_top_padding();1825 }1826 // .et_transparent_nav should only be present at <body> on this condition: horizontal nav + transparent #main-header background1827 if ( ! window.et_is_vertical_nav && 'rgba' === main_header_bg.substr( 0, 4 ) ) {1828 $body.addClass( 'et_transparent_nav' );1829 } else {1830 $body.removeClass( 'et_transparent_nav' );1831 }1832 // .et_fullwidth_nav should not be added on vertical_nav enabled.1833 // Add et_fullwidth_nav_temp to anticipate fullwidth nav to vertical to fullwidth nav switching1834 if ( to && $body.is( '.et_fullwidth_nav' ) ){1835 $body.removeClass( 'et_fullwidth_nav' ).addClass( 'et_fullwidth_nav_temp' );1836 } else if ( ! to && $body.is( '.et_fullwidth_nav_temp' ) ) {1837 $body.removeClass( 'et_fullwidth_nav_temp' ).addClass( 'et_fullwidth_nav' );1838 }1839 if ( to && $body.hasClass( 'et_hide_nav') ) {1840 $body.removeClass( 'et_hide_nav' ).addClass( 'et_hide_nav_temp' );1841 } else if ( ! to && $body.hasClass( 'et_hide_nav_temp' ) ) {1842 $body.removeClass( 'et_hide_nav_temp' ).addClass( 'et_hide_nav' );1843 }1844 // Add body class for navigation transition marking1845 if ( to ) {1846 $body.removeClass( 'nav-vertical-to-horizontal' ).addClass( 'nav-horizontal-to-vertical' );1847 } else {1848 $body.removeClass( 'nav-horizontal-to-vertical' ).addClass( 'nav-vertical-to-horizontal' );1849 }1850 // Fix menu styles1851 add_menu_styles( menu_height, 'full_menu', 'not-fixed' );1852 et_fix_logo_height();1853 et_fix_page_container_position();1854 et_fix_fullscreen_section();1855 et_set_right_vertical_menu();1856 } );1857 } );1858 wp.customize( 'et_divi[vertical_nav_orientation]', function( value ) {1859 value.bind( function( to ) {1860 var $body = $( 'body' );1861 if ( 'right' === to ) {1862 $body.addClass( 'et_vertical_right' );1863 et_set_right_vertical_menu();1864 } else {1865 $body.removeClass( 'et_vertical_right' );1866 if ( $body.hasClass( 'et_boxed_layout' ) && $body.hasClass( 'et_vertical_fixed' ) ) {1867 var header_offset = $( '#page-container' ).css( 'margin-left' );1868 $( '#main-header' ).css( 'right', '' );1869 $( '#main-header' ).css( 'left', header_offset );1870 }1871 }1872 } );1873 } );1874 wp.customize( 'et_divi[hide_nav]', function( value ) {1875 value.bind( function( to ) {1876 var $window = $(window),1877 $body = $('body'),1878 $secondary_nav_height = $body.find( '#top-header' ).length ? $body.find( '#top-header' ).innerHeight() : 0,1879 $pagecontainer = $body.find( '#page-container' ),1880 $mainheader = $body.find( '#main-header' ),1881 $topheader = $body.find( '#top-header' ),1882 $hiddenheaderheight = $body.find( '#main-header' ).innerHeight() + $secondary_nav_height;1883 if ( $window.width() < 981 ) {1884 return;1885 }1886 if ( !$body.hasClass('et_hide_nav') ) {1887 $body.addClass( 'et_hide_nav' );1888 $pagecontainer.css( 'paddingTop', 0 );1889 $mainheader.css( 'transform', 'translateY(-' + $hiddenheaderheight + 'px)' );1890 $topheader.css( 'transform', 'translateY(-' + $hiddenheaderheight + 'px)' );1891 } else {1892 $body.removeClass( 'et_hide_nav' );1893 $mainheader.css( 'transform', 'translateY(0)' );1894 $topheader.css( 'transform', 'translateY(0)' );1895 et_fix_page_top_padding();1896 }1897 et_fix_fullscreen_section();1898 } );1899 } );1900 wp.customize( 'et_divi[hide_primary_logo]', function( value ) {1901 value.bind( function( to ) {1902 var $body = $('body');1903 if ( to ) {1904 $body.addClass( 'et_hide_primary_logo' );1905 } else {1906 $body.removeClass( 'et_hide_primary_logo' );1907 }1908 } );1909 } );1910 wp.customize( 'et_divi[hide_fixed_logo]', function( value ) {1911 value.bind( function( to ) {1912 var $body = $('body');1913 if ( to ) {1914 $body.addClass( 'et_hide_fixed_logo' );1915 } else {1916 $body.removeClass( 'et_hide_fixed_logo' );1917 }1918 } );1919 } );1920 wp.customize( 'et_divi[hide_mobile_logo]', function( value ) {1921 value.bind( function( to ) {1922 var $body = $('body');1923 if ( to ) {1924 $body.addClass( 'et_hide_mobile_logo' );1925 } else {1926 $body.removeClass( 'et_hide_mobile_logo' );1927 }1928 } );1929 } );1930 wp.customize( 'et_divi[color_schemes]', function( value ) {1931 value.bind( function( to ) {1932 var $body = $( 'body' ),1933 body_classes = $body.attr( 'class' ),1934 et_customizer_color_scheme_prefix = 'et_color_scheme_',1935 body_class;1936 body_class = body_classes.replace( /et_color_scheme_[^\s]+/, '' );1937 $body.attr( 'class', $.trim( body_class ) );1938 if ( 'none' !== to )1939 $body.addClass( et_customizer_color_scheme_prefix + to );1940 } );1941 } );1942 wp.customize( 'et_divi[nav_fullwidth]', function( value ) {1943 value.bind( function( to ) {1944 var $body = $('body');1945 if ( to ) {1946 $body.addClass('et_fullwidth_nav');1947 } else {1948 $body.removeClass('et_fullwidth_nav');1949 }1950 } );1951 } );1952 wp.customize( 'et_divi[menu_height]', function( value ) {1953 value.bind( function( to ) {1954 // Update height data1955 $('#et-top-navigation').attr( 'data-height', to );1956 // Update main-header data-height-onload: it's critical for page et_fix_page_top_padding()1957 et_fix_saved_main_header_height( 'initial' );1958 add_menu_styles( to, 'full_menu', 'not-fixed' );1959 et_slide_to_top();1960 et_fix_logo_height();1961 et_fix_page_top_padding();1962 } );1963 } );1964 wp.customize( 'et_divi[logo_height]', function( value ) {1965 value.bind( function( to ) {1966 var header_style = typeof wp.customize.value( 'et_divi[header_style]' )() === 'undefined' ? 'left' : wp.customize.value( 'et_divi[header_style]' )();1967 // Update logo height data1968 $('#logo').attr( 'data-height-percentage', to );1969 if ( header_style === 'split' ) {1970 $('#logo').hide();1971 }1972 et_fix_logo_height();1973 if ( header_style === 'split' ) {1974 setTimeout( function() {1975 $('#logo').fadeIn();1976 }, 500 );1977 }1978 } );1979 } );1980 wp.customize( 'et_divi[menu_margin_top]', function( value ) {1981 value.bind( function( to ) {1982 var style_id = 'style#menu_margin_top',1983 $style_content = '<style id="menu_margin_top">@media only screen and ( min-width: 981px ) { .et_vertical_nav #et-top-navigation { margin-top: ' + to + 'px } }</style>';1984 et_customizer_update_styles( style_id, $style_content );1985 } );1986 } );1987 wp.customize( 'et_divi[minimized_menu_height]', function( value ) {1988 value.bind( function( to ) {1989 // Update height data1990 $('#et-top-navigation').attr( 'data-fixed-height', to );1991 add_menu_styles( to, 'fixed_menu', 'fixed' );1992 et_fix_logo_height();1993 et_fix_page_container_position();1994 et_fix_fullscreen_section();1995 $(window).trigger('resize');1996 } );1997 } );1998 wp.customize( 'et_divi[secondary_nav_font_size]', function( value ) {1999 value.bind( function( to ) {2000 var social_icons_style = '<style id="header_social_icons">#top-header .et-social-icon a:before { font-size:' + to + 'px }</style>',2001 $style_id = $( 'style#header_social_icons' );2002 $( '#top-header, #top-header a' ).css( 'font-size', to + 'px' );2003 if ( $( 'body' ).hasClass( 'et_fixed_nav' ) ) {2004 $( '#main-header' ).css( 'top', $( '#top-header' ).innerHeight() );2005 }2006 if ( $style_id.length ) {2007 $( $style_id ).replaceWith( social_icons_style );2008 } else {2009 $( 'head' ).append( social_icons_style );2010 }2011 et_slide_to_top();2012 et_fix_page_top_padding();2013 } );2014 } );2015 wp.customize( 'et_divi[primary_nav_font_size]', function( value ) {2016 value.bind( function( to ) {2017 var $style_content = "<style id='search_font_size'> body.et_vertical_nav .container.et_search_form_container .et-search-form input { font-size:" + to + "px !important; }\2018 </style>",2019 style_id = 'style#search_font_size';2020 et_customizer_update_styles( style_id, $style_content );2021 $( '#top-menu li a' ).css( 'font-size', to + 'px' );2022 } );2023 } );2024 /* Module Styles Panel */2025 /* Gallery */2026 wp.customize( 'et_divi[et_pb_gallery-zoom_icon_color]', function( value ) {2027 value.bind( function( to ) {2028 et_print_module_styles_css(2029 'et_divi[et_pb_gallery-zoom_icon_color]',2030 'color',2031 '.et_pb_gallery_image .et_overlay:before',2032 to,2033 'use_important'2034 );2035 } );2036 } );2037 wp.customize( 'et_divi[et_pb_gallery-hover_overlay_color]', function( value ) {2038 value.bind( function( to ) {2039 et_print_module_styles_css(2040 'et_divi[et_pb_gallery-hover_overlay_color]',2041 'background-color',2042 '.et_pb_gallery_image .et_overlay',2043 to2044 );2045 } );2046 } );2047 wp.customize( 'et_divi[et_pb_gallery-title_font_size]', function( value ) {2048 value.bind( function( to ) {2049 et_print_module_styles_css(2050 'et_divi[et_pb_gallery-title_font_size]',2051 'font-size',2052 '.et_pb_gallery_grid .et_pb_gallery_item .et_pb_gallery_title',2053 to2054 );2055 } );2056 } );2057 wp.customize( 'et_divi[et_pb_gallery-title_font_style]', function( value ) {2058 value.bind( function( to ) {2059 et_print_module_styles_css(2060 'et_divi[et_pb_gallery-title_font_style]',2061 'font-styles',2062 '.et_pb_gallery_grid .et_pb_gallery_item .et_pb_gallery_title',2063 to2064 );2065 } );2066 } );2067 wp.customize( 'et_divi[et_pb_gallery-caption_font_size]', function( value ) {2068 value.bind( function( to ) {2069 et_print_module_styles_css(2070 'et_divi[et_pb_gallery-caption_font_size]',2071 'font-size',2072 '.et_pb_gallery .et_pb_gallery_item .et_pb_gallery_caption',2073 to2074 );2075 } );2076 } );2077 wp.customize( 'et_divi[et_pb_gallery-caption_font_style]', function( value ) {2078 value.bind( function( to ) {2079 et_print_module_styles_css(2080 'et_divi[et_pb_gallery-caption_font_style]',2081 'font-styles',2082 '.et_pb_gallery .et_pb_gallery_item .et_pb_gallery_caption',2083 to2084 );2085 } );2086 } );2087 /* Blurb */2088 wp.customize( 'et_divi[et_pb_blurb-header_font_size]', function( value ) {2089 value.bind( function( to ) {2090 // Print style2091 et_print_module_styles_css(2092 'et_divi[et_pb_blurb-header_font_size]',2093 'font-size',2094 '.et_pb_blurb h4',2095 to2096 );2097 } );2098 } );2099 /* Tabs */2100 wp.customize( 'et_divi[et_pb_tabs-title_font_size]', function( value ) {2101 value.bind( function( to ) {2102 et_print_module_styles_css(2103 'et_divi[et_pb_tabs-title_font_size]',2104 'font-size',2105 '.et_pb_tabs_controls li',2106 to2107 );2108 } );2109 } );2110 wp.customize( 'et_divi[et_pb_tabs-title_font_style]', function( value ) {2111 value.bind( function( to ) {2112 et_print_module_styles_css(2113 'et_divi[et_pb_tabs-title_font_style]',2114 'font-styles',2115 '.et_pb_tabs_controls li',2116 to2117 );2118 } );2119 } );2120 wp.customize( 'et_divi[et_pb_tabs-padding]', function( value ) {2121 value.bind( function( to ) {2122 et_print_module_styles_css(2123 'et_divi[et_pb_tabs-padding]',2124 'padding-tabs',2125 '',2126 to2127 );2128 } );2129 } );2130 /* Slider */2131 wp.customize( 'et_divi[et_pb_slider-header_font_size]', function( value ) {2132 value.bind( function( to ) {2133 et_print_module_styles_css(2134 'et_divi[et_pb_slider-header_font_size]',2135 'font-size',2136 '.et_pb_slider_fullwidth_off .et_pb_slide_description .et_pb_slide_title',2137 to2138 );2139 } );2140 } );2141 wp.customize( 'et_divi[et_pb_slider-header_font_style]', function( value ) {2142 value.bind( function( to ) {2143 et_print_module_styles_css(2144 'et_divi[et_pb_slider-header_font_style]',2145 'font-styles',2146 '.et_pb_slider_fullwidth_off .et_pb_slide_description .et_pb_slide_title',2147 to2148 );2149 } );2150 } );2151 wp.customize( 'et_divi[et_pb_slider-body_font_size]', function( value ) {2152 value.bind( function( to ) {2153 et_print_module_styles_css(2154 'et_divi[et_pb_slider-body_font_size]',2155 'font-size',2156 '.et_pb_slider_fullwidth_off .et_pb_slide_content',2157 to2158 );2159 } );2160 } );2161 wp.customize( 'et_divi[et_pb_slider-body_font_style]', function( value ) {2162 value.bind( function( to ) {2163 et_print_module_styles_css(2164 'et_divi[et_pb_slider-body_font_style]',2165 'font-styles',2166 '.et_pb_slider_fullwidth_off .et_pb_slide_content',2167 to2168 );2169 } );2170 } );2171 wp.customize( 'et_divi[et_pb_slider-padding]', function( value ) {2172 value.bind( function( to ) {2173 et_print_module_styles_css(2174 'et_divi[et_pb_slider-padding]',2175 'padding-slider',2176 '.et_pb_slider_fullwidth_off .et_pb_slide_description',2177 to2178 );2179 et_fix_slider_height();2180 } );2181 } );2182 /* Testimonial */2183 wp.customize( 'et_divi[et_pb_testimonial-portrait_border_radius]', function( value ) {2184 value.bind( function( to ) {2185 et_print_module_styles_css(2186 'et_divi[et_pb_testimonial-portrait_border_radius]',2187 'border-radius',2188 '.et_pb_testimonial_portrait, .et_pb_testimonial_portrait:before',2189 to2190 );2191 } );2192 } );2193 wp.customize( 'et_divi[et_pb_testimonial-portrait_width]', function( value ) {2194 value.bind( function( to ) {2195 et_print_module_styles_css(2196 'et_divi[et_pb_testimonial-portrait_width]',2197 'width',2198 '.et_pb_testimonial_portrait',2199 to,2200 true2201 );2202 } );2203 } );2204 wp.customize( 'et_divi[et_pb_testimonial-portrait_height]', function( value ) {2205 value.bind( function( to ) {2206 et_print_module_styles_css(2207 'et_divi[et_pb_testimonial-portrait_height]',2208 'height',2209 '.et_pb_testimonial_portrait',2210 to,2211 true2212 );2213 } );2214 } );2215 wp.customize( 'et_divi[et_pb_testimonial-author_name_font_style]', function( value ) {2216 value.bind( function( to ) {2217 et_print_module_styles_css(2218 'et_divi[et_pb_testimonial-author_name_font_style]',2219 'font-styles',2220 '.et_pb_testimonial_author',2221 to2222 );2223 } );2224 } );2225 wp.customize( 'et_divi[et_pb_testimonial-author_details_font_style]', function( value ) {2226 value.bind( function( to ) {2227 et_print_module_styles_css(2228 'et_divi[et_pb_testimonial-author_details_font_style]',2229 'font-styles',2230 'p.et_pb_testimonial_meta',2231 to2232 );2233 } );2234 } );2235 /* Pricing Table */2236 wp.customize( 'et_divi[et_pb_pricing_tables-header_font_size]', function( value ) {2237 value.bind( function( to ) {2238 et_print_module_styles_css(2239 'et_divi[et_pb_pricing_tables-header_font_size]',2240 'font-size',2241 '.et_pb_pricing_heading h2',2242 to2243 );2244 } );2245 } );2246 wp.customize( 'et_divi[et_pb_pricing_tables-header_font_style]', function( value ) {2247 value.bind( function( to ) {2248 et_print_module_styles_css(2249 'et_divi[et_pb_pricing_tables-header_font_style]',2250 'font-styles',2251 '.et_pb_pricing_heading h2',2252 to2253 );2254 } );2255 } );2256 wp.customize( 'et_divi[et_pb_pricing_tables-subheader_font_size]', function( value ) {2257 value.bind( function( to ) {2258 et_print_module_styles_css(2259 'et_divi[et_pb_pricing_tables-subheader_font_size]',2260 'font-size',2261 '.et_pb_best_value',2262 to2263 );2264 } );2265 } );2266 wp.customize( 'et_divi[et_pb_pricing_tables-subheader_font_style]', function( value ) {2267 value.bind( function( to ) {2268 et_print_module_styles_css(2269 'et_divi[et_pb_pricing_tables-subheader_font_style]',2270 'font-styles',2271 '.et_pb_best_value',2272 to2273 );2274 } );2275 } );2276 wp.customize( 'et_divi[et_pb_pricing_tables-price_font_size]', function( value ) {2277 value.bind( function( to ) {2278 et_print_module_styles_css(2279 'et_divi[et_pb_pricing_tables-price_font_size]',2280 'font-size',2281 '.et_pb_sum',2282 to2283 );2284 } );2285 } );2286 wp.customize( 'et_divi[et_pb_pricing_tables-price_font_style]', function( value ) {2287 value.bind( function( to ) {2288 et_print_module_styles_css(2289 'et_divi[et_pb_pricing_tables-price_font_style]',2290 'font-styles',2291 '.et_pb_sum',2292 to2293 );2294 } );2295 } );2296 /* Call to Action */2297 wp.customize( 'et_divi[et_pb_cta-header_font_size]', function( value ) {2298 value.bind( function( to ) {2299 et_print_module_styles_css(2300 'et_divi[et_pb_cta-header_font_size]',2301 'font-size',2302 '.et_pb_promo h2',2303 to2304 );2305 } );2306 } );2307 wp.customize( 'et_divi[et_pb_cta-header_font_style]', function( value ) {2308 value.bind( function( to ) {2309 et_print_module_styles_css(2310 'et_divi[et_pb_cta-header_font_style]',2311 'font-styles',2312 '.et_pb_promo h2',2313 to2314 );2315 } );2316 } );2317 wp.customize( 'et_divi[et_pb_cta-custom_padding]', function( value ) {2318 value.bind( function( to ) {2319 et_print_module_styles_css(2320 'et_divi[et_pb_cta-custom_padding]',2321 'padding-call-to-action',2322 '',2323 to2324 );2325 } );2326 } );2327 /* Audio */2328 wp.customize( 'et_divi[et_pb_audio-title_font_size]', function( value ) {2329 value.bind( function( to ) {2330 et_print_module_styles_css(2331 'et_divi[et_pb_audio-title_font_size]',2332 'font-size',2333 '.et_pb_audio_module_content h2',2334 to2335 );2336 } );2337 } );2338 wp.customize( 'et_divi[et_pb_audio-title_font_style]', function( value ) {2339 value.bind( function( to ) {2340 et_print_module_styles_css(2341 'et_divi[et_pb_audio-title_font_style]',2342 'font-styles',2343 '.et_pb_audio_module_content h2',2344 to2345 );2346 } );2347 } );2348 wp.customize( 'et_divi[et_pb_audio-caption_font_size]', function( value ) {2349 value.bind( function( to ) {2350 et_print_module_styles_css(2351 'et_divi[et_pb_audio-caption_font_size]',2352 'font-size',2353 '.et_pb_audio_module p',2354 to2355 );2356 } );2357 } );2358 wp.customize( 'et_divi[et_pb_audio-caption_font_style]', function( value ) {2359 value.bind( function( to ) {2360 et_print_module_styles_css(2361 'et_divi[et_pb_audio-caption_font_style]',2362 'font-styles',2363 '.et_pb_audio_module p',2364 to2365 );2366 } );2367 } );2368 /* Email Optin */2369 wp.customize( 'et_divi[et_pb_signup-header_font_size]', function( value ) {2370 value.bind( function( to ) {2371 et_print_module_styles_css(2372 'et_divi[et_pb_signup-header_font_size]',2373 'font-size',2374 '.et_pb_subscribe h2',2375 to2376 );2377 } );2378 } );2379 wp.customize( 'et_divi[et_pb_signup-header_font_style]', function( value ) {2380 value.bind( function( to ) {2381 et_print_module_styles_css(2382 'et_divi[et_pb_signup-header_font_style]',2383 'font-styles',2384 '.et_pb_subscribe h2',2385 to2386 );2387 } );2388 } );2389 wp.customize( 'et_divi[et_pb_signup-padding]', function( value ) {2390 value.bind( function( to ) {2391 et_print_module_styles_css(2392 'et_divi[et_pb_signup-padding]',2393 'padding',2394 '.et_pb_subscribe',2395 to2396 );2397 } );2398 } );2399 /* Login */2400 wp.customize( 'et_divi[et_pb_login-header_font_size]', function( value ) {2401 value.bind( function( to ) {2402 et_print_module_styles_css(2403 'et_divi[et_pb_login-header_font_size]',2404 'font-size',2405 '.et_pb_login h2',2406 to2407 );2408 } );2409 } );2410 wp.customize( 'et_divi[et_pb_login-header_font_style]', function( value ) {2411 value.bind( function( to ) {2412 et_print_module_styles_css(2413 'et_divi[et_pb_login-header_font_style]',2414 'font-styles',2415 '.et_pb_login h2',2416 to2417 );2418 } );2419 } );2420 wp.customize( 'et_divi[et_pb_login-custom_padding]', function( value ) {2421 value.bind( function( to ) {2422 et_print_module_styles_css(2423 'et_divi[et_pb_login-custom_padding]',2424 'padding',2425 '.et_pb_login',2426 to2427 );2428 } );2429 } );2430 /* Portfolio */2431 wp.customize( 'et_divi[et_pb_portfolio-zoom_icon_color]', function( value ) {2432 value.bind( function( to ) {2433 et_print_module_styles_css(2434 'et_divi[et_pb_portfolio-zoom_icon_color]',2435 'color',2436 '.et_pb_portfolio .et_overlay:before, .et_pb_fullwidth_portfolio .et_overlay:before, .et_pb_portfolio_grid .et_overlay:before',2437 to,2438 'use_important'2439 );2440 } );2441 } );2442 wp.customize( 'et_divi[et_pb_portfolio-hover_overlay_color]', function( value ) {2443 value.bind( function( to ) {2444 et_print_module_styles_css(2445 'et_divi[et_pb_portfolio-hover_overlay_color]',2446 'background-color',2447 '.et_pb_portfolio .et_overlay, .et_pb_fullwidth_portfolio .et_overlay, .et_pb_portfolio_grid .et_overlay',2448 to2449 );2450 } );2451 } );2452 wp.customize( 'et_divi[et_pb_portfolio-title_font_size]', function( value ) {2453 value.bind( function( to ) {2454 et_print_module_styles_css(2455 'et_divi[et_pb_portfolio-title_font_size]',2456 'font-size',2457 '.et_pb_portfolio .et_pb_portfolio_item h2, .et_pb_fullwidth_portfolio .et_pb_portfolio_item h3, .et_pb_portfolio_grid .et_pb_portfolio_item h2',2458 to2459 );2460 } );2461 } );2462 wp.customize( 'et_divi[et_pb_portfolio-title_font_style]', function( value ) {2463 value.bind( function( to ) {2464 et_print_module_styles_css(2465 'et_divi[et_pb_portfolio-title_font_style]',2466 'font-styles',2467 '.et_pb_portfolio .et_pb_portfolio_item h2, .et_pb_fullwidth_portfolio .et_pb_portfolio_item h3, .et_pb_portfolio_grid .et_pb_portfolio_item h2',2468 to2469 );2470 } );2471 } );2472 wp.customize( 'et_divi[et_pb_portfolio-caption_font_size]', function( value ) {2473 value.bind( function( to ) {2474 et_print_module_styles_css(2475 'et_divi[et_pb_portfolio-caption_font_size]',2476 'font-size',2477 '.et_pb_portfolio .et_pb_portfolio_item .post-meta, .et_pb_fullwidth_portfolio .et_pb_portfolio_item .post-meta, .et_pb_portfolio_grid .et_pb_portfolio_item .post-meta',2478 to2479 );2480 } );2481 } );2482 wp.customize( 'et_divi[et_pb_portfolio-caption_font_style]', function( value ) {2483 value.bind( function( to ) {2484 et_print_module_styles_css(2485 'et_divi[et_pb_portfolio-caption_font_style]',2486 'font-styles',2487 '.et_pb_portfolio .et_pb_portfolio_item .post-meta, .et_pb_fullwidth_portfolio .et_pb_portfolio_item .post-meta, .et_pb_portfolio_grid .et_pb_portfolio_item .post-meta',2488 to2489 );2490 } );2491 } );2492 /* Filterable Portfolio */2493 wp.customize( 'et_divi[et_pb_filterable_portfolio-zoom_icon_color]', function( value ) {2494 value.bind( function( to ) {2495 et_print_module_styles_css(2496 'et_divi[et_pb_filterable_portfolio-zoom_icon_color]',2497 'color',2498 '.et_pb_filterable_portfolio .et_overlay:before',2499 to2500 );2501 } );2502 } );2503 wp.customize( 'et_divi[et_pb_filterable_portfolio-hover_overlay_color]', function( value ) {2504 value.bind( function( to ) {2505 et_print_module_styles_css(2506 'et_divi[et_pb_filterable_portfolio-hover_overlay_color]',2507 'background-color',2508 '.et_pb_filterable_portfolio .et_overlay',2509 to2510 );2511 } );2512 } );2513 wp.customize( 'et_divi[et_pb_filterable_portfolio-title_font_size]', function( value ) {2514 value.bind( function( to ) {2515 et_print_module_styles_css(2516 'et_divi[et_pb_filterable_portfolio-title_font_size]',2517 'font-size',2518 '.et_pb_filterable_portfolio .et_pb_portfolio_item h2',2519 to2520 );2521 } );2522 } );2523 wp.customize( 'et_divi[et_pb_filterable_portfolio-title_font_style]', function( value ) {2524 value.bind( function( to ) {2525 et_print_module_styles_css(2526 'et_divi[et_pb_filterable_portfolio-title_font_style]',2527 'font-styles',2528 '.et_pb_filterable_portfolio .et_pb_portfolio_item h2',2529 to2530 );2531 } );2532 } );2533 wp.customize( 'et_divi[et_pb_filterable_portfolio-caption_font_size]', function( value ) {2534 value.bind( function( to ) {2535 et_print_module_styles_css(2536 'et_divi[et_pb_filterable_portfolio-caption_font_size]',2537 'font-size',2538 '.et_pb_filterable_portfolio .et_pb_portfolio_item .post-meta',2539 to2540 );2541 } );2542 } );2543 wp.customize( 'et_divi[et_pb_filterable_portfolio-caption_font_style]', function( value ) {2544 value.bind( function( to ) {2545 et_print_module_styles_css(2546 'et_divi[et_pb_filterable_portfolio-caption_font_style]',2547 'font-styles',2548 '.et_pb_filterable_portfolio .et_pb_portfolio_item .post-meta',2549 to2550 );2551 } );2552 } );2553 wp.customize( 'et_divi[et_pb_filterable_portfolio-filter_font_size]', function( value ) {2554 value.bind( function( to ) {2555 et_print_module_styles_css(2556 'et_divi[et_pb_filterable_portfolio-filter_font_size]',2557 'font-size',2558 '.et_pb_filterable_portfolio .et_pb_portfolio_filters li',2559 to2560 );2561 } );2562 } );2563 wp.customize( 'et_divi[et_pb_filterable_portfolio-filter_font_style]', function( value ) {2564 value.bind( function( to ) {2565 et_print_module_styles_css(2566 'et_divi[et_pb_filterable_portfolio-filter_font_style]',2567 'font-styles',2568 '.et_pb_filterable_portfolio .et_pb_portfolio_filters li',2569 to2570 );2571 } );2572 } );2573 /* Bar Counter */2574 wp.customize( 'et_divi[et_pb_counters-title_font_size]', function( value ) {2575 value.bind( function( to ) {2576 et_print_module_styles_css(2577 'et_divi[et_pb_counters-title_font_size]',2578 'font-size',2579 '.et_pb_counters .et_pb_counter_title',2580 to2581 );2582 } );2583 } );2584 wp.customize( 'et_divi[et_pb_counters-title_font_style]', function( value ) {2585 value.bind( function( to ) {2586 et_print_module_styles_css(2587 'et_divi[et_pb_counters-title_font_style]',2588 'font-styles',2589 '.et_pb_counters .et_pb_counter_title',2590 to2591 );2592 } );2593 } );2594 wp.customize( 'et_divi[et_pb_counters-percent_font_size]', function( value ) {2595 value.bind( function( to ) {2596 et_print_module_styles_css(2597 'et_divi[et_pb_counters-percent_font_size]',2598 'font-size',2599 '.et_pb_counters .et_pb_counter_amount',2600 to2601 );2602 } );2603 } );2604 wp.customize( 'et_divi[et_pb_counters-percent_font_style]', function( value ) {2605 value.bind( function( to ) {2606 et_print_module_styles_css(2607 'et_divi[et_pb_counters-percent_font_style]',2608 'font-styles',2609 '.et_pb_counters .et_pb_counter_amount',2610 to2611 );2612 } );2613 } );2614 wp.customize( 'et_divi[et_pb_counters-border_radius]', function( value ) {2615 value.bind( function( to ) {2616 et_print_module_styles_css(2617 'et_divi[et_pb_counters-border_radius]',2618 'border-radius',2619 '.et_pb_counters .et_pb_counter_amount, .et_pb_counters .et_pb_counter_container',2620 to2621 );2622 } );2623 } );2624 wp.customize( 'et_divi[et_pb_counters-padding]', function( value ) {2625 value.bind( function( to ) {2626 et_print_module_styles_css(2627 'et_divi[et_pb_counters-padding]',2628 'padding',2629 '.et_pb_counter_amount',2630 to2631 );2632 } );2633 } );2634 /* Circle Counter */2635 wp.customize( 'et_divi[et_pb_circle_counter-number_font_size]', function( value ) {2636 value.bind( function( to ) {2637 et_print_module_styles_css(2638 'et_divi[et_pb_circle_counter-number_font_size]',2639 'font-size',2640 '.et_pb_circle_counter .percent p',2641 to2642 );2643 } );2644 } );2645 wp.customize( 'et_divi[et_pb_circle_counter-number_font_style]', function( value ) {2646 value.bind( function( to ) {2647 et_print_module_styles_css(2648 'et_divi[et_pb_circle_counter-number_font_style]',2649 'font-styles',2650 '.et_pb_circle_counter .percent p',2651 to2652 );2653 } );2654 } );2655 wp.customize( 'et_divi[et_pb_circle_counter-title_font_size]', function( value ) {2656 value.bind( function( to ) {2657 et_print_module_styles_css(2658 'et_divi[et_pb_circle_counter-title_font_size]',2659 'font-size',2660 '.et_pb_circle_counter h3',2661 to2662 );2663 } );2664 } );2665 wp.customize( 'et_divi[et_pb_circle_counter-title_font_style]', function( value ) {2666 value.bind( function( to ) {2667 et_print_module_styles_css(2668 'et_divi[et_pb_circle_counter-title_font_style]',2669 'font-styles',2670 '.et_pb_circle_counter h3',2671 to2672 );2673 } );2674 } );2675 /* Number Counter */2676 wp.customize( 'et_divi[et_pb_number_counter-number_font_size]', function( value ) {2677 value.bind( function( to ) {2678 et_print_module_styles_css(2679 'et_divi[et_pb_number_counter-number_font_size]',2680 'font-size',2681 '.et_pb_number_counter .percent p',2682 to2683 );2684 } );2685 } );2686 wp.customize( 'et_divi[et_pb_number_counter-number_font_style]', function( value ) {2687 value.bind( function( to ) {2688 et_print_module_styles_css(2689 'et_divi[et_pb_number_counter-number_font_style]',2690 'font-styles',2691 '.et_pb_number_counter .percent p',2692 to2693 );2694 } );2695 } );2696 wp.customize( 'et_divi[et_pb_number_counter-title_font_size]', function( value ) {2697 value.bind( function( to ) {2698 et_print_module_styles_css(2699 'et_divi[et_pb_number_counter-title_font_size]',2700 'font-size',2701 '.et_pb_number_counter h3',2702 to2703 );2704 } );2705 } );2706 wp.customize( 'et_divi[et_pb_number_counter-title_font_style]', function( value ) {2707 value.bind( function( to ) {2708 et_print_module_styles_css(2709 'et_divi[et_pb_number_counter-title_font_style]',2710 'font-styles',2711 '.et_pb_number_counter h3',2712 to2713 );2714 } );2715 } );2716 /* Accordion */2717 wp.customize( 'et_divi[et_pb_accordion-toggle_font_size]', function( value ) {2718 value.bind( function( to ) {2719 et_print_module_styles_css(2720 'et_divi[et_pb_accordion-toggle_font_size]',2721 'font-size',2722 '.et_pb_accordion .et_pb_toggle_title',2723 to2724 );2725 } );2726 } );2727 wp.customize( 'et_divi[et_pb_accordion-toggle_font_style]', function( value ) {2728 value.bind( function( to ) {2729 et_print_module_styles_css(2730 'et_divi[et_pb_accordion-toggle_font_style]',2731 'font-styles',2732 '.et_pb_accordion .et_pb_toggle.et_pb_toggle_open .et_pb_toggle_title',2733 to2734 );2735 } );2736 } );2737 wp.customize( 'et_divi[et_pb_accordion-inactive_toggle_font_style]', function( value ) {2738 value.bind( function( to ) {2739 et_print_module_styles_css(2740 'et_divi[et_pb_accordion-inactive_toggle_font_style]',2741 'font-styles',2742 '.et_pb_accordion .et_pb_toggle.et_pb_toggle_close .et_pb_toggle_title',2743 to2744 );2745 } );2746 } );2747 wp.customize( 'et_divi[et_pb_accordion-toggle_icon_size]', function( value ) {2748 value.bind( function( to ) {2749 et_print_module_styles_css(2750 'et_divi[et_pb_accordion-toggle_icon_size]',2751 'font-size',2752 '.et_pb_accordion .et_pb_toggle_title:before',2753 to2754 );2755 } );2756 } );2757 wp.customize( 'et_divi[et_pb_accordion-custom_padding]', function( value ) {2758 value.bind( function( to ) {2759 et_print_module_styles_css(2760 'et_divi[et_pb_accordion-custom_padding]',2761 'padding',2762 '.et_pb_accordion .et_pb_toggle_open, .et_pb_accordion .et_pb_toggle_close',2763 to2764 );2765 } );2766 } );2767 /* Toggle */2768 wp.customize( 'et_divi[et_pb_toggle-title_font_size]', function( value ) {2769 value.bind( function( to ) {2770 et_print_module_styles_css(2771 'et_divi[et_pb_toggle-title_font_size]',2772 'font-size',2773 '.et_pb_toggle.et_pb_toggle_item h5',2774 to2775 );2776 } );2777 } );2778 wp.customize( 'et_divi[et_pb_toggle-title_font_style]', function( value ) {2779 value.bind( function( to ) {2780 et_print_module_styles_css(2781 'et_divi[et_pb_toggle-title_font_style]',2782 'font-styles',2783 '.et_pb_toggle.et_pb_toggle_item.et_pb_toggle_open h5',2784 to2785 );2786 } );2787 } );2788 wp.customize( 'et_divi[et_pb_toggle-inactive_title_font_style]', function( value ) {2789 value.bind( function( to ) {2790 et_print_module_styles_css(2791 'et_divi[et_pb_toggle-inactive_title_font_style]',2792 'font-styles',2793 '.et_pb_toggle.et_pb_toggle_item.et_pb_toggle_close h5',2794 to2795 );2796 } );2797 } );2798 wp.customize( 'et_divi[et_pb_toggle-toggle_icon_size]', function( value ) {2799 value.bind( function( to ) {2800 et_print_module_styles_css(2801 'et_divi[et_pb_toggle-toggle_icon_size]',2802 'font-size',2803 '.et_pb_toggle.et_pb_toggle_item .et_pb_toggle_title:before',2804 to2805 );2806 } );2807 } );2808 wp.customize( 'et_divi[et_pb_toggle-custom_padding]', function( value ) {2809 value.bind( function( to ) {2810 et_print_module_styles_css(2811 'et_divi[et_pb_toggle-custom_padding]',2812 'padding',2813 '.et_pb_toggle.et_pb_toggle_item',2814 to2815 );2816 } );2817 } );2818 /* Contact Form */2819 wp.customize( 'et_divi[et_pb_contact_form-title_font_size]', function( value ) {2820 value.bind( function( to ) {2821 et_print_module_styles_css(2822 'et_divi[et_pb_contact_form-title_font_size]',2823 'font-size',2824 '.et_pb_contact_form_container .et_pb_contact_main_title',2825 to2826 );2827 } );2828 } );2829 wp.customize( 'et_divi[et_pb_contact_form-title_font_style]', function( value ) {2830 value.bind( function( to ) {2831 et_print_module_styles_css(2832 'et_divi[et_pb_contact_form-title_font_style]',2833 'font-styles',2834 '.et_pb_contact_form_container .et_pb_contact_main_title',2835 to2836 );2837 } );2838 } );2839 wp.customize( 'et_divi[et_pb_contact_form-form_field_font_size]', function( value ) {2840 value.bind( function( to ) {2841 et_print_module_styles_css(2842 'et_divi[et_pb_contact_form-form_field_font_size]',2843 'font-size',2844 '.et_pb_contact_form_container .et_pb_contact p input, .et_pb_contact_form_container .et_pb_contact p textarea',2845 to2846 );2847 } );2848 } );2849 wp.customize( 'et_divi[et_pb_contact_form-form_field_font_style]', function( value ) {2850 value.bind( function( to ) {2851 et_print_module_styles_css(2852 'et_divi[et_pb_contact_form-form_field_font_style]',2853 'font-styles',2854 '.et_pb_contact_form_container .et_pb_contact p input, .et_pb_contact_form_container .et_pb_contact p textarea',2855 to2856 );2857 } );2858 } );2859 wp.customize( 'et_divi[et_pb_contact_form-captcha_font_size]', function( value ) {2860 value.bind( function( to ) {2861 et_print_module_styles_css(2862 'et_divi[et_pb_contact_form-captcha_font_size]',2863 'font-size',2864 '.et_pb_contact_captcha_question',2865 to2866 );2867 } );2868 } );2869 wp.customize( 'et_divi[et_pb_contact_form-captcha_font_style]', function( value ) {2870 value.bind( function( to ) {2871 et_print_module_styles_css(2872 'et_divi[et_pb_contact_form-captcha_font_style]',2873 'font-styles',2874 '.et_pb_contact_captcha_question',2875 to2876 );2877 } );2878 } );2879 wp.customize( 'et_divi[et_pb_contact_form-padding]', function( value ) {2880 value.bind( function( to ) {2881 et_print_module_styles_css(2882 'et_divi[et_pb_contact_form-padding]',2883 'padding',2884 '.et_pb_contact p input, .et_pb_contact p textarea',2885 to2886 );2887 } );2888 } );2889 /* Sidebar */2890 wp.customize( 'et_divi[et_pb_sidebar-header_font_style]', function( value ) {2891 value.bind( function( to ) {2892 et_print_module_styles_css(2893 'et_divi[et_pb_sidebar-header_font_style]',2894 'font-styles',2895 '.et_pb_widget_area h4',2896 to2897 );2898 } );2899 } );2900 wp.customize( 'et_divi[et_pb_sidebar-header_font_size]', function( value ) {2901 value.bind( function( to ) {2902 et_print_module_styles_css(2903 'et_divi[et_pb_sidebar-header_font_size]',2904 'font-size',2905 '.et_pb_widget_area h4',2906 to2907 );2908 } );2909 } );2910 wp.customize( 'et_divi[et_pb_sidebar-remove_border]', function( value ) {2911 value.bind( function( to ) {2912 if ( to ){2913 $('body').addClass( 'et_pb_no_sidebar_vertical_divider' );2914 } else {2915 $('body').removeClass( 'et_pb_no_sidebar_vertical_divider' );2916 }2917 } );2918 } );2919 /* Person */2920 wp.customize( 'et_divi[et_pb_team_member-header_font_size]', function( value ) {2921 value.bind( function( to ) {2922 et_print_module_styles_css(2923 'et_divi[et_pb_team_member-header_font_size]',2924 'font-size',2925 '.et_pb_team_member h4',2926 to2927 );2928 } );2929 } );2930 wp.customize( 'et_divi[et_pb_team_member-header_font_style]', function( value ) {2931 value.bind( function( to ) {2932 et_print_module_styles_css(2933 'et_divi[et_pb_team_member-header_font_style]',2934 'font-styles',2935 '.et_pb_team_member h4',2936 to2937 );2938 } );2939 } );2940 wp.customize( 'et_divi[et_pb_team_member-subheader_font_size]', function( value ) {2941 value.bind( function( to ) {2942 et_print_module_styles_css(2943 'et_divi[et_pb_team_member-subheader_font_size]',2944 'font-size',2945 '.et_pb_team_member .et_pb_member_position',2946 to2947 );2948 } );2949 } );2950 wp.customize( 'et_divi[et_pb_team_member-subheader_font_style]', function( value ) {2951 value.bind( function( to ) {2952 et_print_module_styles_css(2953 'et_divi[et_pb_team_member-subheader_font_style]',2954 'font-styles',2955 '.et_pb_team_member .et_pb_member_position',2956 to2957 );2958 } );2959 } );2960 wp.customize( 'et_divi[et_pb_team_member-social_network_icon_size]', function( value ) {2961 value.bind( function( to ) {2962 et_print_module_styles_css(2963 'et_divi[et_pb_team_member-social_network_icon_size]',2964 'font-size',2965 '.et_pb_member_social_links a',2966 to2967 );2968 } );2969 } );2970 /* Divider */2971 wp.customize( 'et_divi[et_pb_divider-divider_style]', function( value ) {2972 value.bind( function( to ) {2973 et_print_module_styles_css(2974 'et_divi[et_pb_divider-divider_style]',2975 'border-top-style',2976 '.et_pb_space:before',2977 to2978 );2979 } );2980 } );2981 wp.customize( 'et_divi[et_pb_divider-divider_weight]', function( value ) {2982 value.bind( function( to ) {2983 et_print_module_styles_css(2984 'et_divi[et_pb_divider-divider_weight]',2985 'border-top-width',2986 '.et_pb_space:before',2987 to2988 );2989 } );2990 } );2991 wp.customize( 'et_divi[et_pb_divider-height]', function( value ) {2992 value.bind( function( to ) {2993 et_print_module_styles_css(2994 'et_divi[et_pb_divider-height]',2995 'height',2996 '.et_pb_space',2997 to2998 );2999 } );3000 } );3001 wp.customize( 'et_divi[et_pb_divider-divider_position]', function( value ) {3002 value.bind( function( to ) {3003 $('.customized_et_pb_divider_position').removeClass( function( index, css ){3004 return ( css.match(/\bet_pb_divider_position_\S+/g) || [] ).join(' ');3005 } ).addClass( "et_pb_divider_position_" + to );3006 } );3007 } );3008 /* Blog */3009 wp.customize( 'et_divi[et_pb_blog-header_font_size]', function( value ) {3010 value.bind( function( to ) {3011 et_print_module_styles_css(3012 'et_divi[et_pb_blog-header_font_size]',3013 'font-size',3014 '.et_pb_posts .et_pb_post h2',3015 to3016 );3017 } );3018 } );3019 wp.customize( 'et_divi[et_pb_blog-header_font_style]', function( value ) {3020 value.bind( function( to ) {3021 et_print_module_styles_css(3022 'et_divi[et_pb_blog-header_font_style]',3023 'font-styles',3024 '.et_pb_posts .et_pb_post h2',3025 to3026 );3027 } );3028 } );3029 wp.customize( 'et_divi[et_pb_blog-meta_font_size]', function( value ) {3030 value.bind( function( to ) {3031 et_print_module_styles_css(3032 'et_divi[et_pb_blog-meta_font_size]',3033 'font-size',3034 '.et_pb_posts .et_pb_post .post-meta',3035 to3036 );3037 } );3038 } );3039 wp.customize( 'et_divi[et_pb_blog-meta_font_style]', function( value ) {3040 value.bind( function( to ) {3041 et_print_module_styles_css(3042 'et_divi[et_pb_blog-meta_font_style]',3043 'font-styles',3044 '.et_pb_posts .et_pb_post .post-meta',3045 to3046 );3047 } );3048 } );3049 /* Blog Grid */3050 wp.customize( 'et_divi[et_pb_blog_masonry-header_font_size]', function( value ) {3051 value.bind( function( to ) {3052 et_print_module_styles_css(3053 'et_divi[et_pb_blog_masonry-header_font_size]',3054 'font-size',3055 '.et_pb_blog_grid .et_pb_post h2',3056 to3057 );3058 } );3059 } );3060 wp.customize( 'et_divi[et_pb_blog_masonry-header_font_style]', function( value ) {3061 value.bind( function( to ) {3062 et_print_module_styles_css(3063 'et_divi[et_pb_blog_masonry-header_font_style]',3064 'font-styles',3065 '.et_pb_blog_grid .et_pb_post h2',3066 to3067 );3068 } );3069 } );3070 wp.customize( 'et_divi[et_pb_blog_masonry-meta_font_size]', function( value ) {3071 value.bind( function( to ) {3072 et_print_module_styles_css(3073 'et_divi[et_pb_blog_masonry-meta_font_size]',3074 'font-size',3075 '.et_pb_blog_grid .et_pb_post .post-meta',3076 to3077 );3078 } );3079 } );3080 wp.customize( 'et_divi[et_pb_blog_masonry-meta_font_style]', function( value ) {3081 value.bind( function( to ) {3082 et_print_module_styles_css(3083 'et_divi[et_pb_blog_masonry-meta_font_style]',3084 'font-styles',3085 '.et_pb_blog_grid .et_pb_post .post-meta',3086 to3087 );3088 } );3089 } );3090 /* Shop */3091 wp.customize( 'et_divi[et_pb_shop-title_font_size]', function( value ) {3092 value.bind( function( to ) {3093 et_print_module_styles_css(3094 'et_divi[et_pb_shop-title_font_size]',3095 'font-size',3096 '.woocommerce ul.products li.product h3, .woocommerce-page ul.products li.product h3',3097 to3098 );3099 } );3100 } );3101 wp.customize( 'et_divi[et_pb_shop-title_font_style]', function( value ) {3102 value.bind( function( to ) {3103 et_print_module_styles_css(3104 'et_divi[et_pb_shop-title_font_style]',3105 'font-styles',3106 '.woocommerce ul.products li.product h3, .woocommerce-page ul.products li.product h3',3107 to3108 );3109 } );3110 } );3111 wp.customize( 'et_divi[et_pb_shop-sale_badge_font_size]', function( value ) {3112 value.bind( function( to ) {3113 et_print_module_styles_css(3114 'et_divi[et_pb_shop-sale_badge_font_size]',3115 'font-size',3116 '.woocommerce span.onsale, .woocommerce-page span.onsale',3117 to3118 );3119 } );3120 } );3121 wp.customize( 'et_divi[et_pb_shop-sale_badge_font_style]', function( value ) {3122 value.bind( function( to ) {3123 et_print_module_styles_css(3124 'et_divi[et_pb_shop-sale_badge_font_style]',3125 'font-styles',3126 '.woocommerce span.onsale, .woocommerce-page span.onsale',3127 to,3128 'use_important'3129 );3130 } );3131 } );3132 wp.customize( 'et_divi[et_pb_shop-price_font_size]', function( value ) {3133 value.bind( function( to ) {3134 et_print_module_styles_css(3135 'et_divi[et_pb_shop-price_font_size]',3136 'font-size',3137 '.woocommerce ul.products li.product .price .amount, .woocommerce-page ul.products li.product .price .amount',3138 to3139 );3140 } );3141 } );3142 wp.customize( 'et_divi[et_pb_shop-price_font_style]', function( value ) {3143 value.bind( function( to ) {3144 et_print_module_styles_css(3145 'et_divi[et_pb_shop-price_font_style]',3146 'font-styles',3147 '.woocommerce ul.products li.product .price .amount, .woocommerce-page ul.products li.product .price .amount',3148 to,3149 'use_important'3150 );3151 } );3152 } );3153 wp.customize( 'et_divi[et_pb_shop-sale_price_font_size]', function( value ) {3154 value.bind( function( to ) {3155 et_print_module_styles_css(3156 'et_divi[et_pb_shop-sale_price_font_size]',3157 'font-size',3158 '.woocommerce ul.products li.product .price ins .amount, .woocommerce-page ul.products li.product .price ins .amount',3159 to3160 );3161 } );3162 } );3163 wp.customize( 'et_divi[et_pb_shop-sale_price_font_style]', function( value ) {3164 value.bind( function( to ) {3165 et_print_module_styles_css(3166 'et_divi[et_pb_shop-sale_price_font_style]',3167 'font-styles',3168 '.woocommerce ul.products li.product .price ins .amount, .woocommerce-page ul.products li.product .price ins .amount',3169 to,3170 'use_important'3171 );3172 } );3173 } );3174 /* Countdown */3175 wp.customize( 'et_divi[et_pb_countdown_timer-header_font_size]', function( value ) {3176 value.bind( function( to ) {3177 et_print_module_styles_css(3178 'et_divi[et_pb_countdown_timer-header_font_size]',3179 'font-size',3180 '.et_pb_countdown_timer .title',3181 to3182 );3183 } );3184 } );3185 wp.customize( 'et_divi[et_pb_countdown_timer-header_font_style]', function( value ) {3186 value.bind( function( to ) {3187 et_print_module_styles_css(3188 'et_divi[et_pb_countdown_timer-header_font_style]',3189 'font-styles',3190 '.et_pb_countdown_timer .title',3191 to3192 );3193 } );3194 } );3195 /* Social */3196 wp.customize( 'et_divi[et_pb_social_media_follow-button_font_style]', function( value ) {3197 value.bind( function( to ) {3198 et_print_module_styles_css(3199 'et_divi[et_pb_social_media_follow-button_font_style]',3200 'font-styles',3201 '.et_pb_social_media_follow li a.follow_button',3202 to3203 );3204 } );3205 } );3206 wp.customize( 'et_divi[et_pb_social_media_follow-icon_size]', function( value ) {3207 value.bind( function( to ) {3208 et_print_module_styles_css(3209 'et_divi[et_pb_social_media_follow-icon_size]',3210 'social-icon-size',3211 '',3212 to3213 );3214 } );3215 } );3216 /* Fullwidth Slider */3217 wp.customize( 'et_divi[et_pb_fullwidth_slider-header_font_size]', function( value ) {3218 value.bind( function( to ) {3219 et_print_module_styles_css(3220 'et_divi[et_pb_fullwidth_slider-header_font_size]',3221 'font-size',3222 '.et_pb_fullwidth_section .et_pb_slide_description .et_pb_slide_title',3223 to3224 );3225 et_fix_slider_height();3226 } );3227 } );3228 wp.customize( 'et_divi[et_pb_fullwidth_slider-header_font_style]', function( value ) {3229 value.bind( function( to ) {3230 et_print_module_styles_css(3231 'et_divi[et_pb_fullwidth_slider-header_font_style]',3232 'font-styles',3233 '.et_pb_fullwidth_section .et_pb_slide_description .et_pb_slide_title',3234 to3235 );3236 } );3237 } );3238 wp.customize( 'et_divi[et_pb_fullwidth_slider-body_font_size]', function( value ) {3239 value.bind( function( to ) {3240 et_print_module_styles_css(3241 'et_divi[et_pb_fullwidth_slider-body_font_size]',3242 'font-size',3243 '.et_pb_fullwidth_section .et_pb_slide_content',3244 to3245 );3246 et_fix_slider_height();3247 } );3248 } );3249 wp.customize( 'et_divi[et_pb_fullwidth_slider-body_font_style]', function( value ) {3250 value.bind( function( to ) {3251 et_print_module_styles_css(3252 'et_divi[et_pb_fullwidth_slider-body_font_style]',3253 'font-styles',3254 '.et_pb_fullwidth_section .et_pb_slide_content',3255 to3256 );3257 } );3258 } );3259 wp.customize( 'et_divi[et_pb_fullwidth_slider-padding]', function( value ) {3260 value.bind( function( to ) {3261 et_print_module_styles_css(3262 'et_divi[et_pb_fullwidth_slider-padding]',3263 'padding-slider',3264 '.et_pb_fullwidth_section .et_pb_slide_description',3265 to3266 );3267 et_fix_slider_height();3268 } );3269 } );3270 /* Blog Panel */3271 wp.customize( 'et_divi[post_meta_font_size]', function( value ) {3272 value.bind( function( to ) {3273 var $style_content = "<style id='post_meta_font_size'>@media only screen and ( min-width: 981px ) { \3274 body.home-posts #left-area .et_pb_post .post-meta,\3275 body.archive #left-area .et_pb_post .post-meta,\3276 body.search #left-area .et_pb_post .post-meta,\3277 body.single #left-area .et_pb_post .post-meta { font-size:" + to + "px; }\3278 }</style>",3279 style_id = 'style#post_meta_font_size';3280 et_customizer_update_styles( style_id, $style_content );3281 } );3282 } );3283 wp.customize( 'et_divi[post_meta_height]', function( value ) {3284 value.bind( function( to ) {3285 var $style_content = "<style id='post_meta_height'> \3286 body.home-posts #left-area .et_pb_post .post-meta,\3287 body.archive #left-area .et_pb_post .post-meta,\3288 body.search #left-area .et_pb_post .post-meta,\3289 body.single #left-area .et_pb_post .post-meta { line-height: " + to + "em; }\3290 </style>",3291 style_id = 'style#post_meta_height';3292 et_customizer_update_styles( style_id, $style_content );3293 } );3294 } );3295 wp.customize( 'et_divi[post_meta_spacing]', function( value ) {3296 value.bind( function( to ) {3297 var $style_content = "<style id='post_meta_spacing'> \3298 body.home-posts #left-area .et_pb_post .post-meta,\3299 body.archive #left-area .et_pb_post .post-meta,\3300 body.search #left-area .et_pb_post .post-meta,\3301 body.single #left-area .et_pb_post .post-meta { letter-spacing: " + to + "px; }\3302 </style>",3303 style_id = 'style#post_meta_spacing';3304 et_customizer_update_styles( style_id, $style_content );3305 } );3306 } );3307 wp.customize( 'et_divi[post_meta_style]', function( value ) {3308 value.bind( function( to ) {3309 var styles = et_set_font_styles( to, '' ),3310 $button_style = '<style id="post_meta_style"> \3311 body.home-posts #left-area .et_pb_post .post-meta,\3312 body.archive #left-area .et_pb_post .post-meta,\3313 body.search #left-area .et_pb_post .post-meta,\3314 body.single #left-area .et_pb_post .post-meta {' + styles + '}</style>',3315 style_id = 'style#post_meta_style';3316 et_customizer_update_styles( style_id, $button_style );3317 } );3318 } );3319 wp.customize( 'et_divi[post_header_font_size]', function( value ) {3320 value.bind( function( to ) {3321 var $style_content = "<style id='post_header_font_size'>@media only screen and ( min-width: 981px ) {\3322 body.home-posts #left-area .et_pb_post h2,\3323 body.archive #left-area .et_pb_post h2,\3324 body.search #left-area .et_pb_post h2 { font-size:" + parseInt( to ) * ( 26 / 30 ) + "px }\3325 body.single .et_post_meta_wrapper h1 { font-size:" + to + "px; }\3326 }</style>",3327 style_id = 'style#post_header_font_size';3328 et_customizer_update_styles( style_id, $style_content );3329 } );3330 } );3331 wp.customize( 'et_divi[post_header_height]', function( value ) {3332 value.bind( function( to ) {3333 var $style_content = "<style id='post_header_height'>\3334 body.home-posts #left-area .et_pb_post h2,\3335 body.archive #left-area .et_pb_post h2,\3336 body.search #left-area .et_pb_post h2,\3337 body.single .et_post_meta_wrapper h1 { line-height: " + to + "em; }\3338 </style>",3339 style_id = 'style#post_header_height';3340 et_customizer_update_styles( style_id, $style_content );3341 } );3342 } );3343 wp.customize( 'et_divi[post_header_spacing]', function( value ) {3344 value.bind( function( to ) {3345 var $style_content = "<style id='post_header_spacing'>\3346 body.home-posts #left-area .et_pb_post h2,\3347 body.archive #left-area .et_pb_post h2,\3348 body.search #left-area .et_pb_post h2,\3349 body.single .et_post_meta_wrapper h1 { letter-spacing: " + to + "px; }\3350 </style>",3351 style_id = 'style#post_header_spacing';3352 et_customizer_update_styles( style_id, $style_content );3353 } );3354 } );3355 wp.customize( 'et_divi[post_header_style]', function( value ) {3356 value.bind( function( to ) {3357 var styles = et_set_font_styles( to, '' ),3358 $button_style = '<style id="post_header_style">\3359 body.home-posts #left-area .et_pb_post h2,\3360 body.archive #left-area .et_pb_post h2,\3361 body.search #left-area .et_pb_post h2,\3362 body.single .et_post_meta_wrapper h1 {' + styles + '}\3363 </style>',3364 style_id = 'style#post_header_style';3365 et_customizer_update_styles( style_id, $button_style );3366 } );3367 } );3368 wp.customize( 'et_divi[all_buttons_font_size]', function( value ) {3369 value.bind( function( to ) {3370 var $button_style = '<style id="buttons_icon_font_size">body #page-container .et_pb_button, ' + css('.et_pb_button') + '{ font-size: ' + to + 'px; } body #page-container .et_pb_button:after, ' + css('.et_pb_button:after') + ', .woocommerce a.button.alt:after, .woocommerce-page a.button.alt:after, .woocommerce button.button.alt:after, .woocommerce-page button.button.alt:after, .woocommerce input.button.alt:after, .woocommerce-page input.button.alt:after, .woocommerce #respond input#submit.alt:after, .woocommerce-page #respond input#submit.alt:after, .woocommerce #content input.button.alt:after, .woocommerce-page #content input.button.alt:after, .woocommerce a.button:after, .woocommerce-page a.button:after, .woocommerce button.button:after, .woocommerce-page button.button:after, .woocommerce input.button:after, .woocommerce-page input.button:after, .woocommerce #respond input#submit:after, .woocommerce-page #respond input#submit:after, .woocommerce #content input.button:after, .woocommerce-page #content input.button:after { font-size:' + parseInt( to ) * 1.6 + 'px; } body.et_button_custom_icon #page-container .et_pb_button:after, body.et_button_custom_icon.' + css('.et_pb_button:after') + ' { font-size:' + to + 'px; } </style>',3371 style_id = 'style#buttons_icon_font_size';3372 et_customizer_update_styles( style_id, $button_style );3373 } );3374 } );3375 wp.customize( 'et_divi[all_buttons_text_color]', function( value ) {3376 value.bind( function( to ) {3377 var $button_style = "<style id='buttons_text_color'> body.et_pb_button_helper_class #page-container .et_pb_button, body.et_pb_button_helper_class." + css('.et_pb_button') + ", \3378 .woocommerce.et_pb_button_helper_class a.button.alt, .woocommerce-page.et_pb_button_helper_class a.button.alt, .woocommerce.et_pb_button_helper_class button.button.alt, .woocommerce-page.et_pb_button_helper_class button.button.alt, .woocommerce.et_pb_button_helper_class input.button.alt, .woocommerce-page.et_pb_button_helper_class input.button.alt, .woocommerce.et_pb_button_helper_class #respond input#submit.alt, .woocommerce-page.et_pb_button_helper_class #respond input#submit.alt, .woocommerce.et_pb_button_helper_class #content input.button.alt, .woocommerce-page.et_pb_button_helper_class #content input.button.alt,\3379 .woocommerce.et_pb_button_helper_class a.button, .woocommerce-page.et_pb_button_helper_class a.button, .woocommerce.et_pb_button_helper_class button.button, .woocommerce-page.et_pb_button_helper_class button.button, .woocommerce.et_pb_button_helper_class input.button, .woocommerce-page.et_pb_button_helper_class input.button, .woocommerce.et_pb_button_helper_class #respond input#submit, .woocommerce-page.et_pb_button_helper_class #respond input#submit, .woocommerce.et_pb_button_helper_class #content input.button, .woocommerce-page.et_pb_button_helper_class #content input.button { color:" + to + ";}\3380 </style>",3381 style_id = 'style#buttons_text_color';3382 et_customizer_update_styles( style_id, $button_style );3383 } );3384 } );3385 wp.customize( 'et_divi[all_buttons_bg_color]', function( value ) {3386 value.bind( function( to ) {3387 var $button_style = '<style id="buttons_bg_color">body #page-container .et_pb_button, body.' + css('.et_pb_button') + ', .woocommerce a.button.alt, .woocommerce-page a.button.alt, .woocommerce button.button.alt, .woocommerce-page button.button.alt, .woocommerce input.button.alt, .woocommerce-page input.button.alt, .woocommerce #respond input#submit.alt, .woocommerce-page #respond input#submit.alt, .woocommerce #content input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce a.button, .woocommerce-page a.button, .woocommerce button.button, .woocommerce-page button.button, .woocommerce input.button, .woocommerce-page input.button, .woocommerce #respond input#submit, .woocommerce-page #respond input#submit, .woocommerce #content input.button, .woocommerce-page #content input.button { background:' + to + ';}</style>',3388 style_id = 'style#buttons_bg_color';3389 et_customizer_update_styles( style_id, $button_style );3390 } );3391 } );3392 wp.customize( 'et_divi[all_buttons_border_width]', function( value ) {3393 value.bind( function( to ) {3394 var $button_style = '<style id="buttons_border_width">body #page-container .et_pb_button, body.' + css('.et_pb_button') + ', .woocommerce a.button.alt, .woocommerce-page a.button.alt, .woocommerce button.button.alt, .woocommerce-page button.button.alt, .woocommerce input.button.alt, .woocommerce-page input.button.alt, .woocommerce #respond input#submit.alt, .woocommerce-page #respond input#submit.alt, .woocommerce #content input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce a.button, .woocommerce-page a.button, .woocommerce button.button, .woocommerce-page button.button, .woocommerce input.button, .woocommerce-page input.button, .woocommerce #respond input#submit, .woocommerce-page #respond input#submit, .woocommerce #content input.button, .woocommerce-page #content input.button { border-width:' + to + 'px !important; }</style>',3395 style_id = 'style#buttons_border_width';3396 et_customizer_update_styles( style_id, $button_style );3397 } );3398 } );3399 wp.customize( 'et_divi[all_buttons_border_color]', function( value ) {3400 value.bind( function( to ) {3401 var $button_style = '<style id="buttons_border_color">body #page-container .et_pb_button, body.' + css('.et_pb_button') + ', .woocommerce a.button.alt, .woocommerce-page a.button.alt, .woocommerce button.button.alt, .woocommerce-page button.button.alt, .woocommerce input.button.alt, .woocommerce-page input.button.alt, .woocommerce #respond input#submit.alt, .woocommerce-page #respond input#submit.alt, .woocommerce #content input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce a.button, .woocommerce-page a.button, .woocommerce button.button, .woocommerce-page button.button, .woocommerce input.button, .woocommerce-page input.button, .woocommerce #respond input#submit, .woocommerce-page #respond input#submit, .woocommerce #content input.button, .woocommerce-page #content input.button { border-color:' + to + ';}</style>',3402 style_id = 'style#buttons_border_color';3403 et_customizer_update_styles( style_id, $button_style );3404 } );3405 } );3406 wp.customize( 'et_divi[all_buttons_border_radius]', function( value ) {3407 value.bind( function( to ) {3408 var $button_style = '<style id="buttons_border_radius">body #page-container .et_pb_button, body.' + css('.et_pb_button') + ', .woocommerce a.button.alt, .woocommerce-page a.button.alt, .woocommerce button.button.alt, .woocommerce-page button.button.alt, .woocommerce input.button.alt, .woocommerce-page input.button.alt, .woocommerce #respond input#submit.alt, .woocommerce-page #respond input#submit.alt, .woocommerce #content input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce a.button, .woocommerce-page a.button, .woocommerce button.button, .woocommerce-page button.button, .woocommerce input.button, .woocommerce-page input.button, .woocommerce #respond input#submit, .woocommerce-page #respond input#submit, .woocommerce #content input.button, .woocommerce-page #content input.button { border-radius:' + to + 'px;}</style>',3409 style_id = 'style#buttons_border_radius';3410 et_customizer_update_styles( style_id, $button_style );3411 } );3412 } );3413 wp.customize( 'et_divi[all_buttons_font_style]', function( value ) {3414 value.bind( function( to ) {3415 var styles = et_set_font_styles( to, '' ),3416 $button_style = '<style id="buttons_font_style">body #page-container .et_pb_button, body.' + css('.et_pb_button') + ', .woocommerce a.button.alt, .woocommerce-page a.button.alt, .woocommerce button.button.alt, .woocommerce-page button.button.alt, .woocommerce input.button.alt, .woocommerce-page input.button.alt, .woocommerce #respond input#submit.alt, .woocommerce-page #respond input#submit.alt, .woocommerce #content input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce a.button, .woocommerce-page a.button, .woocommerce button.button, .woocommerce-page button.button, .woocommerce input.button, .woocommerce-page input.button, .woocommerce #respond input#submit, .woocommerce-page #respond input#submit, .woocommerce #content input.button, .woocommerce-page #content input.button {' + styles + '}</style>',3417 style_id = 'style#buttons_font_style';3418 et_customizer_update_styles( style_id, $button_style );3419 } );3420 } );3421 wp.customize( 'et_divi[primary_nav_font_style]', function( value ) {3422 value.bind( function( to ) {3423 var styles = et_set_font_styles( to, '' ),3424 $button_style = "<style id='primary_nav_font_style'> #top-menu li a, .et_search_form_container input {" + styles + "}\3425 .et_search_form_container input::-moz-placeholder { " + styles + " }\3426 .et_search_form_container input::-webkit-input-placeholder { " + styles + " }\3427 .et_search_form_container input:-ms-input-placeholder { " + styles + " }\3428 </style>",3429 style_id = 'style#primary_nav_font_style';3430 et_customizer_update_styles( style_id, $button_style );3431 } );3432 } );3433 wp.customize( 'et_divi[secondary_nav_font_style]', function( value ) {3434 value.bind( function( to ) {3435 var styles = et_set_font_styles( to, '' ),3436 $button_style = '<style id="secondary_nav_font_style"> #top-header, #top-header a, #et-secondary-nav li li a, #top-header .et-social-icon a:before {' + styles + '}</style>',3437 style_id = 'style#secondary_nav_font_style';3438 et_customizer_update_styles( style_id, $button_style );3439 } );3440 } );3441 wp.customize( 'et_divi[body_header_style]', function( value ) {3442 value.bind( function( to ) {3443 var styles = et_set_font_styles( to, '' ),3444 $button_style = '<style id="body_header_style"> h1, h2, h3, h4, h5, h6, ' + css('h1, h2, h3, h4, h5, h6, .et_quote_content blockquote p, .et_pb_slide_description .et_pb_slide_title') + ' {' + styles + '}</style>',3445 style_id = 'style#body_header_style';3446 et_customizer_update_styles( style_id, $button_style );3447 } );3448 } );3449 wp.customize( 'et_divi[all_buttons_selected_icon]', function( value ) {3450 value.bind( function( to ) {3451 var button_font_size = $( '.et_pb_button' ).css( 'font-size' ),3452 $button_style = "<style id='buttons_icon'>body #page-container .et_pb_button:after, body." + css('.et_pb_button:after') + ", .woocommerce a.button.alt:after, .woocommerce-page a.button.alt:after, .woocommerce button.button.alt:after, .woocommerce-page button.button.alt:after, .woocommerce input.button.alt:after, .woocommerce-page input.button.alt:after, .woocommerce #respond input#submit.alt:after, .woocommerce-page #respond input#submit.alt:after, .woocommerce #content input.button.alt:after, .woocommerce-page #content input.button.alt:after, .woocommerce a.button:after, .woocommerce-page a.button:after, .woocommerce button.button:after, .woocommerce-page button.button:after, .woocommerce input.button:after, .woocommerce-page input.button:after, .woocommerce #respond input#submit:after, .woocommerce-page #respond input#submit:after, .woocommerce #content input.button:after, .woocommerce-page #content input.button:after { font-size:" + button_font_size + ";",3453 style_id = 'style#buttons_icon';3454 if ( "'" === to ) {3455 $button_style += 'content:"' + to + '";'3456 } else {3457 $button_style += "content:'" + to + "';"3458 }3459 $button_style += "}</style>";3460 et_customizer_update_styles( style_id, $button_style );3461 if ( '5' !== to ) {3462 $( 'body' ).addClass( 'et_button_custom_icon' );3463 } else {3464 $( 'body' ).removeClass( 'et_button_custom_icon' );3465 }3466 } );3467 } );3468 wp.customize( 'et_divi[all_buttons_icon_color]', function( value ) {3469 value.bind( function( to ) {3470 var $button_style = '<style id="buttons_icon_color">body #page-container .et_pb_button:after, body.' + css('.et_pb_button:after') + ' .woocommerce a.button.alt:after, .woocommerce-page a.button.alt:after, .woocommerce button.button.alt:after, .woocommerce-page button.button.alt:after, .woocommerce input.button.alt:after, .woocommerce-page input.button.alt:after, .woocommerce #respond input#submit.alt:after, .woocommerce-page #respond input#submit.alt:after, .woocommerce #content input.button.alt:after, .woocommerce-page #content input.button.alt:after, .woocommerce a.button:after, .woocommerce-page a.button:after, .woocommerce button.button:after, .woocommerce-page button.button:after, .woocommerce input.button:after, .woocommerce-page input.button:after, .woocommerce #respond input#submit:after, .woocommerce-page #respond input#submit:after, .woocommerce #content input.button:after, .woocommerce-page #content input.button:after { color:' + to + ';}</style>',3471 style_id = 'style#buttons_icon_color';3472 et_customizer_update_styles( style_id, $button_style );3473 } );3474 } );3475 wp.customize( 'et_divi[all_buttons_icon_placement]', function( value ) {3476 value.bind( function( to ) {3477 if ( 'left' === to ) {3478 $( 'body' ).addClass( 'et_button_left' );3479 } else {3480 $( 'body' ).removeClass( 'et_button_left' );3481 }3482 } );3483 } );3484 wp.customize( 'et_divi[all_buttons_icon_hover]', function( value ) {3485 value.bind( function( to ) {3486 if ( 'no' === to ) {3487 $( 'body' ).addClass( 'et_button_icon_visible' );3488 } else {3489 $( 'body' ).removeClass( 'et_button_icon_visible' );3490 }3491 } );3492 } );3493 wp.customize( 'et_divi[all_buttons_icon]', function( value ) {3494 value.bind( function( to ) {3495 if ( 'no' === to ) {3496 $( 'body' ).addClass( 'et_button_no_icon' );3497 } else {3498 $( 'body' ).removeClass( 'et_button_no_icon' );3499 }3500 } );3501 } );3502 var buttons_hover_selector = 'body #page-container .et_pb_button:hover, body.' + css('.et_pb_button:hover') + ', .woocommerce a.button.alt:hover, .woocommerce-page a.button.alt:hover, .woocommerce button.button.alt:hover, .woocommerce-page button.button.alt:hover, .woocommerce input.button.alt:hover, .woocommerce-page input.button.alt:hover, .woocommerce #respond input#submit.alt:hover, .woocommerce-page #respond input#submit.alt:hover, .woocommerce #content input.button.alt:hover, .woocommerce-page #content input.button.alt:hover, .woocommerce a.button:hover, .woocommerce-page a.button:hover, .woocommerce button.button:hover, .woocommerce-page button.button:hover, .woocommerce input.button:hover, .woocommerce-page input.button:hover, .woocommerce #respond input#submit:hover, .woocommerce-page #respond input#submit:hover, .woocommerce #content input.button:hover, .woocommerce-page #content input.button:hover';3503 wp.customize( 'et_divi[all_buttons_text_color_hover]', function( value ) {3504 value.bind( function( to ) {3505 var $button_style = '<style id="buttons_text_color_hover">' + buttons_hover_selector + ' { color: ' + to + ' !important; } </style>',3506 style_id = 'style#buttons_text_color_hover';3507 et_customizer_update_styles( style_id, $button_style );3508 } );3509 } );3510 wp.customize( 'et_divi[all_buttons_bg_color_hover]', function( value ) {3511 value.bind( function( to ) {3512 var $button_style = '<style id="buttons_bg_color_hover">' + buttons_hover_selector + ' { background: ' + to + ' !important; } </style>',3513 style_id = 'style#buttons_bg_color_hover';3514 et_customizer_update_styles( style_id, $button_style );3515 } );3516 } );3517 wp.customize( 'et_divi[all_buttons_border_color_hover]', function( value ) {3518 value.bind( function( to ) {3519 var $button_style = '<style id="buttons_border_color_hover">' + buttons_hover_selector + ' { border-color: ' + to + ' !important; } </style>',3520 style_id = 'style#buttons_border_color_hover';3521 et_customizer_update_styles( style_id, $button_style );3522 } );3523 } );3524 wp.customize( 'et_divi[all_buttons_border_radius_hover]', function( value ) {3525 value.bind( function( to ) {3526 var $button_style = '<style id="buttons_border_radius_hover">' + buttons_hover_selector + ' { border-radius: ' + to + 'px !important; } </style>',3527 style_id = 'style#buttons_border_radius_hover';3528 et_customizer_update_styles( style_id, $button_style );3529 } );3530 } );3531 wp.customize( 'et_divi[all_buttons_spacing]', function( value ) {3532 value.bind( function( to ) {3533 var $button_style = '<style id="buttons_spacing">body #page-container .et_pb_button, body.' + css('.et_pb_button') + ', .woocommerce a.button.alt, .woocommerce-page a.button.alt, .woocommerce button.button.alt, .woocommerce-page button.button.alt, .woocommerce input.button.alt, .woocommerce-page input.button.alt, .woocommerce #respond input#submit.alt, .woocommerce-page #respond input#submit.alt, .woocommerce #content input.button.alt, .woocommerce-page #content input.button.alt, .woocommerce a.button, .woocommerce-page a.button, .woocommerce button.button, .woocommerce-page button.button, .woocommerce input.button, .woocommerce-page input.button, .woocommerce #respond input#submit, .woocommerce-page #respond input#submit, .woocommerce #content input.button, .woocommerce-page #content input.button { letter-spacing: ' + to + 'px; } </style>',3534 style_id = 'style#buttons_spacing';3535 et_customizer_update_styles( style_id, $button_style );3536 } );3537 } );3538 wp.customize( 'et_divi[all_buttons_spacing_hover]', function( value ) {3539 value.bind( function( to ) {3540 var $button_style = '<style id="buttons_spacing_hover">' + buttons_hover_selector + ' { letter-spacing: ' + to + 'px; } </style>',3541 style_id = 'style#buttons_spacing_hover';3542 et_customizer_update_styles( style_id, $button_style );3543 } );3544 } );3545 wp.customize( 'et_divi[slide_nav_show_top_bar]', function( value ) {3546 value.bind( function( to ) {3547 var $style_content,3548 style_id = 'style#slide_nav_show_top_bar';3549 if ( to ) {3550 $style_content = '<style id="slide_nav_show_top_bar"></style>';3551 $( 'body' ).removeClass( 'et_pb_no_top_bar_fullscreen' );3552 } else {3553 $style_content = '<style id="slide_nav_show_top_bar">.et_slide_menu_top{ display: none; }</style>';3554 $( 'body' ).addClass( 'et_pb_no_top_bar_fullscreen' );3555 }3556 et_customizer_update_styles( style_id, $style_content );3557 } );3558 } );3559 wp.customize( 'et_divi[slide_nav_bg]', function( value ) {3560 value.bind( function( to ) {3561 var $style_content = '<style id="slide_nav_bg">body #page-container .et_slide_in_menu_container{ background: ' + to + '; } </style>',3562 style_id = 'style#slide_nav_bg';3563 et_customizer_update_styles( style_id, $style_content );3564 } );3565 } );3566 wp.customize( 'et_divi[slide_nav_links_color]', function( value ) {3567 value.bind( function( to ) {3568 var $style_content = '<style id="slide_nav_links_color">.et_slide_in_menu_container #mobile_menu_slide li span.et_mobile_menu_arrow:before, .et_slide_in_menu_container #mobile_menu_slide li a { color: ' + to + '; } </style>',3569 style_id = 'style#slide_nav_links_color';3570 et_customizer_update_styles( style_id, $style_content );3571 } );3572 } );3573 wp.customize( 'et_divi[slide_nav_links_color_active]', function( value ) {3574 value.bind( function( to ) {3575 var $style_content = '<style id="slide_nav_links_color_active">.et_slide_in_menu_container #mobile_menu_slide li.current-menu-item span.et_mobile_menu_arrow:before, .et_slide_in_menu_container #mobile_menu_slide li.current-menu-item a { color: ' + to + '; } </style>',3576 style_id = 'style#slide_nav_links_color_active';3577 et_customizer_update_styles( style_id, $style_content );3578 } );3579 } );3580 wp.customize( 'et_divi[slide_nav_top_color]', function( value ) {3581 value.bind( function( to ) {3582 var $style_content = "<style id='slide_nav_top_color'>.et_slide_in_menu_container .et_slide_menu_top, .et_slide_in_menu_container .et_slide_menu_top a, .et_slide_in_menu_container .et_slide_menu_top input { color: " + to + "; } \3583 .et_slide_in_menu_container .et_slide_menu_top .et-search-form input, .et_slide_in_menu_container .et_slide_menu_top .et-search-form button#searchsubmit_header:before { color: " + to + "; } \3584 .et_slide_in_menu_container .et_slide_menu_top .et-search-form input::-webkit-input-placeholder { color: " + to + "; } \3585 .et_slide_in_menu_container .et_slide_menu_top .et-search-form input::-moz-placeholder { color: " + to + "; } \3586 .et_slide_in_menu_container .et_slide_menu_top .et-search-form input:-ms-input-placeholder { color: " + to + "; } \3587 .et_header_style_fullscreen .et_slide_in_menu_container span.mobile_menu_bar.et_toggle_fullscreen_menu:before { color: " + to + "; } \3588 .et_header_style_fullscreen .et_slide_menu_top .et-search-form { border-color: " + to + "; } \3589 </style>",3590 style_id = 'style#slide_nav_top_color';3591 et_customizer_update_styles( style_id, $style_content );3592 } );3593 } );3594 wp.customize( 'et_divi[slide_nav_search]', function( value ) {3595 value.bind( function( to ) {3596 var $style_content = "<style id='slide_nav_search'>.et_header_style_slide .et_slide_in_menu_container .et_slide_menu_top .et-search-form input,.et_header_style_slide .et_slide_in_menu_container .et_slide_menu_top .et-search-form button#searchsubmit_header:before { color: " + to + "; } \3597 .et_header_style_slide .et_slide_in_menu_container .et_slide_menu_top .et-search-form input::-webkit-input-placeholder { color: " + to + "; } \3598 .et_header_style_slide .et_slide_in_menu_container .et_slide_menu_top .et-search-form input::-moz-placeholder { color: " + to + "; } \3599 .et_header_style_slide .et_slide_in_menu_container .et_slide_menu_top .et-search-form input:-ms-input-placeholder { color: " + to + "; } \3600 </style>",3601 style_id = 'style#slide_nav_search';3602 if ( 'rgba(255,255,255,0.6)' === to ) {3603 $style_content = '';3604 }3605 et_customizer_update_styles( style_id, $style_content );3606 } );3607 } );3608 wp.customize( 'et_divi[slide_nav_search_bg]', function( value ) {3609 value.bind( function( to ) {3610 var $style_content = '<style id="slide_nav_search_bg">.et_header_style_slide .et_slide_in_menu_container .et_slide_menu_top .et-search-form { background: ' + to + ' !important; } </style>',3611 style_id = 'style#slide_nav_search_bg';3612 et_customizer_update_styles( style_id, $style_content );3613 } );3614 } );3615 wp.customize( 'et_divi[slide_nav_width]', function( value ) {3616 value.bind( function( to ) {3617 var $style_content = '<style id="slide_nav_width">.et_header_style_slide .et_slide_in_menu_container { width: ' + to + 'px; } </style>',3618 style_id = 'style#slide_nav_width',3619 $slide_menu_container = $( '.et_slide_in_menu_container' ),3620 $page_container = $( '#page-container, .et_fixed_nav #main-header' ),3621 is_menu_opened = $( 'body' ).hasClass( 'et_pb_slide_menu_active' );3622 et_customizer_update_styles( style_id, $style_content );3623 if ( is_menu_opened ) {3624 $page_container.css( { left: '-' + $slide_menu_container.innerWidth() + 'px' } );3625 } else {3626 $slide_menu_container.css( { right: '-' + $slide_menu_container.innerWidth() + 'px' } );3627 }3628 } );3629 } );3630 wp.customize( 'et_divi[slide_nav_font_style]', function( value ) {3631 value.bind( function( to ) {3632 var styles = et_set_font_styles( to, '' ),3633 $style_content = '<style id="slide_nav_font_style"> .et_slide_in_menu_container, .et_slide_in_menu_container .et-search-field, .et_slide_in_menu_container a, .et_slide_in_menu_container #et-info span {' + styles + '}</style>',3634 style_id = 'style#slide_nav_font_style';3635 et_customizer_update_styles( style_id, $style_content );3636 } );3637 } );3638 wp.customize( 'et_divi[slide_nav_font_size]', function( value ) {3639 value.bind( function( to ) {3640 var $style_content = "<style id='slide_nav_font_size'> .et_header_style_slide .et_slide_in_menu_container .et_mobile_menu li a { font-size:" + to + "px; }\3641 </style>",3642 style_id = 'style#slide_nav_font_size';3643 et_customizer_update_styles( style_id, $style_content );3644 } );3645 } );3646 wp.customize( 'et_divi[slide_nav_top_font_size]', function( value ) {3647 value.bind( function( to ) {3648 var $style_content = "<style id='slide_nav_top_font_size'> .et_header_style_slide .et_slide_in_menu_container,.et_header_style_slide .et_slide_in_menu_container input.et-search-field,.et_header_style_slide .et_slide_in_menu_container a,.et_header_style_slide .et_slide_in_menu_container #et-info span,.et_header_style_slide .et_slide_menu_top ul.et-social-icons a,.et_header_style_slide .et_slide_menu_top span { font-size: " + to + "px; }\3649 .et_header_style_slide .et_slide_in_menu_container .et-search-field::-moz-placeholder { font-size: " + to + "px; }\3650 .et_header_style_slide .et_slide_in_menu_container .et-search-field::-webkit-input-placeholder { font-size: " + to + "px; }\3651 .et_header_style_slide .et_slide_in_menu_container .et-search-field:-ms-input-placeholder { font-size: " + to + "px; }\3652 </style>",3653 style_id = 'style#slide_nav_top_font_size';3654 et_customizer_update_styles( style_id, $style_content );3655 } );3656 } );3657 wp.customize( 'et_divi[fullscreen_nav_font_size]', function( value ) {3658 value.bind( function( to ) {3659 var $style_content = "<style id='fullscreen_nav_font_size'> .et_header_style_fullscreen .et_slide_in_menu_container .et_mobile_menu li a { font-size:" + to + "px; }\3660 </style>",3661 style_id = 'style#fullscreen_nav_font_size';3662 et_customizer_update_styles( style_id, $style_content );3663 } );3664 } );3665 wp.customize( 'et_divi[fullscreen_nav_top_font_size]', function( value ) {3666 value.bind( function( to ) {3667 var $style_content = "<style id='fullscreen_nav_top_font_size'> .et_header_style_fullscreen .et_slide_in_menu_container,.et_header_style_fullscreen .et_slide_in_menu_container input.et-search-field,.et_header_style_fullscreen .et_slide_in_menu_container a,.et_header_style_fullscreen .et_slide_in_menu_container #et-info span,.et_header_style_fullscreen .et_slide_menu_top ul.et-social-icons a,.et_header_style_fullscreen .et_slide_menu_top span { font-size: " + to + "px; }\3668 .et_header_style_fullscreen .et_slide_in_menu_container .et-search-field::-moz-placeholder { font-size: " + to + "px; }\3669 .et_header_style_fullscreen .et_slide_in_menu_container .et-search-field::-webkit-input-placeholder { font-size: " + to + "px; }\3670 .et_header_style_fullscreen .et_slide_in_menu_container .et-search-field:-ms-input-placeholder { font-size: " + to + "px; }\3671 </style>",3672 style_id = 'style#fullscreen_nav_top_font_size';3673 et_customizer_update_styles( style_id, $style_content );3674 } );3675 } );3676 wp.customize( 'et_divi[slide_nav_font_spacing]', function( value ) {3677 value.bind( function( to ) {3678 var $style_content = "<style id='slide_nav_font_spacing'>\3679 .et_slide_in_menu_container, .et_slide_in_menu_container .et-search-field { letter-spacing: " + to + "px; }\3680 .et_slide_in_menu_container .et-search-field::-moz-placeholder { letter-spacing: " + to + "px; }\3681 .et_slide_in_menu_container .et-search-field::-webkit-input-placeholder { letter-spacing: " + to + "px; }\3682 .et_slide_in_menu_container .et-search-field:-ms-input-placeholder { letter-spacing: " + to + "px; }\3683 </style>",3684 style_id = 'style#slide_nav_font_spacing';3685 et_customizer_update_styles( style_id, $style_content );3686 } );3687 } );3688 wp.customize.bind( 'ready', function() {3689 wp.customize.previewer.bind( 'et-load', function( data ) {3690 console.log('Data from preview window: ', data);3691 } );3692 } );3693 $(document).on('et-customizer-preview-load', function(e, data) {3694 isCustomPostType = data.isCustomPostType;3695 selectorWrapper = data.selectorWrapper;3696 });...

Full Screen

Full Screen

et_lb_admin.js

Source:et_lb_admin.js Github

copy

Full Screen

...42 $settings_window.find('.html-active').removeClass('html-active').addClass('tmce-active');43 $('#et_module_separator').show();4445 $('#et_layout .et_module:not(.et_active,.et_m_column)').css('opacity',0.5);46 $('html:not(:animated),body:not(:animated)').animate({ scrollTop: $('#et_page_builder').offset().top - 82 }, 500);4748 et_deactivate_ui_actions();49 et_module_settings_clicked = false;5051 $( '#et_module_settings .et_lb_option' ).each( function(){52 var $this_option = $(this),53 this_option_id = $this_option.attr('id'),54 $found_element = $et_active_module.find('.et_module_settings .et_module_setting.' + this_option_id);5556 if ( $found_element.length ){57 if ( $this_option.is('select') ){58 $this_option.find("option[value='" + $found_element.html() + "']").attr('selected','selected');59 } else if ( $this_option.is('input') ){60 $this_option.val( $found_element.html() );61 } else if ( $this_option.hasClass('et_lb_wp_editor') ) {62 $this_option.html( '' );63 } else {64 $this_option.html( $found_element.html() );65 }66 }6768 if ( $this_option.hasClass('et_lb_wp_editor') && typeof tinyMCE !== "undefined" ) {69 var et_element_content = $found_element.length ? $found_element.html() : '';7071 tinyMCE.execCommand( "mceAddEditor", true, this_option_id );72 et_init_new_editor( this_option_id );73 tinyMCE.get( this_option_id ).execCommand( "mceInsertContent", false, et_element_content );74 }7576 et_init_sortable_attachments();77 } );7879 if ( $et_active_module.hasClass('et_m_tabs') || $et_active_module.hasClass('et_m_simple_slider') ){80 $( '#et_module_settings #et_lb_tabs .wp-editor-wrap' ).each( function(index,value){81 var $this_div = $(this),82 this_editor_content = $this_div.html();8384 $.ajax({85 type: "POST",86 url: et_lb_options.ajaxurl,87 async: false, // asynchronous requests might result in errors if there are a lot of tabs to render88 data:89 {90 action : 'et_convert_div_to_editor',91 et_load_nonce : et_lb_options.et_load_nonce,92 et_index : index93 },94 success: function( response ){95 var current_tab_id = 'et_tab_text_' + index;9697 $this_div.closest('.et_lb_tab').find('a.et_lb_delete_tab').before( response );9899 if ( typeof tinyMCE !== "undefined" ){100 tinyMCE.execCommand( "mceAddEditor", true, current_tab_id );101 et_init_new_editor( current_tab_id );102 tinyMCE.get( current_tab_id ).execCommand( "mceInsertContent", false, this_editor_content );103 }104105 $this_div.remove();106107 et_make_editor_droppable();108109 et_track_active_editor();110 }111 });112 } );113114 if ( $( '#et_module_settings #et_lb_tabs .et_tabs_data-elements' ).length ){115 $( '#et_module_settings #et_lb_tabs' ).attr( 'data-elements', $( '#et_module_settings #et_lb_tabs .et_tabs_data-elements' ).val() );116 $( '#et_module_settings #et_lb_tabs .et_tabs_data-elements' ).remove();117 }118 et_init_sortable_tabs();119 }120121 et_track_active_editor();122 }123 });124 } );125126 $( 'body' ).delegate( 'span.et_delete, span.et_delete_column', 'click', function(){127 var $this_delete_button = $(this);128129 if ( $this_delete_button.hasClass('et_delete') ){130 if ( $this_delete_button.find('.et_lb_delete_confirmation').length ){131 $this_delete_button.find('.et_lb_delete_confirmation').remove();132 } else {133 $this_delete_button.append( '<span class="et_lb_delete_confirmation">' + '<span>' + et_lb_options.confirm_message + '</span>' + '<a href="#" class="et_lb_delete_confirm_yes">' + et_lb_options.confirm_message_yes + '</a><a href="#" class="et_lb_delete_confirm_no">' + et_lb_options.confirm_message_no + '</a></span>' );134 }135 return false;136 }137138 et_lb_delete_module( $this_delete_button.closest('.et_module') );139 } );140141 $( 'body' ).delegate( '.et_user_layout_delete', 'click', function(){142 var $this_delete_button = $(this);143144 if ( $this_delete_button.find('.et_lb_delete_confirmation').length ){145 $this_delete_button.find('.et_lb_delete_confirmation').remove();146 } else {147 $this_delete_button.append( '<span class="et_lb_delete_confirmation">' + '<span>' + et_lb_options.confirm_custom_layout_delete_message + '</span>' + '<a href="#" class="et_lb_delete_confirm_yes">' + et_lb_options.confirm_message_yes + '</a><a href="#" class="et_lb_delete_confirm_no">' + et_lb_options.confirm_message_no + '</a></span>' );148 }149 return false;150 } );151152 $( 'body' ).delegate( '.et_lb_delete_confirm_yes', 'click', function(){153 var $this_button = $(this);154155 if ( $this_button.closest('#et_lb_clear_all_wrapper').length ){156 $('#et_layout').html( '' );157 $('#et_lb_helper').show();158 $this_button.closest('.et_lb_delete_confirmation').remove();159 et_layout_save( true );160 } else if ( $this_button.closest('.et_sample_layout').length ) {161 $.ajax({162 type: "POST",163 url: et_lb_options.ajaxurl,164 data:165 {166 action : 'et_delete_sample_layout',167 et_load_nonce : et_lb_options.et_load_nonce,168 et_layout_key : $this_button.closest('.et_sample_layout').attr('data-name')169 },170 success: function( data ){171 $this_button.closest('.et_sample_layout').remove();172 }173 });174 } else if ( $this_button.closest('#et_lb_create_layout_wrapper').length && $this_button.siblings('#et_lb_new_layout_name').val() != '' ) {175 var layout_html = $('#et_layout').html(),176 $save_message = jQuery("#et_lb_ajax_save");177178 $.ajax({179 type: "POST",180 url: et_lb_options.ajaxurl,181 data:182 {183 action : 'et_create_new_sample_layout',184 et_load_nonce : et_lb_options.et_load_nonce,185 et_layout_html : layout_html,186 et_new_layout_name : $this_button.siblings('#et_lb_new_layout_name').val()187 },188 beforeSend: function ( xhr ){189 $save_message.children("img").css("display","block");190 $save_message.children("span").css("margin","6px 0px 0px 30px").html( et_lb_options.saving_text );191 $save_message.fadeIn('fast');192 },193 success: function( data ){194 $save_message.children("img").css("display","none");195 $save_message.children("span").css("margin","0px").html( et_lb_options.saved_text );196197 setTimeout(function(){198 $save_message.fadeOut("slow");199 },500);200201 $this_button.closest('.et_lb_delete_confirmation').remove();202 }203 });204 } else {205 et_lb_delete_module( $(this).closest('.et_module') );206 }207208 return false;209 } );210211 $( '#et_lb_clear_all' ).click( function(){212 var $this_button = $(this);213214 if ( $this_button.siblings('.et_lb_delete_confirmation').length ){215 $this_button.siblings('.et_lb_delete_confirmation').remove();216 } else {217 $this_button.closest('span').append( '<span class="et_lb_delete_confirmation">' + '<span>' + et_lb_options.confirm_clear_all_message + '</span>' + '<a href="#" class="et_lb_delete_confirm_yes">' + et_lb_options.confirm_message_yes + '</a><a href="#" class="et_lb_delete_confirm_no">' + et_lb_options.confirm_message_no + '</a></span>' );218 }219220 return false;221 } );222223 $( '#et_lb_create_layout' ).click( function(){224 var $this_button = $(this);225226 if ( $this_button.siblings('.et_lb_delete_confirmation').length ){227 $this_button.siblings('.et_lb_delete_confirmation').remove();228 } else {229 $this_button.closest('span').append( '<span class="et_lb_delete_confirmation">' + '<label for="et_lb_new_layout_name">' + et_lb_options.create_layout_name + ':</label>' + '<input type="text" value="" id="et_lb_new_layout_name" name="et_lb_new_layout_name" />' + '<small>' + et_lb_options.create_layout_description_text + '</small>' + '<a href="#" class="et_lb_delete_confirm_yes">' + et_lb_options.create_layout_confirm_message_yes + '</a><a href="#" class="et_lb_delete_confirm_no">' + et_lb_options.create_layout_confirm_message_no + '</a></span>' );230 }231232 return false;233 } );234235 $(document).on("keypress", "#et_lb_new_layout_name", function(e) {236 // if the user hits enter, create new sample layout and make sure the form isn't submitted237 if ( e.which == 13 ) {238 $(this).siblings( '.et_lb_delete_confirm_yes' ).trigger( 'click' );239 return false;240 }241 });242243 $( 'body' ).delegate( '#et_lb_secondary_buttons .et_lb_delete_confirm_no', 'click', function(){244 $(this).closest('.et_lb_delete_confirmation').remove();245246 return false;247 } );248249 $( 'body' ).delegate( '#et_close_dialog_settings', 'click', function(){250 var $et_dialog_form = $('form#et_dialog_settings');251252 $et_dialog_form.find('.et_lb_wp_editor').each( function(){253 if ( typeof tinyMCE !== "undefined" ) tinyMCE.execCommand("mceRemoveEditor", false, $(this).attr('id'));254 } );255256 et_close_modal_window();257258 return false;259 });260261 $( 'body' ).delegate( 'form#et_module_settings input#submit, #et_close_module_settings', 'click', function(){262 var $et_active_module_settings = $('.et_active .et_module_settings');263264 $et_active_module_settings.empty();265 $et_main_save_button.show();266267 $('form#et_module_settings .et_lb_option').each( function(){268 var et_option_value, et_option_class,269 this_option_id = $(this).attr('id');270271 et_option_class = this_option_id + ' et_module_setting';272273 if ( $(this).is('#et_lb_tabs') || $(this).is('#et_lb_slides') ){274 $(this).find('.et_lb_tab_title').each(function(){275 var this_value = $(this).val();276 $(this).attr('value', this_value);277 });278 $(this).find('.et_lb_wp_editor').each(function(){279 var $this_textarea = $(this),280 this_value = $this_textarea.val(),281 this_value_id = $this_textarea.attr('id'),282 this_editor_content;283284 if ( typeof tinyMCE !== "undefined" ){285 this_editor_content = $this_textarea.is(':hidden') ? tinyMCE.get( this_value_id ).getContent() : switchEditors.wpautop( tinymce.DOM.get( this_value_id ).value );286287 tinyMCE.execCommand("mceRemoveEditor", false, this_value_id);288 } else {289 this_editor_content = $this_textarea.val();290 }291 $this_textarea.closest('.wp-editor-wrap').html( this_editor_content );292 });293294 et_option_value = $(this).html();295 et_option_value += '<input type="hidden" class="et_tabs_data-elements" value="' + $(this).find('.et_lb_tab').length + '" />';296 }297 else if ( $(this).hasClass('et_lb_wp_editor') ){298 if ( typeof tinyMCE !== "undefined" ){299 et_option_value = $(this).is(':hidden') ? tinyMCE.get( this_option_id ).getContent() : switchEditors.wpautop( tinymce.DOM.get( this_option_id ).value );300 tinyMCE.execCommand("mceRemoveEditor", false, this_option_id);301 } else {302 et_option_value = $(this).val();303 }304 }305 else if ( $(this).is('select, input') ) {306 et_option_value = $(this).val();307 }308 else if ( $(this).is('#et_slides') ){309 $(this).find('input, textarea').each(function(){310 var this_value = $(this).val();311312 if ( $(this).is('input') ) $(this).attr('value', this_value);313 else $(this).html( this_value );314 });315 et_option_value = $(this).html();316 }317318 if ( $(this).hasClass('et_lb_module_content') ) et_option_class += ' et_lb_module_content';319320 $et_active_module_settings.append( '<div data-option_name="' + this_option_id + '" class="' + et_option_class + '">' + et_option_value + '</div>' );321 } );322323 $( '#et_layout .et_module' ).removeClass('et_active').css('opacity',1);324325 $(this).closest('#active_module_settings').slideUp().find('form#et_module_settings').remove();326 $('#et_module_separator').hide();327328 $('#et_layout').css( 'height', 'auto' );329330 et_reactivate_ui_actions();331332 $('#et_lb_main_save').trigger('click');333334 return false;335 } );336337 $( 'body' ).delegate( 'form#et_dialog_settings input#submit', 'click', function(){338 var $et_dialog_form = $('form#et_dialog_settings'),339 et_current_module_name = 'et_lb_' + $et_dialog_form.find('input#et_saved_module_name').val(),340 et_shortcode_text, et_shortcode_content = '',341 advanced_option = false,342 editor_id = $et_dialog_form.find('input#et_paste_to_editor_id').val(),343 $current_textarea,344 current_textarea_value;345346 et_shortcode_text = '[' + et_current_module_name;347348 $et_dialog_form.find('.et_lb_option').each( function(){349 var et_option_value,350 this_option_id = $(this).attr('id'),351 shortcode_option_id = this_option_id.replace('et_dialog_','');352353 if ( this_option_id == 'et_slides' ){354 advanced_option = true;355 et_shortcode_text += ']';356357 $(this).find('.et_attachment').each( function(){358 var $this_attachment = $(this),359 attachment_id = $this_attachment.attr('data-attachment'),360 attachment_link = $this_attachment.find('.attachment_link').val(),361 attachment_description = $this_attachment.find('.attachment_description').val();362363 et_shortcode_text += '[et_attachment attachment_id="' + attachment_id + '" link="' + attachment_link + '"]' + attachment_description + '[/et_attachment]';364 } );365 } else if ( this_option_id == 'et_lb_tabs' ){366 var $current_option = $(this);367368 advanced_option = true;369 et_shortcode_text += ']';370371 $current_option.find('.et_lb_tab').each( function(){372 var $this_tab = $(this),373 tab_title = $this_tab.find('.et_lb_tab_title').val(),374 tab_editor_id = $this_tab.find('textarea.et_lb_wp_editor').attr('id'),375 tab_content;376377 if ( typeof tinyMCE !== "undefined" ){378 tab_content = $this_tab.is(':hidden') ? tinyMCE.get( tab_editor_id ).getContent() : switchEditors.wpautop( tinymce.DOM.get( tab_editor_id ).value );379380 tinyMCE.execCommand("mceRemoveEditor", false, tab_editor_id);381 } else {382 tab_content = $('#' + tab_editor_id).val();383 }384385 if ( $current_option.parent('#et_slides_interface').length ) et_shortcode_text += '[et_lb_simple_slide]' + tab_content + '[/et_lb_simple_slide]';386 else et_shortcode_text += '[et_lb_tab title="' + tab_title + '"]' + tab_content + '[/et_lb_tab]';387 } );388 }389 else {390391 if ( $(this).hasClass('et_lb_wp_editor') ){392 if ( typeof tinyMCE !== "undefined" ){393 et_option_value = $(this).is(':hidden') ? tinyMCE.get( this_option_id ).getContent() : switchEditors.wpautop( tinymce.DOM.get( this_option_id ).value );394 tinyMCE.execCommand("mceRemoveEditor", false, this_option_id);395 } else {396 et_option_value = $('#' + this_option_id).val();397 }398 }399 else if ( $(this).is(':checkbox') ){400 et_option_value = ( $(this).is(':checked') ) ? 1 : 0;401 }402 else if ( $(this).is('select, input') ) {403 et_option_value = $(this).val();404 }405406 if ( $(this).hasClass('et_lb_module_content') ) {407 et_shortcode_content = et_option_value;408 } else {409 et_shortcode_text += ' ' + shortcode_option_id + '="' + et_option_value + '"';410 }411412 }413 } );414415 if ( ! advanced_option ) et_shortcode_text += ']' + et_shortcode_content + '[/' + et_current_module_name + ']';416 else et_shortcode_text += '[/' + et_current_module_name + ']';417418 if ( typeof tinyMCE !== "undefined" ){419 switchEditors.go(editor_id,'tmce');420 tinyMCE.get( editor_id ).execCommand("mceInsertContent", false, et_shortcode_text);421 } else {422 $current_textarea = $('#et_module_settings ' + '#' + editor_id);423 current_textarea_value = $current_textarea.val();424 $current_textarea.val( current_textarea_value + et_shortcode_text );425 }426427 et_close_modal_window();428429 return false;430 } );431432 $( 'body' ).delegate( 'a.et_delete_attachment', 'click', function(){433 $(this).closest('.et_attachment').remove();434 return false;435 } );436437 $et_builder_add_links.click( function(){438 var $et_clicked_link = $(this),439 $et_modules_container = $('#et_modules'),440 open_modules_window = false;441442 if ( $et_clicked_link.hasClass('et_active') ) return false;443444 $et_modules_container.find('.et_module').css( { 'opacity' : 0, 'display' : 'none' } );445446 if ( $et_clicked_link.hasClass('et_add_module') )447 $et_modules_container.find('.et_module:not(.et_m_column, .et_sample_layout)').css({'display':'inline-block', 'opacity' : 0}).animate( { 'opacity' : 1 }, 500 );448 else if ( $et_clicked_link.hasClass('et_add_sample_layout') )449 $et_modules_container.find('.et_module.et_sample_layout').css({'display':'inline-block', 'opacity' : 0}).animate( { 'opacity' : 1 }, 500 );450 else451 $et_modules_container.find('.et_module.et_m_column').css({'display':'inline-block', 'opacity' : 0}).animate( { 'opacity' : 1 }, 500 );452453 if ( $et_modules_container.is(':hidden') || open_modules_window ) {454 $et_modules_container.slideDown(700);455 }456457 $et_builder_add_links.removeClass('et_active');458 $et_clicked_link.addClass('et_active');459460 return false;461 } );462463 (function et_integrate_media_uploader(){464 var et_image_frame,465 $upload_field_input,466 et_image_changed = false,467 lb_upload_button_clicked = false;468469 function et_open_image_frame() {470 if ( et_image_frame ) {471 et_image_frame.open();472 return;473 }474475 et_image_frame = wp.media.frames.et_image_frame = wp.media({476 library: {477 type: 'image'478 },479 multiple: false480 });481482 et_image_frame.on( 'select', function() {483 et_attachment = et_image_frame.state().get('selection').first().toJSON();484485 et_attachment_image_selected( et_attachment );486 });487488 et_image_frame.open();489 }490491 function et_attachment_image_selected( et_attachment ) {492 var change_image = et_image_changed ? 1 : 0,493 et_ajax_data = {494 action : 'et_add_slider_item',495 et_load_nonce : et_lb_options.et_load_nonce,496 et_attachment_id : et_attachment.id,497 et_change_image : change_image498 };499500 if ( change_image === 0 )501 et_ajax_data.et_description = et_attachment.description;502503 $.ajax({504 type: "POST",505 url: et_lb_options.ajaxurl,506 dataType: change_image ? 'json' : 'html',507 data: et_ajax_data,508 success: function( data ){509 if ( change_image ) {510 var $active_attachment = $('.et_attachment.active').removeClass('active');511512 attachment_settings = data;513514 $active_attachment.attr( 'data-attachment', et_attachment.id ).find('img').remove();515 $active_attachment.prepend( attachment_settings['attachment_image'] );516 }517 else if ( lb_upload_button_clicked ){518 $upload_field_input.val( et_attachment.url );519 }520 else {521 $('#et_slides:visible').append( data );522 }523 }524 });525 }526527 $( '#et_lb_layout' ).delegate( 'a#et_add_slider_images', 'click', function() {528 et_image_changed = false;529 lb_upload_button_clicked = false;530 et_open_image_frame();531 } );532533 $( '#et_lb_layout' ).delegate( 'a.et_change_attachment_image', 'click', function(){534 et_image_changed = true;535 lb_upload_button_clicked = false;536 $(this).closest('.et_attachment').addClass('active');537 et_open_image_frame();538 });539540 $( '#et_lb_layout' ).delegate( 'a.et_lb_upload_button', 'click', function(){541 et_image_changed = false;542 lb_upload_button_clicked = true;543 $upload_field_input = $(this).siblings('.et_lb_upload_field');544 et_open_image_frame();545 });546 })();547548 $( 'body' ).delegate( 'a#et_lb_add_tab', 'click', function(){549 var element_name = 1 == $(this).parent('#et_slides_interface').length ? 'slides' : 'tabs',550 $et_tabs = $(this).closest('#et_'+element_name+'_interface').find('#et_lb_tabs'),551 next_element = parseInt( $et_tabs.attr('data-elements') ) + 1;552553 $et_tabs.attr('data-elements',next_element);554555 et_init_sortable_tabs();556 $.ajax({557 type: "POST",558 url: et_lb_options.ajaxurl,559 data:560 {561 action : 'et_add_'+element_name+'_item',562 et_load_nonce : et_lb_options.et_load_nonce,563 et_tabs_length : next_element564 },565 success: function( data ){566 var tab_editor_id = $(data).find('.et_lb_wp_editor').attr('id');567568 $('#et_lb_tabs:visible').append( data );569570 if ( typeof tinyMCE !== "undefined" ){571 tinyMCE.execCommand( "mceAddEditor", true, tab_editor_id );572 et_init_new_editor( tab_editor_id );573 }574575 et_track_active_editor();576 }577 });578579 return false;580 });581582 $( 'body' ).delegate( 'a.et_lb_delete_tab', 'click', function(){583 var $et_tab_active = $(this).closest('.et_lb_tab');584585 if ( typeof tinyMCE !== "undefined" ){586 tinyMCE.execCommand( "mceRemoveEditor", true, $et_tab_active.find('.et_lb_wp_editor').attr('id') );587 }588589 $et_tab_active.remove();590591 return false;592 });593594 $('#et_lb_main_save').click(function(){595 et_layout_save( true );596 return false;597 });598599 function et_layout_save( show_save_message ){600 var layout_html = $('#et_layout').html(),601 layout_shortcode = et_lb_generate_layout_shortcode( $('#et_layout') ),602 $save_message = jQuery("#et_lb_ajax_save");603604 $.ajax({605 type: "POST",606 url: et_lb_options.ajaxurl,607 data:608 {609 action : 'et_save_layout',610 et_load_nonce : et_lb_options.et_load_nonce,611 et_layout_html : layout_html,612 et_layout_shortcode : layout_shortcode,613 et_post_id : $('input#post_ID').val()614 },615 beforeSend: function ( xhr ){616 if ( show_save_message ){617 $save_message.children("img").css("display","block");618 $save_message.children("span").css("margin","6px 0px 0px 30px").html( et_lb_options.saving_text );619 $save_message.fadeIn('fast');620 }621 },622 success: function( data ){623 $save_message.children("img").css("display","none");624 $save_message.children("span").css("margin","0px").html( et_lb_options.saved_text );625626 setTimeout(function(){627 $save_message.fadeOut("slow");628 },500);629 }630 });631 }632633 //make sure the hidden WordPress Editor is in Visual mode634 //switchEditors.go('et_lb_hidden_editor','tmce');635636 (function et_init_ui(){637 $( '#et_layout' ).droppable({638 accept: ":not(.ui-sortable-helper)",639 greedy: true,640 drop: function( event, ui ) {641 if ( ui.draggable.hasClass('et_sample_layout') ){642 et_lb_append_sample_layout( ui.draggable );643 return;644 }645 ui.draggable.clone().appendTo( this );646 et_init_modules_js( 0 );647 }648 }).sortable({649 forcePlaceholderSize: true,650 placeholder: 'et_module_placeholder',651 cursor: 'move',652 distance: 2,653 start: function(event, ui) {654 ui.placeholder.text( ui.item.attr('data-placeholder') );655 ui.placeholder.css( 'width', ui.item.width() );656 },657 update: function(event, ui){658 et_init_modules_js( 0 );659 },660 stop: function(event, ui) {661 et_layout_save( false );662 }663 });664665 $( '#et_modules .et_module' ).draggable({666 revert: 'invalid',667 zIndex: 100,668 distance: 2,669 cursor: 'move',670 helper: 'clone'671 });672 })();673674 $( '#et_layout .et_module .ui-resizable-handle' ).remove();675 et_init_modules_js( 1 );676677 // resizable and sortable init678 function et_init_modules_js( et_first_time ){679 var $et_helper_text = $('#et_lb_helper');680681 // remove 'resizable' handler from 'full width' modules682 $( '#et_layout > .et_module.et_full_width .et_move' ).remove();683684 $( '#et_layout > .et_m_column' ).each( function(){685 $(this).removeClass('et_m_column_no_modules');686 if ( ! $(this).find('.et_module').length ) $(this).addClass('et_m_column_no_modules');687 } );688689 $( '#et_layout > .et_module:not(.et_full_width)' ).resizable({690 handles: 'e',691 containment: 'parent',692 start: function(event, ui) {693 ui.helper.css({position: ""}); // firefox fix694695 ui.helper.css({696 position: "relative !important",697 top: "0 !important",698 left: "0 !important"699 });700 },701 stop: function(event, ui) {702 ui.helper.css({703 position: "",704 top: "",705 left: ""706 });707 et_calculate_modules();708 },709 resize: function(event, ui) {710 var module_width = ui.helper.hasClass('et_m_column_resizable') ? ( ui.size.width+26 ) : (ui.size.width+2),711 new_width = Math.floor( ( module_width / et_builder_width ) * 100 ),712 $module_width = ui.helper.find('> span.et_module_name > span.et_module_width');713714 ui.helper.css({715 top: "",716 left: ""717 });718719 if ( new_width >= 100 ) new_width = '';720 else new_width = ' (' + new_width + '%)';721722 if ( $module_width.length ){723 $module_width.html( new_width );724 } else {725 ui.helper.find('> span.et_module_name').append('<span class="et_module_width">' + new_width + '</span>')726 }727728 if ( ui.helper.hasClass('et_m_column_resizable') ) ui.helper.css('height','auto');729 }730 });731732 $( '#et_layout .et_m_column' ).droppable({733 accept: ".et_module:not(.et_m_column,.et_full_width,.et_sample_layout)",734 hoverClass: 'et_column_active',735 greedy: true,736 drop: function( event, ui ) {737 // return if we're moving modules inside the column738 if ( ui.draggable.parents('.et_m_column').length && $(this).find('.ui-sortable-helper').length ) return;739740 ui.draggable.clone().appendTo( this ).css( { 'width' : '100%', 'marginRight' : '0' } ).find('span.et_module_width').remove();741742 if ( ui.draggable.parents('#et_layout').length ){743 ui.draggable.remove();744 }745746 et_init_modules_js( 0 );747 }748 }).sortable({749 forcePlaceholderSize: true,750 cancel: 'span.et_column_name',751 placeholder: 'et_module_placeholder',752 cursor: 'move',753 distance: 2,754 connectWith: '#et_layout',755 zIndex: 10,756 start: function(event, ui) {757 ui.placeholder.text( ui.item.attr('data-placeholder') );758 ui.placeholder.css( 'width', ui.item.width() );759 ui.item.closest('.et_m_column').css( 'z-index', '10' );760 },761 stop: function(event, ui) {762 $( '#et_layout .et_m_column' ).css( 'z-index', '1' );763764 et_layout_save( false );765 }766 });767768 if ( $( '#et_layout > .et_module' ).length ) $et_helper_text.hide();769 else $et_helper_text.show();770771 // columns and modules within columns can't be resized772 $( '#et_layout .et_m_column:not(.et_m_column_resizable)' ).resizable( "destroy" );773774 $( '#et_layout .et_m_column > span.et_move' ).remove();775776 $( '#et_layout .et_module' ).css( { 'position' : '', 'top' : '', 'left' : '', 'height' : 'auto !important', 'z-index' : '1' } ).removeClass('ui-sortable-helper').removeClass('et_column_active');777778 // don't calculate modules width first time, the function was executed already in the et_layout_window_resize function779 if ( et_first_time != 1 ) et_calculate_modules();780781 if ( typeof tinyMCE === "undefined" ) $('body').addClass( 'et_visual_editor_disabled' );782 }783784 function et_calculate_modules(){785 var et_row_width = 0;786787 $( '#et_layout > .et_module' ).each( function(){788 var $module_width_span = $(this).find('> span.et_module_name > span.et_module_width'),789 et_modifier = $(this).hasClass('et_m_column_resizable') ? 26 : 2;790791 if ( ! $(this).hasClass('et_m_column') || $(this).hasClass('et_m_column_resizable') ){792 if ( $module_width_span.length && $module_width_span.text() !== '' ) $(this).css( 'width', et_builder_width * parseInt( $module_width_span.text().substring(2) ) / 100 - et_modifier );793 else {794 if ( $(this).hasClass('et_m_column_resizable') ) $(this).css( 'width', et_main_module_width - et_modifier );795 else $(this).css( 'width', et_main_module_width );796 }797 }798 } );799800 $( '#et_layout > .et_module' ).removeClass('et_first').each( function(index){801 if ( index === 0 || et_row_width === 0 ) $(this).addClass('et_first');802803 et_row_width += $(this).outerWidth(true);804805 if ( et_row_width === et_builder_width ){806 $(this).next('.et_module').addClass('et_first');807 et_row_width = 0;808 } else if ( et_row_width > et_builder_width ){809 $(this).addClass('et_first');810 et_row_width = $(this).outerWidth(true);811 }812 } );813814 $( '#et_layout > .et_module.et_first' ).each( function(){815 var et_modifier = $(this).hasClass('et_m_column_resizable') ? 26 : 2,816 module_width = $(this).width(),817 $module_width_span = $(this).find('> span.et_module_name > span.et_module_width');818819 if ( $module_width_span.length && $module_width_span.text() !== '' ) {820 $module_width_span.text( ' (' + Math.round( ( ( module_width + et_modifier ) / et_builder_width ) * 100 ) + '%)' );821 }822 } );823 }824825 function et_lb_append_sample_layout( $layout_module ){826 $.ajax({827 type: "POST",828 url: et_lb_options.ajaxurl,829 data:830 {831 action : 'et_append_layout',832 et_load_nonce : et_lb_options.et_load_nonce,833 et_layout_name : $layout_module.attr('data-name')834 },835 success: function( data ){836 $( '#et_layout' ).append( data );837 $( '#et_layout .et_module .ui-resizable-handle' ).remove();838 et_init_modules_js( 0 );839 }840 });841 }842843 function et_deactivate_ui_actions(){844 $( '#et_layout' ).droppable( "disable" ).sortable( "disable" );845846 $( '#et_layout .et_m_column' ).droppable( "disable" ).sortable( "disable" );847848 $( '#et_layout > .et_module span.et_move, #et_layout > .et_module span.et_delete, #et_layout > .et_module span.et_settings_arrow' ).css( 'display', 'none' );849850 et_make_editor_droppable();851 }852853 function et_reactivate_ui_actions(){854 $( '#et_layout' ).droppable( "enable" ).sortable( "enable" );855856 $( '#et_layout .et_m_column' ).droppable( "enable" ).sortable( "enable" );857858 $( '#et_layout > .et_module span.et_move, #et_layout > .et_module span.et_delete, #et_layout > .et_module span.et_settings_arrow' ).css( 'display', 'block' );859 }860861 function et_make_editor_droppable(){862 $( '.wp-editor-container' ).droppable({863 accept: ".et_module",864 hoverClass: 'et_editor_hover',865 greedy: true,866 drop: function( event, ui ) {867 var et_paste_to_editor_id = $(this).find('.et_lb_wp_editor').attr('id'),868 et_action = 'et_show_module_options';869870 // don't allow inserting module into the same module871 if ( $('#et_layout .et_active').attr('data-placeholder') == ui.draggable.attr('data-placeholder') ) return;872 if ( ui.draggable.hasClass('et_sample_layout') ) return;873874 if ( ui.draggable.hasClass('et_m_column') ) et_action = 'et_show_column_options';875876 $.ajax({877 type: "POST",878 url: et_lb_options.ajaxurl,879 data:880 {881 action : et_action,882 et_load_nonce : et_lb_options.et_load_nonce,883 et_module_class : ui.draggable.attr('class'),884 et_modal_window : 1,885 et_paste_to_editor_id : et_paste_to_editor_id,886 et_module_exact_name : ui.draggable.attr('data-placeholder')887 },888 success: function( data ){889 $('body').append( '<div id="et_dialog_modal">' + '<div class="et_dialog_handle">Insert Shortcode</div>' + data + '</div> <div class="et_modal_blocker"></div>' );890891 $('#et_dialog_modal').draggable( { 'handle' : 'div.et_dialog_handle' } );892893 $( '#et_dialog_settings .et_lb_option' ).each( function(){894 var $this_option = $(this),895 this_option_id = $this_option.attr('id');896897 if ( $this_option.hasClass('et_lb_wp_editor') && typeof tinyMCE !== "undefined" ) {898 tinyMCE.execCommand( "mceAddEditor", true, this_option_id );899 et_init_new_editor( this_option_id );900 }901 } );902903 $('html:not(:animated),body:not(:animated)').animate({ scrollTop: 0 }, 500);904905 et_track_active_editor();906 }907 });908 }909 });910 }911912 function et_close_modal_window(){913 $( 'div#et_dialog_modal, div.et_modal_blocker' ).remove();914 $('html:not(:animated),body:not(:animated)').animate({ scrollTop: $('#et_page_builder').offset().top - 82 }, 500);915 }916917 function et_init_sortable_attachments(){918 $('#et_slides').sortable({919 forcePlaceholderSize: true,920 cursor: 'move',921 distance: 2,922 zIndex: 10923 });924 }925926 function et_init_sortable_tabs(){927 $('#et_lb_tabs, #et_lb_slides').sortable({928 forcePlaceholderSize: true, ...

Full Screen

Full Screen

custom.js

Source:custom.js Github

copy

Full Screen

1(function($){2 $.fn.et_simple_slider = function( options ) {3 var settings = $.extend( {4 slide : '.et-slide', // slide class5 arrows : '.et-slider-arrows', // arrows container class6 prev_arrow : '.et-arrow-prev', // left arrow class7 next_arrow : '.et-arrow-next', // right arrow class8 controls : '.et-controllers a', // control selector9 control_active_class : 'et-active-control', // active control class name10 previous_text : 'Previous', // previous arrow text11 next_text : 'Next', // next arrow text12 fade_speed : 500, // fade effect speed13 use_arrows : true, // use arrows?14 use_controls : true, // use controls?15 manual_arrows : '', // html code for custom arrows16 append_controls_to : '', // controls are appended to the slider element by default, here you can specify the element it should append to17 controls_class : 'et-controllers', // controls container class name18 slideshow : false, // automattic animation?19 slideshow_speed : 7000, // automattic animation speed20 on_slide_changing : function(){}, // callback function that runs when a slide changes21 on_slide_change_end : function(){} // callback function that runs when a slide changes22 }, options );2324 return this.each( function() {25 var $et_slider = $(this),26 $et_slide = $et_slider.find( settings.slide ),27 et_slides_number = $et_slide.length,28 et_fade_speed = settings.fade_speed,29 et_active_slide = 0,30 $et_slider_arrows,31 $et_slider_prev,32 $et_slider_next,33 $et_slider_controls,34 et_slider_timer,35 controls_html = '';3637 if ( settings.use_arrows && et_slides_number > 1 ) {38 if ( settings.manual_arrows == '' )39 $et_slider.append( '<div class="et-slider-arrows"><a class="et-arrow-prev" href="#">' + settings.previous_text + '</a><a class="et-arrow-next" href="#">' + settings.next_text + '</a></div>' );40 else41 $et_slider.append( settings.manual_arrows );4243 $et_slider_arrows = $( settings.arrows );44 $et_slider_prev = $et_slider_arrows.find( settings.prev_arrow );45 $et_slider_next = $et_slider_arrows.find( settings.next_arrow );4647 $et_slider_next.click( function(){48 et_slider_move_to( 'next' );4950 return false;51 } );5253 $et_slider_prev.click( function(){54 et_slider_move_to( 'previous' );5556 return false;57 } );58 }5960 if ( settings.use_controls && et_slides_number > 1 ) {61 for ( var i = 1; i <= et_slides_number; i++ ) {62 controls_html += '<a href="#"' + ( i == 1 ? ' class="' + settings.control_active_class + '"' : '' ) + '>' + i + '</a>';63 }6465 controls_html =66 '<div class="' + settings.controls_class + '">' +67 controls_html +68 '</div>';6970 if ( settings.append_controls_to == '' )71 $et_slider.append( controls_html );72 else73 $( settings.append_controls_to ).append( controls_html );7475 $et_slider_controls = $et_slider.find( settings.controls ),7677 $et_slider_controls.click( function(){78 et_slider_move_to( $(this).index() );7980 return false;81 } );82 }8384 et_slider_auto_rotate();8586 function et_slider_auto_rotate(){87 if ( settings.slideshow && et_slides_number > 1 ) {88 et_slider_timer = setTimeout( function() {89 et_slider_move_to( 'next' );90 }, settings.slideshow_speed );91 }92 }9394 function et_slider_move_to( direction ) {95 var $active_slide = $et_slide.eq( et_active_slide ),96 $next_slide;9798 if ( direction == 'next' || direction == 'previous' ){99100 if ( direction == 'next' )101 et_active_slide = ( et_active_slide + 1 ) < et_slides_number ? et_active_slide + 1 : 0;102 else103 et_active_slide = ( et_active_slide - 1 ) >= 0 ? et_active_slide - 1 : et_slides_number - 1;104105 } else {106107 if ( et_active_slide == direction ) return;108109 et_active_slide = direction;110111 }112113 $next_slide = $et_slide.eq( et_active_slide );114115 if ( settings.use_controls && et_slides_number > 1 )116 $et_slider_controls.removeClass( settings.control_active_class ).eq( et_active_slide ).addClass( settings.control_active_class );117118 if ( settings.on_slide_changing )119 settings.on_slide_changing( $next_slide );120121 $active_slide.animate( { opacity : 0 }, et_fade_speed, function(){122 $(this).css('display', 'none');123124 $next_slide.css( { 'display' : 'block', opacity : 0 } ).animate( { opacity : 1 }, et_fade_speed, function(){125 if ( settings.on_slide_change_end )126 settings.on_slide_change_end( $next_slide );127 } );128 } );129130 if ( typeof et_slider_timer != 'undefined' ) {131 clearInterval( et_slider_timer );132 et_slider_auto_rotate();133 }134 }135136 $.fn.et_simple_slider.external_move_to = function( slide ) {137 et_slider_move_to( slide );138 }139 } );140 }141142 var et_window_width;143144 $(document).ready( function(){145 var $et_top_menu = $( 'ul.nav' ),146 $featured_slider = $('#et-slider-wrapper'),147 $et_listings_item = $('#et-listings li'),148 $comment_form = $('form#commentform'),149 $et_filter_form = $('#et-filter-map'),150 $et_list_view = $('#et-list-view'),151 $et_filter_listing_type,152 $et_filter_listing_location,153 $et_filter_listing_rating,154 $et_mobile_listings_item,155 et_filter_options_html = '';156157 et_window_width = $(window).width();158159 $et_top_menu.superfish({160 delay : 500, // one second delay on mouseout161 animation : { opacity : 'show', height : 'show' }, // fade-in and slide-down animation162 speed : 'fast', // faster animation speed163 autoArrows : true, // disable generation of arrow mark-up164 dropShadows : false // disable drop shadows165 });166167 if ( $('ul.et_disable_top_tier').length ) $("ul.et_disable_top_tier > li > ul").prev('a').attr('href','#');168169 $('#left-area').fitVids();170171 $('.et-place-main-text').tinyscrollbar();172173 $et_listings_item.find('.et-mobile-link').click( function( event ) {174 event.stopPropagation();175 } );176177 $et_listings_item.click( function(){178 var $this_li = $(this);179180 if ( $this_li.hasClass( 'et-active-listing' ) ) return false;181182 $this_li.siblings( '.et-active-listing' ).removeClass( 'et-active-listing' );183184 $this_li.addClass( 'et-active-listing' );185186 google.maps.event.trigger( $("#et_main_map").gmap3({ get: { id: "et_marker_" + $this_li.index() } }), 'click' );187 } );188189 if ( $('#et-list-view.et-normal-listings').length ){190 $('#et-list-view.et-normal-listings').append( '<a href="#" class="et-date">' + et_custom.toggle_text + '</a>' );191192 $et_list_view = $('#et-list-view.et-normal-listings');193194 $et_list_view.find( '.et-date' ).click( function() {195196 if ( $et_list_view.hasClass( 'et-listview-open' ) )197 $et_list_view.removeClass( 'et-listview-open' );198 else199 $et_list_view.addClass( 'et-listview-open' );200201 return false;202 } );203 }204205 if ( $featured_slider.length ){206 $featured_slider.et_simple_slider( {207 slide : '.et-map-slide',208 use_controls : false,209 on_slide_changing : function( $next_slide ){210 google.maps.event.trigger($("#et_main_map").gmap3({ get: { id: "et_marker_" + $next_slide.index() } }), 'click');211212 $et_listings_item.filter( '.et-active-listing' ).removeClass( 'et-active-listing' );213 $et_listings_item.eq( $next_slide.index() ).addClass( 'et-active-listing' );214215 $et_mobile_listings_item.filter( '.et-active-listing' ).removeClass( 'et-active-listing' );216 $et_mobile_listings_item.eq( $next_slide.index() ).addClass( 'et-active-listing' );217 },218 on_slide_change_end : function( $next_slide ){219 if ( et_window_width >= 960 ) $('.et-place-main-text:visible').tinyscrollbar_update();220221 $next_slide.siblings().removeClass( 'et-active-map-slide' );222 $next_slide.addClass( 'et-active-map-slide' );223 }224 } );225226 $featured_slider.draggable();227 $featured_slider.draggable('option', 'cancel', '.track');228 $featured_slider.draggable('option', 'cancel', '.thumb');229 }230231 (function et_search_bar(){232 var $searchinput = $(".et-search-form .search_input"),233 searchvalue = $searchinput.val();234235 $searchinput.focus(function(){236 if (jQuery(this).val() === searchvalue) jQuery(this).val("");237 }).blur(function(){238 if (jQuery(this).val() === "") jQuery(this).val(searchvalue);239 });240 })();241242 $comment_form.find('input:text, textarea').each(function(index,domEle){243 var $et_current_input = jQuery(domEle),244 $et_comment_label = $et_current_input.siblings('label'),245 et_comment_label_value = $et_current_input.siblings('label').text();246 if ( $et_comment_label.length ) {247 $et_comment_label.hide();248 if ( $et_current_input.siblings('span.required') ) {249 et_comment_label_value += $et_current_input.siblings('span.required').text();250 $et_current_input.siblings('span.required').hide();251 }252 $et_current_input.val(et_comment_label_value);253 }254 }).bind('focus',function(){255 var et_label_text = jQuery(this).siblings('label').text();256 if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text();257 if (jQuery(this).val() === et_label_text) jQuery(this).val("");258 }).bind('blur',function(){259 var et_label_text = jQuery(this).siblings('label').text();260 if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text();261 if (jQuery(this).val() === "") jQuery(this).val( et_label_text );262 });263264 // remove placeholder text before form submission265 $comment_form.submit(function(){266 $comment_form.find('input:text, textarea').each(function(index,domEle){267 var $et_current_input = jQuery(domEle),268 $et_comment_label = $et_current_input.siblings('label'),269 et_comment_label_value = $et_current_input.siblings('label').text();270271 if ( $et_comment_label.length && $et_comment_label.is(':hidden') ) {272 if ( $et_comment_label.text() == $et_current_input.val() )273 $et_current_input.val( '' );274 }275 });276 });277278 et_duplicate_menu( $('ul.nav'), $('.mobile_nav'), 'mobile_menu', 'et_mobile_menu' );279280 $('body').append( $('#et-list-view').clone().removeClass('et-normal-listings').addClass('et-mobile-listings') );281 $et_mobile_listings_item = $('.et-mobile-listings li');282283 function et_duplicate_menu( menu, append_to, menu_id, menu_class ){284 var $cloned_nav;285286 menu.clone().attr('id',menu_id).removeClass().attr('class',menu_class).appendTo( append_to );287 $cloned_nav = append_to.find('> ul');288 $cloned_nav.find('.menu_slide').remove();289 $cloned_nav.find('li:first').addClass('et_first_mobile_item');290291 append_to.click( function(){292 if ( $(this).hasClass('closed') ){293 $(this).removeClass( 'closed' ).addClass( 'opened' );294 $cloned_nav.slideDown( 500 );295 } else {296 $(this).removeClass( 'opened' ).addClass( 'closed' );297 $cloned_nav.slideUp( 500 );298 }299 return false;300 } );301302 append_to.find('a').click( function(event){303 event.stopPropagation();304 } );305 }306307 if ( $et_filter_form.length ) {308 $et_filter_listing_type = $et_filter_form.find( '#et-listing-type' );309 $et_filter_listing_location = $et_filter_form.find( '#et-listing-location' );310 $et_filter_listing_rating = $et_filter_form.find( '#et-listing-rating' );311312 $et_filter_listing_type.find( 'option' ).each( function() {313 var $this_option = $( this );314315 et_filter_options_html += '<li data-value="' + $this_option.attr( 'value' ) + '">' + $this_option.text() + '</li>';316 } );317318 $( 'a.listing-type' ).append( '<ul>' + et_filter_options_html + '</ul>' );319320 et_filter_options_html = '';321322 $et_filter_listing_location.find( 'option' ).each( function() {323 var $this_option = $( this );324325 et_filter_options_html += '<li data-value="' + $this_option.attr( 'value' ) + '">' + $this_option.text() + '</li>';326 } );327328 $( 'a.listing-location' ).append( '<ul>' + et_filter_options_html + '</ul>' );329330 et_filter_options_html = '';331332 for ( var i = 5; i >= 1; i-- ) {333 et_filter_options_html += '<li data-value="' + i + '">' + '<span class="et-rating"><span style="width: ' + ( 17 * i ) + 'px;"></span></span>' + '</li>';334 }335336 $( 'a.listing-rating' ).append( '<ul>' + '<li data-value="none">' + $( 'a.listing-rating' ).text() + '</li>' + et_filter_options_html + '</ul>' );337338 if ( $et_filter_listing_type.find( ':selected' ).length ) {339 $( 'a.listing-type .et_explorable_filter_text' ).text( $et_filter_listing_type.find( ':selected' ).text() );340 }341342 if ( $et_filter_listing_location.find( ':selected' ).length ) {343 $( 'a.listing-location .et_explorable_filter_text' ).text( $et_filter_listing_location.find( ':selected' ).text() );344 }345346 if ( $et_filter_listing_rating.find( ':selected' ).length ) {347 $( 'a.listing-rating .et_explorable_filter_text' ).html( $( 'a.listing-rating li[data-value=' + $et_filter_listing_rating.find( ':selected' ).val() + ']' ).html() );348 }349350 $( 'a.filter-type' ).click( function() {351 var $this_element = $(this);352353 if ( $this_element.hasClass( 'filter-type-open' ) ) return false;354355 $this_element.addClass( 'filter-type-open' );356357 $this_element.siblings( '.filter-type-open' ).each( function() {358 var $this_link = $(this);359360 $this_link.removeClass( 'filter-type-open' ).find( 'ul' ).animate( { 'opacity' : 0 }, 500, function() {361 $(this).css( 'display', 'none' );362 } );363 } );364365 $this_element.find( 'ul' ).css( { 'display' : 'block', 'opacity' : '0' } ).animate( { 'opacity' : 1 }, 500 );366367 return false;368 } );369370 $( 'a.filter-type li' ).click( function() {371 var $this_element = $(this),372 $parent_link = $this_element.closest('a'),373 $active_filter_option,374 filter_order;375376 $parent_link.find( '.et_explorable_filter_text' ).html( $this_element.html() );377 filter_order = $parent_link.index('.filter-type');378 $active_filter_option = $et_filter_form.find( 'select' ).eq( filter_order );379380 $active_filter_option.find( ':selected' ).removeAttr( 'selected' );381 $active_filter_option.find( 'option[value=' + $this_element.attr( 'data-value' ) + ']' ).attr("selected", "selected");382383 $parent_link.removeClass( 'filter-type-open' ).find( 'ul' ).animate( { 'opacity' : 0 }, 500, function() {384 $(this).css( 'display', 'none' );385 } );386387 return false;388 } );389390 $( '.et_filter_arrow, .et_explorable_filter_text' ).click( function( event ) {391 var $this_element = $(this),392 $parent_link = $this_element.closest('a');393394 if ( $parent_link.hasClass( 'filter-type-open' ) ) {395 $parent_link.find( 'ul' ).animate( { 'opacity' : 0 }, 500, function() {396 $(this).css( 'display', 'none' );397 } );398399 $parent_link.removeClass( 'filter-type-open' );400401 return false;402 }403 } );404 }405 });406407 function et_listing_make_fluid() {408 var $et_main_map = $( '#et_main_map' ),409 new_listing_height;410411 if ( $et_main_map.length ) {412 if ( et_window_width < 960 )413 new_listing_height = $('.et-normal-listings #et-listings .overview ul').height();414 else415 new_listing_height = $('.et-normal-listings').height() - 81;416417 $('.et-normal-listings #et-listings, .et-normal-listings .viewport').height( new_listing_height );418419 $('.et-normal-listings #et-listings').tinyscrollbar_update();420 }421 }422423 $(window).load( function(){424 $('.et-normal-listings #et-listings').tinyscrollbar();425426 et_listing_make_fluid();427428 if ( $("#et_main_map").length )429 google.maps.event.trigger( $("#et_main_map").gmap3({ get: { id: "et_marker_0" } }), 'click' );430 } );431432 $(window).resize( function(){433 var $et_main_map = $( '#et_main_map' ),434 $et_single_map = $( '#et-single-map' );435436 et_window_width = $(window).width();437438 if ( $et_main_map.length ) {439 $et_main_map.gmap3("get").panTo( et_active_marker.position );440441 if ( $('.et-place-main-text:visible') ) $('.et-place-main-text:visible').tinyscrollbar_update();442443 et_listing_make_fluid();444 }445446 if ( $et_single_map.length ) {447 $et_single_map.gmap3("get").panTo(448 $et_single_map.gmap3({449 get: {450 id : 'et_single_marker'451 }452 }).position453 );454 }455 } ); ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var et = require('elementtree');3var fs = require('fs');4var request = require('request');5var async = require('async');6var cheerio = require('cheerio');7var entities = require("entities");8var _ = require('underscore');9var util = require('util');10var EventEmitter = require('events').EventEmitter;

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2const fs = require('fs');3const path = require('path');4const wiki = 'en';5const page = 'Barack_Obama';6const options = {7};8wptools.page(page, options).get().then(function(res) {9 console.log(res);10 fs.writeFileSync(path.join(__dirname, 'output.json'), JSON.stringify(res, null, 2));11});12{13 "extract": "Barack Hussein Obama II (born August 4, 1961) is an American politician who served as the 44th President of the United States from 2009 to 2017. A member of the Democratic Party, he was the first African American to be elected to the presidency. He previously served as a U.S. Senator from Illinois from 2005 to 2008 and an Illinois state senator from 1997 to 2004. Obama was born in Honolulu, Hawaii. After graduating from Columbia University in 1983, he worked as a community organizer in Chicago. In 1988, he enrolled in Harvard Law School, where he was the first black president of the Harvard Law Review. After graduating, he became a civil rights attorney and professor, and taught constitutional law at the University of Chicago Law School from 1992 to 2004. He represented the 13th District for three terms in the Illinois Senate from 1997 to 2004, running unsuccessfully for the United States House of Representatives in 2000. He ran for the U.S. Senate in 2004, winning the Democratic primary over incumbent Alan Keyes, and the general election over Republican Jack Ryan, and was sworn in on January 4, 2005. In 2008, Obama was nominated for president a year after his campaign began and after a close primary campaign against Hillary Clinton. He was elected over Republican John McCain and was inaugurated on January 20, 2009. Nine months later, Obama was named the 2009 Nobel Peace Prize laureate. Obama was re-elected president in November 2012, defeating Republican nominee Mitt Romney, and was sworn in for a second term on January 20, 2013. His second term ended on January

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt');2wpt.et('test');3module.exports = {4 et: function (test) {5 console.log(test);6 }7};8var wpt = require('./wpt');9wpt('test');10module.exports = function (test) {11 console.log(test);12};

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4var test = new wpt('www.webpagetest.org', options.key);5var data = {6};7test.runTest(url, data, function(err, result) {8 if (err) {9 console.log('error');10 } else {11 console.log(result);12 }13});14var wpt = require('webpagetest');15var options = {16};17var test = new wpt('www.webpagetest.org', options.key);18var data = {19};20test.runTest(url, data, function(err, result) {21 if (err) {22 console.log('error');23 } else {24 console.log(result);25 }26});27var wpt = require('webpagetest');28var options = {29};30var test = new wpt('www.webpagetest.org', options.key);31var data = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4var wpt = new WebPageTest('www.webpagetest.org', options.key);5 if (err) return console.error(err);6 console.log(data);7});8{ Error: connect ECONNREFUSED

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4var webPageTest = new wpt('www.webpagetest.org', options);5 console.log(data);6 console.log(data.data.median.firstView.SpeedIndex);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful