mirror of
https://github.com/KevinMidboe/rohnenedre.git
synced 2026-02-13 04:49:18 +00:00
Initial commit. State 04.2021.
This commit is contained in:
27
wp-content/themes/Divi/js/admin_post_settings.js
Normal file
27
wp-content/themes/Divi/js/admin_post_settings.js
Normal file
@@ -0,0 +1,27 @@
|
||||
(function($){
|
||||
$(document).ready(function() {
|
||||
var $post_format = $('input[name="post_format"]'),
|
||||
$settings = $('.et_divi_format_setting'),
|
||||
$use_bg_color_setting = $('#et_post_use_bg_color');
|
||||
|
||||
$('.color-picker-hex').wpColorPicker();
|
||||
|
||||
$post_format.change( function() {
|
||||
var $this = $(this);
|
||||
|
||||
$settings.hide();
|
||||
|
||||
$( '.et_divi_format_setting' + '.et_divi_' + $this.val() + '_settings' ).show();
|
||||
|
||||
$use_bg_color_setting.trigger( 'change' );
|
||||
} );
|
||||
|
||||
$use_bg_color_setting.change( function() {
|
||||
var $this = $(this);
|
||||
|
||||
$( '.et_post_bg_color_setting' ).toggle( $this.is(':checked') );
|
||||
} );
|
||||
|
||||
$post_format.filter(':checked').trigger( 'change' );
|
||||
});
|
||||
})(jQuery)
|
||||
98
wp-content/themes/Divi/js/advanced_options.js
Normal file
98
wp-content/themes/Divi/js/advanced_options.js
Normal file
@@ -0,0 +1,98 @@
|
||||
(function($){
|
||||
$(document).ready( function(){
|
||||
var $save_message = $("#epanel-ajax-saving"),
|
||||
$save_message_spinner = $save_message.children("img"),
|
||||
$save_message_description = $save_message.children("span");
|
||||
|
||||
$("#et_aweber_connection .et_make_connection").on( "click", function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action : "et_aweber_submit_authorization_code",
|
||||
et_load_nonce : et_advanced_options.et_load_nonce,
|
||||
et_authorization_code : $("#et_aweber_authorization #et_aweber_authentication_code").val()
|
||||
},
|
||||
beforeSend: function ( xhr ){
|
||||
$( '#et_aweber_connection .et_result_error' ).remove();
|
||||
|
||||
$save_message_spinner.css("display","block");
|
||||
$save_message_description.css("margin","6px 0px 0px").html( et_advanced_options.aweber_connecting );
|
||||
$save_message.fadeIn('fast');
|
||||
},
|
||||
success: function( response ){
|
||||
hide_ajax_popup( response );
|
||||
|
||||
if ( response === 'success' ) {
|
||||
$( '#et_aweber_authorization' ).hide();
|
||||
|
||||
$( '#et_aweber_remove_connection' ).show();
|
||||
} else {
|
||||
aweber_show_error_message( response );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#et_aweber_connection .et_remove_connection").on( "click", function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action : "et_aweber_remove_connection",
|
||||
et_load_nonce : et_advanced_options.et_load_nonce
|
||||
},
|
||||
beforeSend: function ( xhr ){
|
||||
$save_message.css( { 'width' : '228px' } );
|
||||
$save_message_spinner.css("display","block");
|
||||
$save_message_description.css("margin","6px 0px 0px").html( et_advanced_options.aweber_remove_connection );
|
||||
$save_message.fadeIn('fast');
|
||||
},
|
||||
success: function( response ){
|
||||
hide_ajax_popup( response );
|
||||
|
||||
if ( response === 'success' ) {
|
||||
$( '#et_aweber_remove_connection' ).hide();
|
||||
|
||||
$("#et_aweber_authorization #et_aweber_authentication_code").val( '' );
|
||||
|
||||
$( '#et_aweber_authorization' ).show();
|
||||
} else {
|
||||
aweber_show_error_message( response );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function aweber_show_error_message( response ) {
|
||||
var error_html = '<div class="et_result_error">';
|
||||
|
||||
error_html += '<p><strong>' + et_advanced_options.aweber_failed + '</strong>.</p>';
|
||||
error_html += '<p>' + response + '</p>';
|
||||
|
||||
error_html += '</div> <!-- .et_result_error -->';
|
||||
|
||||
$( '#et_aweber_authorization' ).after( error_html );
|
||||
}
|
||||
|
||||
function hide_ajax_popup( response ) {
|
||||
var error_message = response !== 'success' ? ' with errors' : '';
|
||||
|
||||
$save_message.addClass( 'et_aweber_connect_done' );
|
||||
$save_message_spinner.css("display","none");
|
||||
$save_message_description.css("margin","0px").html( et_advanced_options.aweber_done + error_message );
|
||||
|
||||
setTimeout( function() {
|
||||
$save_message.fadeOut( "slow", function() {
|
||||
$(this).removeClass( 'et_aweber_connect_done' );
|
||||
|
||||
$save_message.css( { 'width' : '142px' } );
|
||||
} );
|
||||
}, 500 );
|
||||
}
|
||||
});
|
||||
})(jQuery)
|
||||
898
wp-content/themes/Divi/js/custom.js
Normal file
898
wp-content/themes/Divi/js/custom.js
Normal file
@@ -0,0 +1,898 @@
|
||||
(function($){
|
||||
var $et_pb_post_fullwidth = $( '.single.et_pb_pagebuilder_layout.et_full_width_page' ),
|
||||
et_is_mobile_device = navigator.userAgent.match( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/ ),
|
||||
et_is_ipad = navigator.userAgent.match( /iPad/ ),
|
||||
$et_container = $( '.container' ),
|
||||
et_container_width = $et_container.width(),
|
||||
et_is_fixed_nav = $( 'body' ).hasClass( 'et_fixed_nav' ),
|
||||
et_is_vertical_fixed_nav = $( 'body' ).hasClass( 'et_vertical_fixed' ),
|
||||
et_is_rtl = $( 'body' ).hasClass( 'rtl' ),
|
||||
et_hide_nav = $( 'body' ).hasClass( 'et_hide_nav' ),
|
||||
et_header_style_left = $( 'body' ).hasClass( 'et_header_style_left' ),
|
||||
et_vertical_navigation = $( 'body' ).hasClass( 'et_vertical_nav' ),
|
||||
$top_header = $('#top-header'),
|
||||
$main_header = $('#main-header'),
|
||||
$main_container_wrapper = $( '#page-container' ),
|
||||
$et_transparent_nav = $( '.et_transparent_nav' ),
|
||||
$et_main_content_first_row = $( '#main-content .container:first-child' ),
|
||||
$et_main_content_first_row_meta_wrapper = $et_main_content_first_row.find('.et_post_meta_wrapper:first'),
|
||||
$et_main_content_first_row_meta_wrapper_title = $et_main_content_first_row_meta_wrapper.find( 'h1' ),
|
||||
$et_main_content_first_row_content = $et_main_content_first_row.find('.entry-content:first'),
|
||||
$et_single_post = $( 'body.single-post' ),
|
||||
$et_window = $(window),
|
||||
etRecalculateOffset = false,
|
||||
et_header_height,
|
||||
et_header_modifier,
|
||||
et_header_offset,
|
||||
et_primary_header_top,
|
||||
$et_vertical_nav = $('.et_vertical_nav'),
|
||||
$et_header_style_split = $('.et_header_style_split'),
|
||||
$et_top_navigation = $('#et-top-navigation'),
|
||||
$logo = $('#logo'),
|
||||
$et_pb_first_row = $( 'body.et_pb_pagebuilder_layout .et_pb_section:first-child' );
|
||||
|
||||
$(document).ready( function(){
|
||||
var $et_top_menu = $( 'ul.nav' ),
|
||||
$et_search_icon = $( '#et_search_icon' ),
|
||||
et_parent_menu_longpress_limit = 300,
|
||||
et_parent_menu_longpress_start,
|
||||
et_parent_menu_click = true;
|
||||
|
||||
$et_top_menu.find( 'li' ).hover( function() {
|
||||
if ( ! $(this).closest( 'li.mega-menu' ).length || $(this).hasClass( 'mega-menu' ) ) {
|
||||
$(this).addClass( 'et-show-dropdown' );
|
||||
$(this).removeClass( 'et-hover' ).addClass( 'et-hover' );
|
||||
}
|
||||
}, function() {
|
||||
var $this_el = $(this);
|
||||
|
||||
$this_el.removeClass( 'et-show-dropdown' );
|
||||
|
||||
setTimeout( function() {
|
||||
if ( ! $this_el.hasClass( 'et-show-dropdown' ) ) {
|
||||
$this_el.removeClass( 'et-hover' );
|
||||
}
|
||||
}, 200 );
|
||||
} );
|
||||
|
||||
// Dropdown menu adjustment for touch screen
|
||||
$et_top_menu.find('.menu-item-has-children > a').on( 'touchstart', function(){
|
||||
et_parent_menu_longpress_start = new Date().getTime();
|
||||
} ).on( 'touchend', function(){
|
||||
var et_parent_menu_longpress_end = new Date().getTime()
|
||||
if ( et_parent_menu_longpress_end >= et_parent_menu_longpress_start + et_parent_menu_longpress_limit ) {
|
||||
et_parent_menu_click = true;
|
||||
} else {
|
||||
et_parent_menu_click = false;
|
||||
|
||||
// Close sub-menu if toggled
|
||||
var $et_parent_menu = $(this).parent('li');
|
||||
if ( $et_parent_menu.hasClass( 'et-hover') ) {
|
||||
$et_parent_menu.trigger( 'mouseleave' );
|
||||
} else {
|
||||
$et_parent_menu.trigger( 'mouseenter' );
|
||||
}
|
||||
}
|
||||
et_parent_menu_longpress_start = 0;
|
||||
} ).click(function() {
|
||||
if ( et_parent_menu_click ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
$et_top_menu.find( 'li.mega-menu' ).each(function(){
|
||||
var $li_mega_menu = $(this),
|
||||
$li_mega_menu_item = $li_mega_menu.children( 'ul' ).children( 'li' ),
|
||||
li_mega_menu_item_count = $li_mega_menu_item.length;
|
||||
|
||||
if ( li_mega_menu_item_count < 4 ) {
|
||||
$li_mega_menu.addClass( 'mega-menu-parent mega-menu-parent-' + li_mega_menu_item_count );
|
||||
}
|
||||
});
|
||||
|
||||
if ( $et_header_style_split.length && $et_vertical_nav.length < 1 ) {
|
||||
function et_header_menu_split(){
|
||||
var $logo_container = $( '#main-header > .container > .logo_container' ),
|
||||
$logo_container_splitted = $('.centered-inline-logo-wrap > .logo_container'),
|
||||
et_top_navigation_li_size = $et_top_navigation.children('nav').children('ul').children('li').size(),
|
||||
et_top_navigation_li_break_index = Math.round( et_top_navigation_li_size / 2 ) - 1;
|
||||
|
||||
if ( $et_window.width() > 980 && $logo_container.length ) {
|
||||
$('<li class="centered-inline-logo-wrap"></li>').insertAfter($et_top_navigation.find('nav > ul >li:nth('+et_top_navigation_li_break_index+')') );
|
||||
$logo_container.appendTo( $et_top_navigation.find('.centered-inline-logo-wrap') );
|
||||
}
|
||||
|
||||
if ( $et_window.width() <= 980 && $logo_container_splitted.length ) {
|
||||
$logo_container_splitted.prependTo('#main-header > .container');
|
||||
$('#main-header .centered-inline-logo-wrap').remove();
|
||||
}
|
||||
}
|
||||
et_header_menu_split();
|
||||
|
||||
$(window).resize(function(){
|
||||
et_header_menu_split();
|
||||
});
|
||||
}
|
||||
|
||||
if ( $('ul.et_disable_top_tier').length ) {
|
||||
$("ul.et_disable_top_tier > li > ul").prev('a').attr('href','#');
|
||||
}
|
||||
|
||||
if ( $( '.et_vertical_nav' ).length ) {
|
||||
if ( $( '#main-header' ).height() < $( '#et-top-navigation' ).height() ) {
|
||||
$( '#main-header' ).height( $( '#et-top-navigation' ).height() + $( '#logo' ).height() + 100 );
|
||||
}
|
||||
}
|
||||
|
||||
window.et_calculate_header_values = function() {
|
||||
var $top_header = $( '#top-header' ),
|
||||
secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHeight() : 0,
|
||||
admin_bar_height = $( '#wpadminbar' ).length ? $( '#wpadminbar' ).innerHeight() : 0;
|
||||
|
||||
et_header_height = $( '#main-header' ).innerHeight() + secondary_nav_height,
|
||||
et_header_modifier = et_header_height <= 90 ? et_header_height - 29 : et_header_height - 56,
|
||||
et_header_offset = et_header_modifier + admin_bar_height;
|
||||
|
||||
et_primary_header_top = secondary_nav_height + admin_bar_height;
|
||||
}
|
||||
|
||||
var $comment_form = $('#commentform');
|
||||
|
||||
et_pb_form_placeholders_init( $comment_form );
|
||||
|
||||
$comment_form.submit(function(){
|
||||
et_pb_remove_placeholder_text( $comment_form );
|
||||
});
|
||||
|
||||
et_duplicate_menu( $('#et-top-navigation ul.nav'), $('#et-top-navigation .mobile_nav'), 'mobile_menu', 'et_mobile_menu' );
|
||||
|
||||
if ( $( '#et-secondary-nav' ).length ) {
|
||||
$('#et-top-navigation #mobile_menu').append( $( '#et-secondary-nav' ).clone().html() );
|
||||
}
|
||||
|
||||
function et_change_primary_nav_position( delay ) {
|
||||
setTimeout( function() {
|
||||
var $body = $('body'),
|
||||
$wpadminbar = $( '#wpadminbar' ),
|
||||
$top_header = $( '#top-header' ),
|
||||
et_primary_header_top = 0;
|
||||
|
||||
if ( $wpadminbar.length ) {
|
||||
et_primary_header_top += $wpadminbar.innerHeight();
|
||||
}
|
||||
|
||||
if ( $top_header.length ) {
|
||||
et_primary_header_top += $top_header.innerHeight();
|
||||
}
|
||||
|
||||
if ( ! $body.hasClass( 'et_vertical_nav' ) && ( $body.hasClass( 'et_fixed_nav' ) ) ) {
|
||||
$('#main-header').css( 'top', et_primary_header_top );
|
||||
}
|
||||
}, delay );
|
||||
}
|
||||
|
||||
function et_hide_nav_transofrm( ) {
|
||||
var $body = $( 'body' ),
|
||||
$body_height = $( document ).height(),
|
||||
$viewport_height = $( window ).height() + et_header_height + 200;
|
||||
|
||||
if ( $body.hasClass( 'et_hide_nav' ) || $body.hasClass( 'et_hide_nav_disabled' ) && ( $body.hasClass( 'et_fixed_nav' ) ) ) {
|
||||
if ( $body_height > $viewport_height ) {
|
||||
if ( $body.hasClass( 'et_hide_nav_disabled' ) ) {
|
||||
$body.addClass( 'et_hide_nav' );
|
||||
$body.removeClass( 'et_hide_nav_disabled' );
|
||||
}
|
||||
$('#main-header').css( 'transform', 'translateY(-' + et_header_height +'px)' );
|
||||
$('#top-header').css( 'transform', 'translateY(-' + et_header_height +'px)' );
|
||||
} else {
|
||||
$('#main-header').css( { 'transform': 'translateY(0)', 'opacity': '1' } );
|
||||
$('#top-header').css( { 'transform': 'translateY(0)', 'opacity': '1' } );
|
||||
$body.removeClass( 'et_hide_nav' );
|
||||
$body.addClass( 'et_hide_nav_disabled' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function et_fix_page_container_position(){
|
||||
var et_window_width = $et_window.width(),
|
||||
$top_header = $( '#top-header' ),
|
||||
secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHeight() : 0;
|
||||
|
||||
// Set data-height-onload for header if the page is loaded on large screen
|
||||
// If the page is loaded from small screen, rely on data-height-onload printed on the markup,
|
||||
// prevent window resizing issue from small to large
|
||||
if ( et_window_width > 980 && ! $main_header.attr( 'data-height-loaded' ) ){
|
||||
$main_header.attr({ 'data-height-onload' : $main_header.height(), 'data-height-loaded' : true });
|
||||
}
|
||||
|
||||
// Use on page load calculation for large screen. Use on the fly calculation for small screen (980px below)
|
||||
if ( et_window_width <= 980 ) {
|
||||
var header_height = $main_header.innerHeight() + secondary_nav_height - 1;
|
||||
|
||||
// If transparent is detected, #main-content .container's padding-top needs to be added to header_height
|
||||
// And NOT a pagebuilder page
|
||||
if ( $et_transparent_nav.length && ! $et_pb_first_row.length ) {
|
||||
header_height += 58;
|
||||
}
|
||||
} else {
|
||||
|
||||
// Get header height from header attribute
|
||||
var header_height = parseInt( $main_header.attr( 'data-height-onload' ) ) + secondary_nav_height;
|
||||
|
||||
// Non page builder page needs to be added by #main-content .container's fixed height
|
||||
if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_main_content_first_row.length ) {
|
||||
header_height += 58;
|
||||
}
|
||||
}
|
||||
|
||||
// Specific adjustment required for transparent nav + not vertical nav
|
||||
if ( $et_transparent_nav.length && ! $et_vertical_nav.length ){
|
||||
|
||||
// Add class for first row for custom section padding purpose
|
||||
$et_pb_first_row.addClass( 'et_pb_section_first' );
|
||||
|
||||
// List of conditionals
|
||||
var is_pb = $et_pb_first_row.length,
|
||||
is_post_pb = is_pb && $et_single_post.length,
|
||||
is_post_pb_full_layout_has_title = $et_pb_post_fullwidth.length && $et_main_content_first_row_meta_wrapper_title.length,
|
||||
is_post_pb_full_layout_no_title = $et_pb_post_fullwidth.length && 0 === $et_main_content_first_row_meta_wrapper_title.length,
|
||||
is_pb_fullwidth_section_first = $et_pb_first_row.is( '.et_pb_fullwidth_section' ),
|
||||
is_no_pb_mobile = et_window_width <= 980 && $et_main_content_first_row.length;
|
||||
|
||||
if ( is_post_pb && ! ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first ) ) {
|
||||
|
||||
/* Desktop / Mobile + Single Post */
|
||||
|
||||
/*
|
||||
* EXCEPT for fullwidth layout + fullwidth section ( at the first row ).
|
||||
* It is basically the same as page + fullwidth section with few quirk.
|
||||
* Instead of duplicating the conditional for each module, it'll be simpler to negate
|
||||
* fullwidth layout + fullwidth section in is_post_pb and rely it to is_pb_fullwidth_section_first
|
||||
*/
|
||||
|
||||
// Remove main content's inline padding to styling to prevent looping padding-top calculation
|
||||
$et_main_content_first_row.css({ 'paddingTop' : '' });
|
||||
|
||||
if ( et_window_width < 980 ) {
|
||||
header_height += 40;
|
||||
}
|
||||
|
||||
if ( is_pb_fullwidth_section_first ) {
|
||||
// If the first section is fullwidth, restore the padding-top modified area at first section
|
||||
$et_pb_first_row.css({
|
||||
'paddingTop' : '0',
|
||||
});
|
||||
}
|
||||
|
||||
if ( is_post_pb_full_layout_has_title ) {
|
||||
|
||||
// Add header height to post meta wrapper as padding top
|
||||
$et_main_content_first_row_meta_wrapper.css({
|
||||
'paddingTop' : header_height
|
||||
});
|
||||
|
||||
} else if ( is_post_pb_full_layout_no_title ) {
|
||||
|
||||
$et_pb_first_row.css({
|
||||
'paddingTop' : header_height
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
// Add header height to first row content as padding top
|
||||
$et_main_content_first_row.css({
|
||||
'paddingTop' : header_height
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
} else if ( is_pb_fullwidth_section_first ){
|
||||
|
||||
/* Desktop / Mobile + Pagebuilder + Fullwidth Section */
|
||||
|
||||
var $et_pb_first_row_first_module = $et_pb_first_row.children( '.et_pb_module:first' );
|
||||
|
||||
// Quirks: If this is post with fullwidth layout + no title + fullwidth section at first row,
|
||||
// Remove the added height at line 2656
|
||||
if ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first && et_window_width > 980 ) {
|
||||
header_height = header_height - 58;
|
||||
}
|
||||
|
||||
if ( $et_pb_first_row_first_module.is( '.et_pb_slider' ) ) {
|
||||
|
||||
/* Desktop / Mobile + Pagebuilder + Fullwidth slider */
|
||||
|
||||
var $et_pb_first_row_first_module_slide_image = $et_pb_first_row_first_module.find( '.et_pb_slide_image' ),
|
||||
$et_pb_first_row_first_module_slide = $et_pb_first_row_first_module.find( '.et_pb_slide' ),
|
||||
$et_pb_first_row_first_module_slide_container = $et_pb_first_row_first_module.find( '.et_pb_slide .et_pb_container' ),
|
||||
et_pb_slide_image_margin_top = 0 - ( parseInt( $et_pb_first_row_first_module_slide_image.height() ) / 2 ),
|
||||
et_pb_slide_container_height = 0,
|
||||
$et_pb_first_row_first_module_slider_arrow = $et_pb_first_row_first_module.find( '.et-pb-slider-arrows a'),
|
||||
et_pb_first_row_slider_arrow_height = $et_pb_first_row_first_module_slider_arrow.height();
|
||||
|
||||
// Adding padding top to each slide so the transparency become useful
|
||||
$et_pb_first_row_first_module_slide.css({
|
||||
'paddingTop' : header_height,
|
||||
});
|
||||
|
||||
// delete container's min-height
|
||||
$et_pb_first_row_first_module_slide_container.css({
|
||||
'min-height' : ''
|
||||
});
|
||||
|
||||
// Adjusting slider's image, considering additional top padding of slideshow
|
||||
$et_pb_first_row_first_module_slide_image.css({
|
||||
'marginTop' : et_pb_slide_image_margin_top
|
||||
});
|
||||
|
||||
// Adjusting slider's arrow, considering additional top padding of slideshow
|
||||
$et_pb_first_row_first_module_slider_arrow.css({
|
||||
'marginTop' : ( ( header_height / 2 ) - ( et_pb_first_row_slider_arrow_height / 2 ) )
|
||||
});
|
||||
|
||||
// Looping the slide and get the highest height of slide
|
||||
et_pb_first_row_slide_container_height_new = 0
|
||||
|
||||
$et_pb_first_row_first_module.find( '.et_pb_slide' ).each( function(){
|
||||
var $et_pb_first_row_first_module_slide_item = $(this),
|
||||
$et_pb_first_row_first_module_slide_container = $et_pb_first_row_first_module_slide_item.find( '.et_pb_container' );
|
||||
|
||||
// Make sure that the slide is visible to calculate correct height
|
||||
$et_pb_first_row_first_module_slide_item.show();
|
||||
|
||||
// Remove existing inline css to make sure that it calculates the height
|
||||
$et_pb_first_row_first_module_slide_container.css({ 'min-height' : '' });
|
||||
|
||||
var et_pb_first_row_slide_container_height = $et_pb_first_row_first_module_slide_container.innerHeight();
|
||||
|
||||
if ( et_pb_first_row_slide_container_height_new < et_pb_first_row_slide_container_height ){
|
||||
et_pb_first_row_slide_container_height_new = et_pb_first_row_slide_container_height;
|
||||
}
|
||||
|
||||
// Hide the slide back if it isn't active slide
|
||||
if ( $et_pb_first_row_first_module_slide_item.is( ':not(".et-pb-active-slide")' ) ){
|
||||
$et_pb_first_row_first_module_slide_item.hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Setting appropriate min-height, considering additional top padding of slideshow
|
||||
$et_pb_first_row_first_module_slide_container.css({
|
||||
'min-height' : et_pb_first_row_slide_container_height_new
|
||||
});
|
||||
|
||||
} else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_header' ) ) {
|
||||
|
||||
/* Desktop / Mobile + Pagebuilder + Fullwidth header */
|
||||
|
||||
// Remove existing inline stylesheet to prevent looping padding
|
||||
$et_pb_first_row_first_module.removeAttr( 'style' );
|
||||
|
||||
// Get paddingTop from stylesheet
|
||||
var et_pb_first_row_first_module_fullwidth_header_padding_top = parseInt( $et_pb_first_row_first_module.css( 'paddingTop' ) );
|
||||
|
||||
// Implement stylesheet's padding-top + header_height
|
||||
$et_pb_first_row_first_module.css({
|
||||
'paddingTop' : ( header_height + et_pb_first_row_first_module_fullwidth_header_padding_top )
|
||||
} );
|
||||
|
||||
} else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_portfolio' ) ) {
|
||||
|
||||
/* Desktop / Mobile + Pagebuilder + Fullwidth Portfolio */
|
||||
|
||||
$et_pb_first_row_first_module.css({ 'paddingTop' : header_height });
|
||||
|
||||
} else if ( $et_pb_first_row_first_module.is( '.et_pb_map_container' ) ) {
|
||||
|
||||
/* Desktop / Mobile + Pagebuilder + Fullwidth Map */
|
||||
|
||||
var $et_pb_first_row_map = $et_pb_first_row_first_module.find( '.et_pb_map' );
|
||||
|
||||
// Remove existing inline height to prevent looping height calculation
|
||||
$et_pb_first_row_map.css({ 'height' : '' });
|
||||
|
||||
// Implement map height + header height
|
||||
$et_pb_first_row_first_module.find('.et_pb_map').css({
|
||||
'height' : header_height + parseInt( $et_pb_first_row_map.css( 'height' ) )
|
||||
});
|
||||
|
||||
// Adding specific class to mark the map as first row section element
|
||||
$et_pb_first_row_first_module.addClass( 'et_beneath_transparent_nav' );
|
||||
|
||||
} else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_menu' ) ) {
|
||||
|
||||
/* Desktop / Mobile + Pagebuilder + Fullwidth Menu */
|
||||
$et_pb_first_row_first_module.css({ 'marginTop' : header_height });
|
||||
|
||||
} else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_code' ) ) {
|
||||
|
||||
/* Desktop / Mobile + Pagebuilder + Fullwidth code */
|
||||
|
||||
var $et_pb_first_row_first_module_code = $et_pb_first_row_first_module;
|
||||
|
||||
$et_pb_first_row_first_module_code.css({ 'paddingTop' : '' });
|
||||
|
||||
var et_pb_first_row_first_module_code_padding_top = parseInt( $et_pb_first_row_first_module_code.css( 'paddingTop' ) );
|
||||
|
||||
$et_pb_first_row_first_module_code.css({
|
||||
'paddingTop' : header_height + et_pb_first_row_first_module_code_padding_top
|
||||
});
|
||||
|
||||
} else if ( $et_pb_first_row_first_module.is( '.et_pb_post_title' ) ) {
|
||||
|
||||
/* Desktop / Mobile + Pagebuilder + Fullwidth Post Title */
|
||||
|
||||
var $et_pb_first_row_first_module_title = $et_pb_first_row_first_module;
|
||||
|
||||
$et_pb_first_row_first_module_title.css({
|
||||
'paddingTop' : header_height + 50
|
||||
});
|
||||
}
|
||||
|
||||
} else if ( is_pb ) {
|
||||
|
||||
/* Desktop / Mobile + Pagebuilder + Regular section */
|
||||
|
||||
// Remove first row's inline padding top styling to prevent looping padding-top calculation
|
||||
$et_pb_first_row.css({ 'paddingTop' : '' });
|
||||
|
||||
// Pagebuilder ignores #main-content .container's fixed height and uses its row's padding
|
||||
// Anticipate the use of custom section padding.
|
||||
et_pb_first_row_padding_top = header_height + parseInt( $et_pb_first_row.css( 'paddingBottom' ) );
|
||||
|
||||
// Implementing padding-top + header_height
|
||||
$et_pb_first_row.css({
|
||||
'paddingTop' : et_pb_first_row_padding_top
|
||||
});
|
||||
|
||||
} else if ( is_no_pb_mobile ) {
|
||||
|
||||
// Mobile + not pagebuilder
|
||||
$et_main_content_first_row.css({
|
||||
'paddingTop' : header_height
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
$('#main-content .container:first-child').css({
|
||||
'paddingTop' : header_height
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Set #page-container's padding-top to zero after inline styling first row's content has been added
|
||||
if ( ! $('#et_fix_page_container_position').length ){
|
||||
$( '<style />', {
|
||||
'id' : 'et_fix_page_container_position',
|
||||
'text' : '#page-container{ padding-top: 0 !important;}'
|
||||
}).appendTo('head');
|
||||
}
|
||||
|
||||
} else if( et_is_fixed_nav ) {
|
||||
|
||||
$main_container_wrapper.css( 'paddingTop', header_height );
|
||||
|
||||
}
|
||||
|
||||
et_change_primary_nav_position( 0 );
|
||||
}
|
||||
|
||||
$( window ).resize( function(){
|
||||
var window_width = $et_window.width(),
|
||||
et_container_css_width = $et_container.css( 'width' ),
|
||||
et_container_width_in_pixel = ( typeof et_container_css_width !== 'undefined' ) ? et_container_css_width.substr( -1, 1 ) !== '%' : '',
|
||||
et_container_actual_width = ( et_container_width_in_pixel ) ? $et_container.width() : ( ( $et_container.width() / 100 ) * window_width ), // $et_container.width() doesn't recognize pixel or percentage unit. It's our duty to understand what it returns and convert it properly
|
||||
containerWidthChanged = et_container_width !== et_container_actual_width;
|
||||
|
||||
if ( et_is_fixed_nav && containerWidthChanged ) {
|
||||
if ( typeof update_page_container_position != 'undefined' ){
|
||||
clearTimeout( update_page_container_position );
|
||||
}
|
||||
|
||||
var update_page_container_position = setTimeout( function() {
|
||||
et_fix_page_container_position();
|
||||
if ( typeof et_fix_fullscreen_section === 'function' ) {
|
||||
et_fix_fullscreen_section();
|
||||
}
|
||||
}, 200 );
|
||||
}
|
||||
|
||||
if ( et_hide_nav ) {
|
||||
et_hide_nav_transofrm();
|
||||
}
|
||||
|
||||
if ( $( '#wpadminbar' ).length && et_is_fixed_nav && window_width >= 740 && window_width <= 782 ) {
|
||||
et_calculate_header_values();
|
||||
|
||||
et_change_primary_nav_position( 0 );
|
||||
}
|
||||
|
||||
et_set_search_form_css();
|
||||
} );
|
||||
|
||||
$( window ).ready( function(){
|
||||
if ( $.fn.fitVids ) {
|
||||
$( '#main-content' ).fitVids( { customSelector: "iframe[src^='http://www.hulu.com'], iframe[src^='http://www.dailymotion.com'], iframe[src^='http://www.funnyordie.com'], iframe[src^='https://embed-ssl.ted.com'], iframe[src^='http://embed.revision3.com'], iframe[src^='https://flickr.com'], iframe[src^='http://blip.tv'], iframe[src^='http://www.collegehumor.com']"} );
|
||||
}
|
||||
} );
|
||||
|
||||
$( window ).load( function(){
|
||||
if ( et_is_fixed_nav ) {
|
||||
et_calculate_header_values();
|
||||
}
|
||||
|
||||
et_fix_page_container_position();
|
||||
|
||||
if ( et_header_style_left && !et_vertical_navigation) {
|
||||
$logo_width = $( '#logo' ).width();
|
||||
if ( et_is_rtl ) {
|
||||
$et_top_navigation.css( 'padding-right', $logo_width + 30 );
|
||||
} else {
|
||||
$et_top_navigation.css( 'padding-left', $logo_width + 30 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $('p.demo_store').length ) {
|
||||
$('#footer-bottom').css('margin-bottom' , $('p.demo_store').innerHeight());
|
||||
}
|
||||
|
||||
if ( $.fn.waypoint ) {
|
||||
if ( et_is_vertical_fixed_nav ) {
|
||||
var $waypoint_selector = $('#main-content');
|
||||
|
||||
$waypoint_selector.waypoint( {
|
||||
handler : function( direction ) {
|
||||
et_fix_logo_transition();
|
||||
|
||||
if ( direction === 'down' ) {
|
||||
$('#main-header').addClass( 'et-fixed-header' );
|
||||
} else {
|
||||
$('#main-header').removeClass( 'et-fixed-header' );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
if ( et_is_fixed_nav ) {
|
||||
|
||||
if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_pb_first_row.length ){
|
||||
|
||||
// Fullscreen section at the first row requires specific adjustment
|
||||
if ( $et_pb_first_row.is( '.et_pb_fullwidth_section' ) ){
|
||||
var $waypoint_selector = $et_pb_first_row.children('.et_pb_module');
|
||||
} else {
|
||||
var $waypoint_selector = $et_pb_first_row.find('.et_pb_row');
|
||||
}
|
||||
} else if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_main_content_first_row.length ) {
|
||||
var $waypoint_selector = $('#content-area');
|
||||
} else {
|
||||
var $waypoint_selector = $('#main-content');
|
||||
}
|
||||
|
||||
$waypoint_selector.waypoint( {
|
||||
offset: function() {
|
||||
if ( etRecalculateOffset ) {
|
||||
setTimeout( function() {
|
||||
et_calculate_header_values();
|
||||
}, 200 );
|
||||
|
||||
etRecalculateOffset = false;
|
||||
}
|
||||
if ( et_hide_nav ) {
|
||||
return et_header_offset - et_header_height - 200;
|
||||
} else {
|
||||
|
||||
// Transparent nav modification: #page-container's offset is set to 0. Modify et_header_offset's according to header height
|
||||
var waypoint_selector_offset = $waypoint_selector.offset();
|
||||
|
||||
if ( waypoint_selector_offset.top < et_header_offset ) {
|
||||
et_header_offset = 0 - ( et_header_offset - waypoint_selector_offset.top );
|
||||
}
|
||||
|
||||
return et_header_offset;
|
||||
}
|
||||
},
|
||||
handler : function( direction ) {
|
||||
et_fix_logo_transition();
|
||||
|
||||
if ( direction === 'down' ) {
|
||||
$main_header.addClass( 'et-fixed-header' );
|
||||
$main_container_wrapper.addClass ( 'et-animated-content' );
|
||||
$top_header.addClass( 'et-fixed-header' );
|
||||
|
||||
if ( ! et_hide_nav && ! $et_transparent_nav.length && ! $( '.mobile_menu_bar' ).is(':visible') ) {
|
||||
var secondary_nav_height = $top_header.height(),
|
||||
et_is_vertical_nav = $( 'body' ).hasClass( 'et_vertical_nav' ),
|
||||
$clone_header,
|
||||
clone_header_height,
|
||||
fix_padding;
|
||||
|
||||
$clone_header = $main_header.clone().addClass( 'et-fixed-header, et_header_clone' ).css( { 'transition': 'none', 'display' : 'none' } );
|
||||
|
||||
clone_header_height = $clone_header.prependTo( 'body' ).height();
|
||||
|
||||
// Vertical nav doesn't need #page-container margin-top adjustment
|
||||
if ( ! et_is_vertical_nav ) {
|
||||
fix_padding = parseInt( $main_container_wrapper.css( 'padding-top' ) ) - clone_header_height - secondary_nav_height + 1 ;
|
||||
|
||||
$main_container_wrapper.css( 'margin-top', -fix_padding );
|
||||
}
|
||||
|
||||
$( '.et_header_clone' ).remove();
|
||||
}
|
||||
|
||||
} else {
|
||||
$main_header.removeClass( 'et-fixed-header' );
|
||||
$top_header.removeClass( 'et-fixed-header' );
|
||||
$main_container_wrapper.css( 'margin-top', '-1px' );
|
||||
}
|
||||
setTimeout( function() {
|
||||
et_set_search_form_css();
|
||||
}, 400 );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
if ( et_hide_nav ) {
|
||||
et_hide_nav_transofrm();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
$( 'a[href*=#]:not([href=#])' ).click( function() {
|
||||
if ( ( location.pathname.replace( /^\//,'' ) == this.pathname.replace( /^\//,'' ) && location.hostname == this.hostname ) && ! ( $( this ).closest( '.woocommerce-tabs' ).length && $( this ).closest( '.tabs' ).length ) ) {
|
||||
var target = $( this.hash );
|
||||
target = target.length ? target : $( '[name=' + this.hash.slice(1) +']' );
|
||||
if ( target.length ) {
|
||||
|
||||
et_pb_smooth_scroll( target, false, 800 );
|
||||
|
||||
if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) {
|
||||
setTimeout(function(){
|
||||
et_pb_smooth_scroll( target, false, 40, 'linear' );
|
||||
}, 780 );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if ( $( '.et_pb_section' ).length > 1 && $( '.et_pb_side_nav_page' ).length ) {
|
||||
var $i=0;
|
||||
|
||||
$( '#main-content' ).append( '<ul class="et_pb_side_nav"></ul>' );
|
||||
|
||||
$( '.et_pb_section' ).each( function(){
|
||||
if ( $( this ).height() > 0 ) {
|
||||
$active_class = $i == 0 ? 'active' : '';
|
||||
$( '.et_pb_side_nav' ).append( '<li class="side_nav_item"><a href="#" id="side_nav_item_id_' + $i + '" class= "' + $active_class + '">' + $i + '</a></li>' );
|
||||
$( this ).addClass( 'et_pb_scroll_' + $i );
|
||||
$i++;
|
||||
}
|
||||
});
|
||||
|
||||
$side_nav_offset = ( $i * 20 + 40 ) / 2;
|
||||
$( 'ul.et_pb_side_nav' ).css( 'marginTop', '-' + parseInt( $side_nav_offset) + 'px' );
|
||||
$( '.et_pb_side_nav' ).addClass( 'et-visible' );
|
||||
|
||||
|
||||
$( '.et_pb_side_nav a' ).click( function(){
|
||||
$top_section = ( $( this ).text() == "0" ) ? true : false;
|
||||
$target = $( '.et_pb_scroll_' + $( this ).text() );
|
||||
|
||||
et_pb_smooth_scroll( $target, $top_section, 800);
|
||||
|
||||
if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) {
|
||||
setTimeout(function(){
|
||||
et_pb_smooth_scroll( $target, $top_section, 200);
|
||||
},500);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$( window ).scroll( function(){
|
||||
|
||||
$add_offset = ( $( 'body' ).hasClass( 'et_fixed_nav' ) ) ? 20 : -90;
|
||||
|
||||
if ( $ ( '#wpadminbar' ).length && $( window ).width() > 600 ) {
|
||||
$add_offset += $( '#wpadminbar' ).outerHeight();
|
||||
}
|
||||
|
||||
$side_offset = ( $( 'body' ).hasClass( 'et_vertical_nav' ) ) ? $( '#top-header' ).height() + $add_offset + 60 : $( '#top-header' ).height() + $( '#main-header' ).height() + $add_offset;
|
||||
|
||||
for ( var $i = 0; $i <= $( '.side_nav_item a' ).length - 1; $i++ ) {
|
||||
if ( $( window ).scrollTop() + $( window ).height() == $( document ).height() ) {
|
||||
$last = $( '.side_nav_item a' ).length - 1;
|
||||
$( '.side_nav_item a' ).removeClass( 'active' );
|
||||
$( 'a#side_nav_item_id_' + $last ).addClass( 'active' );
|
||||
} else {
|
||||
if ( $( this ).scrollTop() >= $( '.et_pb_scroll_' + $i ).offset().top - $side_offset ) {
|
||||
$( '.side_nav_item a' ).removeClass( 'active' );
|
||||
$( 'a#side_nav_item_id_' + $i ).addClass( 'active' );
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ( $('.et_pb_scroll_top').length ) {
|
||||
$(window).scroll(function(){
|
||||
if ($(this).scrollTop() > 800) {
|
||||
$('.et_pb_scroll_top').show().removeClass( 'et-hidden' ).addClass( 'et-visible' );
|
||||
} else {
|
||||
$('.et_pb_scroll_top').removeClass( 'et-visible' ).addClass( 'et-hidden' );
|
||||
}
|
||||
});
|
||||
|
||||
//Click event to scroll to top
|
||||
$('.et_pb_scroll_top').click(function(){
|
||||
$('html, body').animate({scrollTop : 0},800);
|
||||
});
|
||||
}
|
||||
|
||||
if ( $( '.comment-reply-link' ).length ) {
|
||||
$( '.comment-reply-link' ).addClass( 'et_pb_button' );
|
||||
}
|
||||
|
||||
$( '#et_top_search' ).click( function() {
|
||||
var $search_container = $( '.et_search_form_container' );
|
||||
|
||||
$( '.et_menu_container' ).removeClass( 'et_pb_menu_visible' ).removeClass( 'et_pb_no_animation' ).addClass('et_pb_menu_hidden');
|
||||
$search_container.removeClass( 'et_pb_search_form_hidden' ).removeClass( 'et_pb_no_animation' ).addClass('et_pb_search_visible');
|
||||
setTimeout( function() {
|
||||
$( '.et_menu_container' ).addClass( 'et_pb_no_animation' );
|
||||
$search_container.addClass( 'et_pb_no_animation' );
|
||||
}, 1000);
|
||||
$search_container.find( 'input' ).focus();
|
||||
|
||||
et_set_search_form_css();
|
||||
});
|
||||
|
||||
function et_hide_search() {
|
||||
$( '.et_menu_container' ).removeClass('et_pb_menu_hidden').removeClass( 'et_pb_no_animation' ).addClass( 'et_pb_menu_visible' );
|
||||
$( '.et_search_form_container' ).removeClass('et_pb_search_visible').removeClass( 'et_pb_no_animation' ).addClass( 'et_pb_search_form_hidden' );
|
||||
setTimeout( function() {
|
||||
$( '.et_menu_container' ).addClass( 'et_pb_no_animation' );
|
||||
$( '.et_search_form_container' ).addClass( 'et_pb_no_animation' );
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function et_set_search_form_css() {
|
||||
var $search_container = $( '.et_search_form_container' );
|
||||
var $body = $( 'body' );
|
||||
if ( $search_container.hasClass( 'et_pb_search_visible' ) ) {
|
||||
var header_height = $( '#main-header' ).innerHeight(),
|
||||
menu_width = $( '#top-menu' ).width(),
|
||||
font_size = $( '#top-menu li a' ).css( 'font-size' );
|
||||
$search_container.css( { 'height' : header_height + 'px' } );
|
||||
$search_container.find( 'input' ).css( 'font-size', font_size );
|
||||
if ( ! $body.hasClass( 'et_header_style_left' ) ) {
|
||||
$search_container.css( 'max-width', menu_width + 60 );
|
||||
} else {
|
||||
$search_container.find( 'form' ).css( 'max-width', menu_width + 60 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$( '.et_close_search_field' ).click( function() {
|
||||
et_hide_search();
|
||||
});
|
||||
|
||||
$( document ).mouseup( function(e) {
|
||||
var $header = $( '#main-header' );
|
||||
if ( $( '.et_menu_container' ).hasClass('et_pb_menu_hidden') ) {
|
||||
if ( ! $header.is( e.target ) && $header.has( e.target ).length === 0 ) {
|
||||
et_hide_search();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Detect actual logo dimension, used for tricky fixed navigation transition
|
||||
function et_define_logo_dimension() {
|
||||
var $logo = $('#logo'),
|
||||
logo_src = $logo.attr( 'src' ),
|
||||
is_svg = logo_src.substr( -3, 3 ) === 'svg' ? true : false,
|
||||
$logo_wrap,
|
||||
logo_width,
|
||||
logo_height;
|
||||
|
||||
// Append invisible wrapper at the bottom of the page
|
||||
$('body').append( $('<div />', {
|
||||
'id' : 'et-define-logo-wrap',
|
||||
'style' : 'position: fixed; bottom: 0; opacity: 0;'
|
||||
}));
|
||||
|
||||
// Define logo wrap
|
||||
$logo_wrap = $('#et-define-logo-wrap');
|
||||
|
||||
if( is_svg ) {
|
||||
$logo_wrap.addClass( 'svg-logo' );
|
||||
}
|
||||
|
||||
// Clone logo to invisible wrapper
|
||||
$logo_wrap.html( $logo.clone().css({ 'display' : 'block' }).removeAttr( 'id' ) );
|
||||
|
||||
// Get dimension
|
||||
logo_width = $logo_wrap.find('img').width();
|
||||
logo_height = $logo_wrap.find('img').height();
|
||||
|
||||
// Add data attribute to $logo
|
||||
$logo.attr({
|
||||
'data-actual-width' : logo_width,
|
||||
'data-actual-height' : logo_height
|
||||
});
|
||||
|
||||
// Destroy invisible wrapper
|
||||
$logo_wrap.remove();
|
||||
|
||||
// Init logo transition onload
|
||||
et_fix_logo_transition( true );
|
||||
}
|
||||
|
||||
if ( $('#logo').length ) {
|
||||
et_define_logo_dimension();
|
||||
}
|
||||
|
||||
// Set width for adsense in footer widget
|
||||
$('.footer-widget').each(function(){
|
||||
var $footer_widget = $(this),
|
||||
footer_widget_width = $footer_widget.width(),
|
||||
$adsense_ins = $footer_widget.find( '.widget_adsensewidget ins' );
|
||||
|
||||
if ( $adsense_ins.length ) {
|
||||
$adsense_ins.width( footer_widget_width );
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
// Fixing logo size transition in tricky header style
|
||||
function et_fix_logo_transition( is_onload ) {
|
||||
var $body = $( 'body' ),
|
||||
$logo = $( '#logo' ),
|
||||
logo_actual_width = parseInt( $logo.attr( 'data-actual-width' ) ),
|
||||
logo_actual_height = parseInt( $logo.attr( 'data-actual-height' ) ),
|
||||
logo_height_percentage = parseInt( $logo.attr( 'data-height-percentage' ) ),
|
||||
$top_nav = $( '#et-top-navigation' ),
|
||||
top_nav_height = parseInt( $top_nav.attr( 'data-height' ) ),
|
||||
top_nav_fixed_height = parseInt( $top_nav.attr( 'data-fixed-height' ) ),
|
||||
$main_header = $('#main-header'),
|
||||
is_header_split = $body.hasClass( 'et_header_style_split' ),
|
||||
is_fixed_nav = $main_header.hasClass( 'et-fixed-header' ),
|
||||
is_vertical_nav = $body.hasClass( 'et_vertical_nav' ),
|
||||
is_hide_primary_logo = $body.hasClass( 'et_hide_primary_logo' ),
|
||||
is_hide_fixed_logo = $body.hasClass( 'et_hide_fixed_logo' ),
|
||||
is_onload = typeof is_onload === 'undefined' ? false : is_onload,
|
||||
logo_height_base = is_fixed_nav ? top_nav_height : top_nav_fixed_height,
|
||||
logo_wrapper_width,
|
||||
logo_wrapper_height;
|
||||
|
||||
// Fix for inline centered logo in horizontal nav
|
||||
if ( is_header_split && ! is_vertical_nav ) {
|
||||
// On page load, logo_height_base should be top_nav_height
|
||||
if ( is_onload ) {
|
||||
logo_height_base = top_nav_height;
|
||||
}
|
||||
|
||||
// Calculate logo wrapper height
|
||||
logo_wrapper_height = ( logo_height_base * ( logo_height_percentage / 100 ) + 22 );
|
||||
|
||||
// Calculate logo wrapper width
|
||||
logo_wrapper_width = logo_actual_width * ( logo_wrapper_height / logo_actual_height );
|
||||
|
||||
// Override logo wrapper width to 0 if it is hidden
|
||||
if ( is_hide_primary_logo && ( is_fixed_nav || is_onload ) ) {
|
||||
logo_wrapper_width = 0;
|
||||
}
|
||||
|
||||
if ( is_hide_fixed_logo && ! is_fixed_nav && ! is_onload ) {
|
||||
logo_wrapper_width = 0;
|
||||
}
|
||||
|
||||
// Set fixed width for logo wrapper to force correct dimension
|
||||
$( '.et_header_style_split .centered-inline-logo-wrap' ).css( { 'width' : logo_wrapper_width } );
|
||||
}
|
||||
}
|
||||
})(jQuery)
|
||||
4
wp-content/themes/Divi/js/html5.js
Normal file
4
wp-content/themes/Divi/js/html5.js
Normal file
@@ -0,0 +1,4 @@
|
||||
// iepp v2.1pre @jon_neal & @aFarkas github.com/aFarkas/iepp
|
||||
// html5shiv @rem remysharp.com/html5-enabling-script
|
||||
// Dual licensed under the MIT or GPL Version 2 licenses
|
||||
/*@cc_on(function(a,b){function r(a){var b=-1;while(++b<f)a.createElement(e[b])}if(!window.attachEvent||!b.createStyleSheet||!function(){var a=document.createElement("div");return a.innerHTML="<elem></elem>",a.childNodes.length!==1}())return;a.iepp=a.iepp||{};var c=a.iepp,d=c.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|subline|summary|time|video",e=d.split("|"),f=e.length,g=new RegExp("(^|\\s)("+d+")","gi"),h=new RegExp("<(/*)("+d+")","gi"),i=/^\s*[\{\}]\s*$/,j=new RegExp("(^|[^\\n]*?\\s)("+d+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),k=b.createDocumentFragment(),l=b.documentElement,m=b.getElementsByTagName("script")[0].parentNode,n=b.createElement("body"),o=b.createElement("style"),p=/print|all/,q;c.getCSS=function(a,b){try{if(a+""===undefined)return""}catch(d){return""}var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,p.test(b)&&h.push(c.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},c.parseCSS=function(a){var b=[],c;while((c=j.exec(a))!=null)b.push(((i.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(g,"$1.iepp-$2")+c[4]);return b.join("\n")},c.writeHTML=function(){var a=-1;q=q||b.body;while(++a<f){var c=b.getElementsByTagName(e[a]),d=c.length,g=-1;while(++g<d)c[g].className.indexOf("iepp-")<0&&(c[g].className+=" iepp-"+e[a])}k.appendChild(q),l.appendChild(n),n.className=q.className,n.id=q.id,n.innerHTML=q.innerHTML.replace(h,"<$1font")},c._beforePrint=function(){if(c.disablePP)return;o.styleSheet.cssText=c.parseCSS(c.getCSS(b.styleSheets,"all")),c.writeHTML()},c.restoreHTML=function(){if(c.disablePP)return;n.swapNode(q)},c._afterPrint=function(){c.restoreHTML(),o.styleSheet.cssText=""},r(b),r(k);if(c.disablePP)return;m.insertBefore(o,m.firstChild),o.media="print",o.className="iepp-printshim",a.attachEvent("onbeforeprint",c._beforePrint),a.attachEvent("onafterprint",c._afterPrint)})(this,document)@*/
|
||||
13
wp-content/themes/Divi/js/menu_fix.js
Normal file
13
wp-content/themes/Divi/js/menu_fix.js
Normal file
@@ -0,0 +1,13 @@
|
||||
(function($){
|
||||
$( document ).ready( function() {
|
||||
var $menu_item = $( '#toplevel_page_et_divi_options' );
|
||||
|
||||
if ( $menu_item.length ) {
|
||||
var $first_menu_item = $menu_item.find( '.wp-first-item' );
|
||||
|
||||
if ( 'Divi' === $first_menu_item.find( 'a' ).text() ) {
|
||||
$first_menu_item.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery)
|
||||
535
wp-content/themes/Divi/js/smoothscroll.js
Normal file
535
wp-content/themes/Divi/js/smoothscroll.js
Normal file
@@ -0,0 +1,535 @@
|
||||
// SmoothScroll for websites v1.2.1
|
||||
// Licensed under the terms of the MIT license.
|
||||
|
||||
// People involved
|
||||
// - Balazs Galambosi (maintainer)
|
||||
// - Michael Herf (Pulse Algorithm)
|
||||
|
||||
(function(){
|
||||
|
||||
// Scroll Variables (tweakable)
|
||||
var defaultOptions = {
|
||||
|
||||
// Scrolling Core
|
||||
frameRate : 150, // [Hz]
|
||||
animationTime : 400, // [px]
|
||||
stepSize : 80, // [px]
|
||||
|
||||
// Pulse (less tweakable)
|
||||
// ratio of "tail" to "acceleration"
|
||||
pulseAlgorithm : true,
|
||||
pulseScale : 8,
|
||||
pulseNormalize : 1,
|
||||
|
||||
// Acceleration
|
||||
accelerationDelta : 20, // 20
|
||||
accelerationMax : 1, // 1
|
||||
|
||||
// Keyboard Settings
|
||||
keyboardSupport : true, // option
|
||||
arrowScroll : 50, // [px]
|
||||
|
||||
// Other
|
||||
touchpadSupport : true,
|
||||
fixedBackground : true,
|
||||
excluded : ""
|
||||
};
|
||||
|
||||
var options = defaultOptions;
|
||||
|
||||
|
||||
// Other Variables
|
||||
var isExcluded = false;
|
||||
var isFrame = false;
|
||||
var direction = { x: 0, y: 0 };
|
||||
var initDone = false;
|
||||
var root = document.documentElement;
|
||||
var activeElement;
|
||||
var observer;
|
||||
var deltaBuffer = [ 120, 120, 120 ];
|
||||
|
||||
var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32,
|
||||
pageup: 33, pagedown: 34, end: 35, home: 36 };
|
||||
|
||||
|
||||
/***********************************************
|
||||
* SETTINGS
|
||||
***********************************************/
|
||||
|
||||
var options = defaultOptions;
|
||||
|
||||
|
||||
/***********************************************
|
||||
* INITIALIZE
|
||||
***********************************************/
|
||||
|
||||
/**
|
||||
* Tests if smooth scrolling is allowed. Shuts down everything if not.
|
||||
*/
|
||||
function initTest() {
|
||||
|
||||
var disableKeyboard = false;
|
||||
|
||||
// disable keyboard support if anything above requested it
|
||||
if (disableKeyboard) {
|
||||
removeEvent("keydown", keydown);
|
||||
}
|
||||
|
||||
if (options.keyboardSupport && !disableKeyboard) {
|
||||
addEvent("keydown", keydown);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up scrolls array, determines if frames are involved.
|
||||
*/
|
||||
function init() {
|
||||
|
||||
if (!document.body) return;
|
||||
|
||||
var body = document.body;
|
||||
var html = document.documentElement;
|
||||
var windowHeight = window.innerHeight;
|
||||
var scrollHeight = body.scrollHeight;
|
||||
|
||||
// check compat mode for root element
|
||||
root = (document.compatMode.indexOf('CSS') >= 0) ? html : body;
|
||||
activeElement = body;
|
||||
|
||||
initTest();
|
||||
initDone = true;
|
||||
|
||||
// Checks if this script is running in a frame
|
||||
if (top != self) {
|
||||
isFrame = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This fixes a bug where the areas left and right to
|
||||
* the content does not trigger the onmousewheel event
|
||||
* on some pages. e.g.: html, body { height: 100% }
|
||||
*/
|
||||
else if (scrollHeight > windowHeight &&
|
||||
(body.offsetHeight <= windowHeight ||
|
||||
html.offsetHeight <= windowHeight)) {
|
||||
|
||||
// DOMChange (throttle): fix height
|
||||
var pending = false;
|
||||
var refresh = function () {
|
||||
if (!pending && html.scrollHeight != document.height) {
|
||||
pending = true; // add a new pending action
|
||||
setTimeout(function () {
|
||||
html.style.height = document.height + 'px';
|
||||
pending = false;
|
||||
}, 500); // act rarely to stay fast
|
||||
}
|
||||
};
|
||||
html.style.height = 'auto';
|
||||
setTimeout(refresh, 10);
|
||||
|
||||
// clearfix
|
||||
if (root.offsetHeight <= windowHeight) {
|
||||
var underlay = document.createElement("div");
|
||||
underlay.style.clear = "both";
|
||||
body.appendChild(underlay);
|
||||
}
|
||||
}
|
||||
|
||||
// disable fixed background
|
||||
if (!options.fixedBackground && !isExcluded) {
|
||||
body.style.backgroundAttachment = "scroll";
|
||||
html.style.backgroundAttachment = "scroll";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************
|
||||
* SCROLLING
|
||||
************************************************/
|
||||
|
||||
var que = [];
|
||||
var pending = false;
|
||||
var lastScroll = +new Date;
|
||||
|
||||
/**
|
||||
* Pushes scroll actions to the scrolling queue.
|
||||
*/
|
||||
function scrollArray(elem, left, top, delay) {
|
||||
|
||||
delay || (delay = 1000);
|
||||
directionCheck(left, top);
|
||||
|
||||
if (options.accelerationMax != 1) {
|
||||
var now = +new Date;
|
||||
var elapsed = now - lastScroll;
|
||||
if (elapsed < options.accelerationDelta) {
|
||||
var factor = (1 + (30 / elapsed)) / 2;
|
||||
if (factor > 1) {
|
||||
factor = Math.min(factor, options.accelerationMax);
|
||||
left *= factor;
|
||||
top *= factor;
|
||||
}
|
||||
}
|
||||
lastScroll = +new Date;
|
||||
}
|
||||
|
||||
// push a scroll command
|
||||
que.push({
|
||||
x: left,
|
||||
y: top,
|
||||
lastX: (left < 0) ? 0.99 : -0.99,
|
||||
lastY: (top < 0) ? 0.99 : -0.99,
|
||||
start: +new Date
|
||||
});
|
||||
|
||||
// don't act if there's a pending queue
|
||||
if (pending) {
|
||||
return;
|
||||
}
|
||||
|
||||
var scrollWindow = (elem === document.body);
|
||||
|
||||
var step = function (time) {
|
||||
|
||||
var now = +new Date;
|
||||
var scrollX = 0;
|
||||
var scrollY = 0;
|
||||
|
||||
for (var i = 0; i < que.length; i++) {
|
||||
|
||||
var item = que[i];
|
||||
var elapsed = now - item.start;
|
||||
var finished = (elapsed >= options.animationTime);
|
||||
|
||||
// scroll position: [0, 1]
|
||||
var position = (finished) ? 1 : elapsed / options.animationTime;
|
||||
|
||||
// easing [optional]
|
||||
if (options.pulseAlgorithm) {
|
||||
position = pulse(position);
|
||||
}
|
||||
|
||||
// only need the difference
|
||||
var x = (item.x * position - item.lastX) >> 0;
|
||||
var y = (item.y * position - item.lastY) >> 0;
|
||||
|
||||
// add this to the total scrolling
|
||||
scrollX += x;
|
||||
scrollY += y;
|
||||
|
||||
// update last values
|
||||
item.lastX += x;
|
||||
item.lastY += y;
|
||||
|
||||
// delete and step back if it's over
|
||||
if (finished) {
|
||||
que.splice(i, 1); i--;
|
||||
}
|
||||
}
|
||||
|
||||
// scroll left and top
|
||||
if (scrollWindow) {
|
||||
window.scrollBy(scrollX, scrollY);
|
||||
}
|
||||
else {
|
||||
if (scrollX) elem.scrollLeft += scrollX;
|
||||
if (scrollY) elem.scrollTop += scrollY;
|
||||
}
|
||||
|
||||
// clean up if there's nothing left to do
|
||||
if (!left && !top) {
|
||||
que = [];
|
||||
}
|
||||
|
||||
if (que.length) {
|
||||
requestFrame(step, elem, (delay / options.frameRate + 1));
|
||||
} else {
|
||||
pending = false;
|
||||
}
|
||||
};
|
||||
|
||||
// start a new queue of actions
|
||||
requestFrame(step, elem, 0);
|
||||
pending = true;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************
|
||||
* EVENTS
|
||||
***********************************************/
|
||||
|
||||
/**
|
||||
* Mouse wheel handler.
|
||||
* @param {Object} event
|
||||
*/
|
||||
function wheel(event) {
|
||||
|
||||
if (!initDone) {
|
||||
init();
|
||||
}
|
||||
|
||||
var target = event.target;
|
||||
var overflowing = overflowingAncestor(target);
|
||||
|
||||
// use default if there's no overflowing
|
||||
// element or default action is prevented
|
||||
if (!overflowing || event.defaultPrevented ||
|
||||
isNodeName(activeElement, "embed") ||
|
||||
(isNodeName(target, "embed") && /\.pdf/i.test(target.src))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var deltaX = event.wheelDeltaX || 0;
|
||||
var deltaY = event.wheelDeltaY || 0;
|
||||
|
||||
// use wheelDelta if deltaX/Y is not available
|
||||
if (!deltaX && !deltaY) {
|
||||
deltaY = event.wheelDelta || 0;
|
||||
}
|
||||
|
||||
// check if it's a touchpad scroll that should be ignored
|
||||
if (!options.touchpadSupport && isTouchpad(deltaY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// scale by step size
|
||||
// delta is 120 most of the time
|
||||
// synaptics seems to send 1 sometimes
|
||||
if (Math.abs(deltaX) > 1.2) {
|
||||
deltaX *= options.stepSize / 120;
|
||||
}
|
||||
if (Math.abs(deltaY) > 1.2) {
|
||||
deltaY *= options.stepSize / 120;
|
||||
}
|
||||
|
||||
scrollArray(overflowing, -deltaX, -deltaY);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* Keydown event handler.
|
||||
* @param {Object} event
|
||||
*/
|
||||
function keydown(event) {
|
||||
|
||||
var target = event.target;
|
||||
var modifier = event.ctrlKey || event.altKey || event.metaKey ||
|
||||
(event.shiftKey && event.keyCode !== key.spacebar);
|
||||
|
||||
// do nothing if user is editing text
|
||||
// or using a modifier key (except shift)
|
||||
// or in a dropdown
|
||||
if ( /input|textarea|select|embed/i.test(target.nodeName) ||
|
||||
target.isContentEditable ||
|
||||
event.defaultPrevented ||
|
||||
modifier ) {
|
||||
return true;
|
||||
}
|
||||
// spacebar should trigger button press
|
||||
if (isNodeName(target, "button") &&
|
||||
event.keyCode === key.spacebar) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var shift, x = 0, y = 0;
|
||||
var elem = overflowingAncestor(activeElement);
|
||||
var clientHeight = elem.clientHeight;
|
||||
|
||||
if (elem == document.body) {
|
||||
clientHeight = window.innerHeight;
|
||||
}
|
||||
|
||||
switch (event.keyCode) {
|
||||
case key.up:
|
||||
y = -options.arrowScroll;
|
||||
break;
|
||||
case key.down:
|
||||
y = options.arrowScroll;
|
||||
break;
|
||||
case key.spacebar: // (+ shift)
|
||||
shift = event.shiftKey ? 1 : -1;
|
||||
y = -shift * clientHeight * 0.9;
|
||||
break;
|
||||
case key.pageup:
|
||||
y = -clientHeight * 0.9;
|
||||
break;
|
||||
case key.pagedown:
|
||||
y = clientHeight * 0.9;
|
||||
break;
|
||||
case key.home:
|
||||
y = -elem.scrollTop;
|
||||
break;
|
||||
case key.end:
|
||||
var damt = elem.scrollHeight - elem.scrollTop - clientHeight;
|
||||
y = (damt > 0) ? damt+10 : 0;
|
||||
break;
|
||||
case key.left:
|
||||
x = -options.arrowScroll;
|
||||
break;
|
||||
case key.right:
|
||||
x = options.arrowScroll;
|
||||
break;
|
||||
default:
|
||||
return true; // a key we don't care about
|
||||
}
|
||||
|
||||
scrollArray(elem, x, y);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mousedown event only for updating activeElement
|
||||
*/
|
||||
function mousedown(event) {
|
||||
activeElement = event.target;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************
|
||||
* OVERFLOW
|
||||
***********************************************/
|
||||
|
||||
var cache = {}; // cleared out every once in while
|
||||
setInterval(function () { cache = {}; }, 10 * 1000);
|
||||
|
||||
var uniqueID = (function () {
|
||||
var i = 0;
|
||||
return function (el) {
|
||||
return el.uniqueID || (el.uniqueID = i++);
|
||||
};
|
||||
})();
|
||||
|
||||
function setCache(elems, overflowing) {
|
||||
for (var i = elems.length; i--;)
|
||||
cache[uniqueID(elems[i])] = overflowing;
|
||||
return overflowing;
|
||||
}
|
||||
|
||||
function overflowingAncestor(el) {
|
||||
var elems = [];
|
||||
var rootScrollHeight = root.scrollHeight;
|
||||
do {
|
||||
var cached = cache[uniqueID(el)];
|
||||
if (cached) {
|
||||
return setCache(elems, cached);
|
||||
}
|
||||
elems.push(el);
|
||||
if (rootScrollHeight === el.scrollHeight) {
|
||||
if (!isFrame || root.clientHeight + 10 < rootScrollHeight) {
|
||||
return setCache(elems, document.body); // scrolling root in WebKit
|
||||
}
|
||||
} else if (el.clientHeight + 10 < el.scrollHeight) {
|
||||
overflow = getComputedStyle(el, "").getPropertyValue("overflow-y");
|
||||
if (overflow === "scroll" || overflow === "auto") {
|
||||
return setCache(elems, el);
|
||||
}
|
||||
}
|
||||
} while (el = el.parentNode);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************
|
||||
* HELPERS
|
||||
***********************************************/
|
||||
|
||||
function addEvent(type, fn, bubble) {
|
||||
window.addEventListener(type, fn, (bubble||false));
|
||||
}
|
||||
|
||||
function removeEvent(type, fn, bubble) {
|
||||
window.removeEventListener(type, fn, (bubble||false));
|
||||
}
|
||||
|
||||
function isNodeName(el, tag) {
|
||||
return (el.nodeName||"").toLowerCase() === tag.toLowerCase();
|
||||
}
|
||||
|
||||
function directionCheck(x, y) {
|
||||
x = (x > 0) ? 1 : -1;
|
||||
y = (y > 0) ? 1 : -1;
|
||||
if (direction.x !== x || direction.y !== y) {
|
||||
direction.x = x;
|
||||
direction.y = y;
|
||||
que = [];
|
||||
lastScroll = 0;
|
||||
}
|
||||
}
|
||||
|
||||
var deltaBufferTimer;
|
||||
|
||||
function isTouchpad(deltaY) {
|
||||
if (!deltaY) return;
|
||||
deltaY = Math.abs(deltaY)
|
||||
deltaBuffer.push(deltaY);
|
||||
deltaBuffer.shift();
|
||||
clearTimeout(deltaBufferTimer);
|
||||
var allDivisable = (isDivisible(deltaBuffer[0], 120) &&
|
||||
isDivisible(deltaBuffer[1], 120) &&
|
||||
isDivisible(deltaBuffer[2], 120));
|
||||
return !allDivisable;
|
||||
}
|
||||
|
||||
function isDivisible(n, divisor) {
|
||||
return (Math.floor(n / divisor) == n / divisor);
|
||||
}
|
||||
|
||||
var requestFrame = (function () {
|
||||
return window.requestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
function (callback, element, delay) {
|
||||
window.setTimeout(callback, delay || (1000/60));
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
/***********************************************
|
||||
* PULSE
|
||||
***********************************************/
|
||||
|
||||
/**
|
||||
* Viscous fluid with a pulse for part and decay for the rest.
|
||||
* - Applies a fixed force over an interval (a damped acceleration), and
|
||||
* - Lets the exponential bleed away the velocity over a longer interval
|
||||
* - Michael Herf, http://stereopsis.com/stopping/
|
||||
*/
|
||||
function pulse_(x) {
|
||||
var val, start, expx;
|
||||
// test
|
||||
x = x * options.pulseScale;
|
||||
if (x < 1) { // acceleartion
|
||||
val = x - (1 - Math.exp(-x));
|
||||
} else { // tail
|
||||
// the previous animation ended here:
|
||||
start = Math.exp(-1);
|
||||
// simple viscous drag
|
||||
x -= 1;
|
||||
expx = 1 - Math.exp(-x);
|
||||
val = start + (expx * (1 - start));
|
||||
}
|
||||
return val * options.pulseNormalize;
|
||||
}
|
||||
|
||||
function pulse(x) {
|
||||
if (x >= 1) return 1;
|
||||
if (x <= 0) return 0;
|
||||
|
||||
if (options.pulseNormalize == 1) {
|
||||
options.pulseNormalize /= pulse_(1);
|
||||
}
|
||||
return pulse_(x);
|
||||
}
|
||||
|
||||
var isChrome = /chrome/i.test(window.navigator.userAgent);
|
||||
var wheelEvent = null;
|
||||
if ("onwheel" in document.createElement("div"))
|
||||
wheelEvent = "wheel";
|
||||
else if ("onmousewheel" in document.createElement("div"))
|
||||
wheelEvent = "mousewheel";
|
||||
|
||||
if (wheelEvent && isChrome) {
|
||||
addEvent(wheelEvent, wheel);
|
||||
addEvent("mousedown", mousedown);
|
||||
addEvent("load", init);
|
||||
}
|
||||
|
||||
})();
|
||||
380
wp-content/themes/Divi/js/theme-customizer-controls.js
Normal file
380
wp-content/themes/Divi/js/theme-customizer-controls.js
Normal file
@@ -0,0 +1,380 @@
|
||||
(function($){
|
||||
$( document ).ready( function() {
|
||||
var ET_Select_Image = function(element, options){
|
||||
this.element = element;
|
||||
this.custom_select_link = null;
|
||||
this.custom_dropdown = null;
|
||||
this.frontend_customizer = $('body').hasClass( 'et_frontend_customizer' ) ? true : false;
|
||||
|
||||
this.options = jQuery.extend({}, this.defaults, options);
|
||||
|
||||
this.create_dropdown();
|
||||
}
|
||||
|
||||
if ( typeof window.location.search !== 'undefined' && window.location.search.search( 'et_customizer_option_set=module' ) !== -1 ) {
|
||||
$( 'body' ).addClass( 'et_modules_customizer_option_set' );
|
||||
} else {
|
||||
$( 'body' ).addClass( 'et_theme_customizer_option_set' );
|
||||
}
|
||||
|
||||
ET_Select_Image.prototype = {
|
||||
defaults: {
|
||||
apply_value_to : 'body'
|
||||
},
|
||||
|
||||
create_dropdown: function(){
|
||||
var $et_select_image_main_select = this.element,
|
||||
et_filter_options_html = '',
|
||||
$selected_option,
|
||||
$dropdown_selected_option,
|
||||
self = this;
|
||||
|
||||
if ( $et_select_image_main_select.length ) {
|
||||
$et_select_image_main_select.hide().addClass( 'et_select_image_main_select' );
|
||||
|
||||
$et_select_image_main_select.change( $.proxy( self.change_option, self ) );
|
||||
|
||||
$et_select_image_main_select.find( 'option' ).each( function() {
|
||||
var $this_option = $(this),
|
||||
selected = $(this).is( ':selected' ) ? ' class="et_select_image_active"' : '',
|
||||
option_class = 0 === $this_option.attr( 'value' ).indexOf( '_' ) ? $this_option.attr( 'value' ) : '_' + $this_option.attr( 'value' );
|
||||
|
||||
et_filter_options_html += '<li class="et_si' + option_class + '_column" data-value="' + $this_option.attr( 'value' ) + '"' + selected +'>' + $this_option.text() + '</li>';
|
||||
} );
|
||||
|
||||
$et_select_image_main_select.after( '<a href="#" class="et_select_image_custom_select">' + '<span class="et_filter_text"></span>' + '</a>' + '<ul class="et_select_image_options '+ self.esc_classname( $et_select_image_main_select.attr('data-customize-setting-link') ) +'">' + et_filter_options_html + '</ul>' );
|
||||
}
|
||||
|
||||
this.custom_select_link = $et_select_image_main_select.next( '.et_select_image_custom_select' );
|
||||
|
||||
this.custom_dropdown = this.custom_select_link.next('.et_select_image_options');
|
||||
|
||||
$selected_option = $et_select_image_main_select.find( ':selected' );
|
||||
|
||||
if ( $selected_option.length ) {
|
||||
var selected_option_class = 0 === $selected_option.attr( 'value' ).indexOf( '_' ) ? $selected_option.attr( 'value' ) : '_' + $selected_option.attr( 'value' );
|
||||
this.custom_select_link.find('.et_filter_text').text( $selected_option.text() ).addClass( 'et_si' + selected_option_class + '_column' );
|
||||
|
||||
$dropdown_selected_option = ( $selected_option.val() == 'none' ) ? this.custom_dropdown.find('li').eq(0) : this.custom_dropdown.find('li[data-value="' + $selected_option.text() + '"]');
|
||||
|
||||
this.custom_select_link.find('.et_filter_text').addClass( $dropdown_selected_option.attr('class') ).attr( 'data-si-class', $dropdown_selected_option.attr('class') );
|
||||
|
||||
$dropdown_selected_option.addClass( 'et_select_image_active' );
|
||||
}
|
||||
|
||||
this.custom_select_link.click( $.proxy( self.open_dropdown, self ) );
|
||||
|
||||
this.custom_dropdown.find('li').click( $.proxy( self.select_option, self ) );
|
||||
},
|
||||
|
||||
open_dropdown: function(event) {
|
||||
var self = this,
|
||||
$this_link = $(event.target);
|
||||
|
||||
if ( self.custom_dropdown.hasClass( 'et_select_image_open' ) ) return false;
|
||||
|
||||
self.custom_dropdown.show().addClass( 'et_select_image_open' );
|
||||
|
||||
$this_link.hide();
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
select_option: function(event) {
|
||||
var self = this,
|
||||
$this_option = $(event.target),
|
||||
this_option_value = $this_option.attr('data-value'),
|
||||
$main_text = self.custom_select_link.find( '.et_filter_text' ),
|
||||
$main_select_active_element = self.element.find( 'option[value="' + this_option_value + '"]' );
|
||||
|
||||
if ( $this_option.hasClass( 'et_select_image_active' ) ) {
|
||||
self.close_dropdown();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$this_option.siblings().removeClass( 'et_select_image_active' );
|
||||
|
||||
$main_text.removeClass(function(index, css){
|
||||
return (css.match(/\bet_si_\S+/g) || []).join(' ')
|
||||
});
|
||||
|
||||
$main_text.addClass( $this_option.attr( 'class' ) ).attr( 'data-si-class', $this_option.attr( 'class' ) );
|
||||
|
||||
$this_option.addClass('et_select_image_active');
|
||||
|
||||
self.close_dropdown();
|
||||
|
||||
if ( ! $main_select_active_element.length )
|
||||
self.element.val( 'none' ).trigger( 'change' );
|
||||
else
|
||||
self.element.val( this_option_value ).trigger( 'change' );
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
close_dropdown: function() {
|
||||
this.custom_select_link.find( '.et_filter_text' ).show();
|
||||
this.custom_dropdown.hide().removeClass( 'et_select_image_open' );
|
||||
},
|
||||
|
||||
change_option: function() {
|
||||
var self = this,
|
||||
$active_option = self.element.find('option:selected'),
|
||||
active_option_value = $active_option.val(),
|
||||
$this_option = this.custom_dropdown.find('li[data-value="' + active_option_value + '"]'),
|
||||
$main_text = self.custom_select_link.find( '.et_filter_text' ),
|
||||
main_text_si_class = $main_text.attr( 'data-si-class' );
|
||||
|
||||
// set correct custom dropdown values on first load
|
||||
if ( this.custom_dropdown.find('li.et_select_image_active').data( 'value' ) !== active_option_value ) {
|
||||
this.custom_dropdown.find('li').removeClass( 'et_select_image_active' );
|
||||
$main_text.removeClass( main_text_si_class ).addClass( $this_option.attr( 'class' ) ).attr( 'data-si-class', $this_option.attr( 'class' ) );
|
||||
|
||||
$this_option.addClass('et_select_image_active');
|
||||
}
|
||||
},
|
||||
|
||||
esc_classname: function( option_value ) {
|
||||
return 'et_si_' + option_value.replace(/[ +\/\[\]]/g,'_').toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.et_select_image = function(options){
|
||||
new ET_Select_Image(this, options)
|
||||
return this;
|
||||
};
|
||||
|
||||
$('select[data-customize-setting-link="et_divi[footer_columns]"]').et_select_image({ apply_value_to: 'body' });
|
||||
|
||||
$( '.et_divi_reset_slider' ).click( function () {
|
||||
var $this_input = $( this ).closest( 'label' ).find( 'input' ),
|
||||
input_name = $this_input.data( 'customize-setting-link' ),
|
||||
input_default = $this_input.data( 'reset_value' );
|
||||
|
||||
$this_input.val( input_default );
|
||||
$this_input.change();
|
||||
});
|
||||
|
||||
$( '#accordion-section-et_divi_mobile_tablet h3, #accordion-panel-et_divi_mobile h3' ).click( function () {
|
||||
var $iframe_preview = $( '#customize-preview' );
|
||||
$iframe_preview.removeClass( 'et_divi_phone et_divi_tablet' );
|
||||
$iframe_preview.addClass( 'et_divi_tablet' );
|
||||
});
|
||||
|
||||
$( '#accordion-section-et_divi_mobile_phone h3, #accordion-section-et_divi_mobile_menu h3' ).click( function () {
|
||||
var $iframe_preview = $( '#customize-preview' );
|
||||
$iframe_preview.removeClass( 'et_divi_phone et_divi_tablet' );
|
||||
$iframe_preview.addClass( 'et_divi_phone' );
|
||||
});
|
||||
|
||||
$( '.control-panel-back, .customize-panel-back' ).click( function () {
|
||||
var $iframe_preview = $( '#customize-preview' );
|
||||
$iframe_preview.removeClass( 'et_divi_phone et_divi_tablet' );
|
||||
});
|
||||
|
||||
$( 'input[type=range]' ).on( 'mousedown', function() {
|
||||
$( '.et_pb_range_tooltip' ).remove();
|
||||
value = $( this ).attr( 'value' );
|
||||
$( this ).parent().append( '<div class="et_pb_range_tooltip">' + value + '</div> ' );
|
||||
$( this ).mousemove(function() {
|
||||
value = $( this ).attr( 'value' );
|
||||
$( '.et_pb_range_tooltip' ).text( value );
|
||||
});
|
||||
$( this ).mouseup(function() {
|
||||
$( '.et_pb_range_tooltip' ).fadeOut( 'fast' );
|
||||
});
|
||||
$( this ).mousedown(function() {
|
||||
$( '.et_pb_range_tooltip' ).fadeIn( 'fast' );
|
||||
});
|
||||
});
|
||||
|
||||
$('input.et_font_style_checkbox[type=checkbox]').live('change', function(){
|
||||
var $this_el = $(this),
|
||||
$main_option = $this_el.closest( 'span' ).siblings( 'input.et_font_styles' ),
|
||||
value = $this_el.val(),
|
||||
current_value = $main_option.val(),
|
||||
values = ( current_value != 'false' ) ? current_value.split( '|' ) : [],
|
||||
query = $.inArray( value, values ),
|
||||
result = '';
|
||||
|
||||
if ( $this_el.prop('checked' ) == true ) {
|
||||
|
||||
if ( current_value.length ) {
|
||||
|
||||
if ( query < 0 ) {
|
||||
values.push( value );
|
||||
|
||||
result = values.join( '|' );
|
||||
}
|
||||
} else {
|
||||
result = value;
|
||||
}
|
||||
} else {
|
||||
|
||||
if ( current_value.length !== 0 ) {
|
||||
|
||||
if ( query >= 0 ) {
|
||||
values.splice( query, 1 );
|
||||
|
||||
result = values.join( '|' );
|
||||
} else {
|
||||
result = current_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$main_option.val( result ).trigger( 'change' );
|
||||
});
|
||||
|
||||
$( 'span.et_font_style' ).click( function() {
|
||||
var style_checkbox = $( this ).find( 'input' );
|
||||
|
||||
$( this ).toggleClass( 'et_font_style_checked' );
|
||||
|
||||
if ( style_checkbox.is( ':checked' ) ) {
|
||||
style_checkbox.prop( 'checked', false );
|
||||
} else {
|
||||
style_checkbox.prop( 'checked', true );
|
||||
}
|
||||
|
||||
style_checkbox.change();
|
||||
});
|
||||
|
||||
var $vertical_nav_input = $( '#customize-control-et_divi-vertical_nav input[type=checkbox]' ),
|
||||
$nav_fullwidth_control = $( '#customize-control-et_divi-nav_fullwidth' ),
|
||||
$hide_navigation_until_scroll_control = $('#customize-control-et_divi-hide_nav');
|
||||
|
||||
if ( $vertical_nav_input.is( ':checked') ) {
|
||||
$nav_fullwidth_control.hide();
|
||||
$hide_navigation_until_scroll_control.hide();
|
||||
} else {
|
||||
$nav_fullwidth_control.show();
|
||||
$hide_navigation_until_scroll_control.show();
|
||||
}
|
||||
|
||||
$('#customize-theme-controls').on( 'change', '#customize-control-et_divi-vertical_nav input[type=checkbox]', function(){
|
||||
$input = $(this);
|
||||
|
||||
if ( $input.is(':checked') ) {
|
||||
$nav_fullwidth_control.hide();
|
||||
$hide_navigation_until_scroll_control.hide();
|
||||
} else {
|
||||
$nav_fullwidth_control.show();
|
||||
$hide_navigation_until_scroll_control.show();
|
||||
}
|
||||
});
|
||||
|
||||
function toggle_sidebar_width_control() {
|
||||
$checkbox = $('#customize-control-et_divi-use_sidebar_width input[type="checkbox"]'),
|
||||
$sidebar_width_control = $( '#customize-control-et_divi-sidebar_width' );
|
||||
|
||||
if ( $checkbox.is( ':checked' ) ) {
|
||||
$sidebar_width_control.fadeIn();
|
||||
} else {
|
||||
$sidebar_width_control.fadeOut();
|
||||
}
|
||||
}
|
||||
|
||||
toggle_sidebar_width_control();
|
||||
|
||||
$('#customize-theme-controls').on( 'change', '#customize-control-et_divi-use_sidebar_width input[type=checkbox]', function(){
|
||||
toggle_sidebar_width_control();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
var api = wp.customize;
|
||||
|
||||
api.ET_ColorAlphaControl = api.Control.extend({
|
||||
ready: function() {
|
||||
var control = this,
|
||||
picker = control.container.find('.color-picker-hex');
|
||||
|
||||
picker.val( control.setting() ).wpColorPicker({
|
||||
change: function() {
|
||||
control.setting.set( picker.wpColorPicker('color') );
|
||||
},
|
||||
clear: function() {
|
||||
control.setting.set( false );
|
||||
}
|
||||
});
|
||||
|
||||
control.setting.bind( function( value ) {
|
||||
picker.val( value );
|
||||
picker.wpColorPicker( 'color', value );
|
||||
});
|
||||
|
||||
/**
|
||||
* Adding following event whenever footer_menu_text_color is changed, due to its relationship with footer_menu_active_link_color.
|
||||
*/
|
||||
if ( 'et_divi[footer_menu_text_color]' === this.id ) {
|
||||
|
||||
// Whenever user change footer_menu_text_color, do the following
|
||||
this.setting.bind( 'change', function( value ){
|
||||
|
||||
// Set footer_menu_active_link_color equal to the newly changed footer_menu_text_color
|
||||
api( 'et_divi[footer_menu_active_link_color]' ).set( value );
|
||||
|
||||
// Update default color of footer_menu_active_link_color equal to the newly changed footer_menu_text_color.
|
||||
// If afterward user change the color and not happy with it, they can click reset and back to footer_menu_text_color color
|
||||
api.control( 'et_divi[footer_menu_active_link_color]' ).container.find( '.color-picker-hex' )
|
||||
.data( 'data-default-color', value )
|
||||
.wpColorPicker({ 'defaultColor' : value, 'color' : value });
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.et_font_icon li', function() {
|
||||
var $this_el = $( this ),
|
||||
$this_input;
|
||||
|
||||
if ( ! $this_el.hasClass( 'active' ) ) {
|
||||
$( '.et_font_icon li' ).removeClass( 'et_active' );
|
||||
$this_el.addClass( 'et_active' );
|
||||
|
||||
$this_input = $this_el.closest( 'label' ).find( '.et_selected_icon' );
|
||||
$this_input.val( $this_el.data( 'icon' ) );
|
||||
$this_input.change();
|
||||
}
|
||||
});
|
||||
|
||||
api.controlConstructor['et_coloralpha'] = api.ET_ColorAlphaControl;
|
||||
|
||||
$( window ).load( function() {
|
||||
if ( $( '#accordion-section-et_divi_buttons' ).length ) {
|
||||
var $icon_options_trigger = $( '#customize-control-et_divi-all_buttons_icon select' ),
|
||||
icon_options_trigger_val = $icon_options_trigger.val();
|
||||
|
||||
trigger_button_options( icon_options_trigger_val );
|
||||
|
||||
$icon_options_trigger.change( function() {
|
||||
icon_options_trigger_val = $( this ).val();
|
||||
trigger_button_options( icon_options_trigger_val );
|
||||
});
|
||||
}
|
||||
|
||||
function trigger_button_options( trigger_val ) {
|
||||
var icon_options_set = [ 'all_buttons_icon_color', 'all_buttons_icon_placement', 'all_buttons_icon_hover', 'all_buttons_selected_icon' ];
|
||||
|
||||
$.each( icon_options_set, function( i, option_name ) {
|
||||
if ( 'yes' === trigger_val ) {
|
||||
$( '#customize-control-et_divi-' + option_name ).show();
|
||||
} else {
|
||||
$( '#customize-control-et_divi-' + option_name ).hide();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
if ( $( '.et_font_icon' ).length ) {
|
||||
$( '.et_font_icon' ).each( function(){
|
||||
var $this_el = $( this ),
|
||||
this_input_val = $this_el.closest( 'label' ).find( '.et_selected_icon' ).val();
|
||||
$this_el.find( 'li[data-icon="' + this_input_val + '"]').addClass( 'et_active' );
|
||||
});
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
})(jQuery)
|
||||
4022
wp-content/themes/Divi/js/theme-customizer.js
Normal file
4022
wp-content/themes/Divi/js/theme-customizer.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user