/* global wp, jQuery */ /** * File customizer.js. * * Theme Customizer enhancements for a better user experience. * * Contains handlers to make Theme Customizer preview reload changes asynchronously. */ ( function( $ ) { "use strict" const themeContstants = { prefix: 'blogcast_' } const themeCalls = { blogcastAjaxCall: function( action, id ) { $.ajax({ method: "GET", url: blogcastPreviewObject.ajaxUrl, data: ({ action: action, _wpnonce: blogcastPreviewObject._wpnonce }), success: function(response) { if( response ) { if( $( "head #" + id ).length > 0 ) { $( "head #" + id ).html( response ) } else { $( "head" ).append( '' ) } } } }) }, blogcastGenerateTypoCss: function(selector,value) { var cssCode = '' if( value.font_family ) { cssCode += '.blogcast_font_typography { ' + selector + '-family: ' + value.font_family.value + '; } ' } if( value.font_weight ) { cssCode += '.blogcast_font_typography { ' + selector + '-weight: ' + value.font_weight.value + '; } ' } if( value.text_transform ) { cssCode += '.blogcast_font_typography { ' + selector + '-texttransform: ' + value.text_transform + '; } ' } if( value.text_decoration ) { cssCode += '.blogcast_font_typography { ' + selector + '-textdecoration: ' + value.text_decoration + '; } ' } if( value.font_size ) { if( value.font_size.desktop ) { cssCode += '.blogcast_font_typography { ' + selector + '-size: ' + value.font_size.desktop + 'px; } ' } if( value.font_size.tablet ) { cssCode += '.blogcast_font_typography { ' + selector + '-size-tab: ' + value.font_size.tablet + 'px; } ' } if( value.font_size.smartphone ) { cssCode += '.blogcast_font_typography { ' + selector + '-size-mobile: ' + value.font_size.smartphone + 'px; } ' } } if( value.line_height ) { if( value.line_height.desktop ) { cssCode += '.blogcast_font_typography { ' + selector + '-lineheight: ' + value.line_height.desktop + 'px; } ' } if( value.line_height.tablet ) { cssCode += '.blogcast_font_typography { ' + selector + '-lineheight-tab: ' + value.line_height.tablet + 'px; } ' } if( value.line_height.smartphone ) { cssCode += '.blogcast_font_typography { ' + selector + '-lineheight-mobile: ' + value.line_height.smartphone + 'px; } ' } } if( value.letter_spacing ) { if( value.letter_spacing.desktop ) { cssCode += '.blogcast_font_typography { ' + selector + '-letterspacing: ' + value.letter_spacing.desktop + 'px; } ' } if( value.letter_spacing.tablet ) { cssCode += '.blogcast_font_typography { ' + selector + '-letterspacing-tab: ' + value.letter_spacing.tablet + 'px; } ' } if( value.letter_spacing.smartphone ) { cssCode += '.blogcast_font_typography { ' + selector + '-letterspacing-mobile: ' + value.letter_spacing.smartphone + 'px; } ' } } return cssCode }, blogcastGenerateTypoCssWithSelector: function(selector,value) { var cssCode = '' if( value.font_family ) { cssCode += selector + ' { font-family: ' + value.font_family.value + '; } ' } if( value.font_weight ) { cssCode += selector + ' { font-weight: ' + value.font_weight.value + '; } ' } if( value.text_transform ) { cssCode += selector + ' { text-transform: ' + value.text_transform + '; } ' } if( value.text_decoration ) { cssCode += selector + ' { text-decoration: ' + value.text_decoration + '; } ' } if( value.font_size ) { if( value.font_size.desktop ) { cssCode += selector + ' { font-size: ' + value.font_size.desktop + 'px; } ' } if( value.font_size.tablet ) { cssCode += '@media(max-width: 940px) { ' + selector + ' { font-size: ' + value.font_size.tablet + 'px; } } ' } if( value.font_size.smartphone ) { cssCode += '@media(max-width: 610px) { ' + selector + ' { font-size: ' + value.font_size.smartphone + 'px; } } ' } } if( value.line_height ) { if( value.line_height.desktop ) { cssCode += selector + ' { line-height: ' + value.line_height.desktop + 'px; } ' } if( value.line_height.tablet ) { cssCode += '@media(max-width: 940px) { ' + selector + ' { line-height: ' + value.line_height.tablet + 'px; } } ' } if( value.line_height.smartphone ) { cssCode += '@media(max-width: 610px) { ' + selector + ' { line-height: ' + value.line_height.smartphone + 'px; } } ' } } if( value.letter_spacing ) { if( value.letter_spacing.desktop ) { cssCode += selector + ' { letter-spacing: ' + value.letter_spacing.desktop + 'px; } ' } if( value.letter_spacing.tablet ) { cssCode += '@media(max-width: 940px) { ' + selector + ' { letter-spacing: ' + value.letter_spacing.tablet + 'px; } } ' } if( value.letter_spacing.smartphone ) { cssCode += '@media(max-width: 610px) { ' + selector + ' { letter-spacing: ' + value.letter_spacing.smartphone + 'px; } } ' } } return cssCode }, blogcastGenerateStyleTag: function( code, id ) { if( code ) { if( $( "head #" + id ).length > 0 ) { $( "head #" + id ).html( code ) } else { $( "head" ).append( '' ) } } else { $( "head #" + id ).remove() } }, blogcastGenerateLinkTag: function( action, id ) { $.ajax({ method: "GET", url: blogcastPreviewObject.ajaxUrl, data: ({ action: action, _wpnonce: blogcastPreviewObject._wpnonce }), success: function(response) { if( response ) { if( $( "head #" + id ).length > 0 ) { $( "head #" + id ).attr( "href", response ) } else { $( "head" ).append( '' ) } } } }) } } // background color wp.customize( 'site_background_color', function( value ) { value.bind( function(to) { var value = JSON.parse( to ) if( value ) { var cssCode = '' if( value.type == 'solid' ) { cssCode += 'body.blogcast_font_typography:before, body.blogcast_font_typography .main-header.header-sticky--enabled { background: ' + blogcast_get_color_format(value[value.type]) + '}' } else { cssCode += 'body.blogcast_font_typography:before, body.blogcast_font_typography .main-header.header-sticky--enabled { background: ' + blogcast_get_color_format(value[value.type]) + '}' } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-body-background' ) } else { themeCalls.blogcastGenerateStyleTag( '', 'blogcast-body-background' ) } }); }); // post title hover class wp.customize( 'post_title_hover_effects', function( value ) { value.bind( function(to) { $( "body" ).removeClass( "title-hover--none title-hover--one title-hover--two" ) $( "body" ).addClass( "title-hover--" + to ) }); }); // image hover class wp.customize( 'site_image_hover_effects', function( value ) { value.bind( function(to) { $( "body" ).removeClass( "image-hover--none image-hover--one image-hover--two" ) $( "body" ).addClass( "image-hover--" + to ) }); }); // theme color bind changes wp.customize( 'theme_color', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-color-style', '--blogcast-global-preset-theme-color') }); }); // gradient theme color bind changes wp.customize( 'gradient_theme_color', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-1-style', '--blogcast-global-preset-gradient-theme-color') }); }); // preset 1 bind changes wp.customize( 'preset_color_1', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-1-style', '--blogcast-global-preset-color-1') }); }); // preset 2 bind changes wp.customize( 'preset_color_2', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-2-style', '--blogcast-global-preset-color-2') }); }); // preset 3 bind changes wp.customize( 'preset_color_3', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-3-style', '--blogcast-global-preset-color-3') }); }); // preset 4 bind changes wp.customize( 'preset_color_4', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-4-style', '--blogcast-global-preset-color-4') }); }); // preset 5 bind changes wp.customize( 'preset_color_5', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-5-style', '--blogcast-global-preset-color-5') }); }); // preset 6 bind changes wp.customize( 'preset_color_6', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-6-style', '--blogcast-global-preset-color-6') }); }); // preset 7 bind changes wp.customize( 'preset_color_7', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-7-style', '--blogcast-global-preset-color-7') }); }); // preset 8 bind changes wp.customize( 'preset_color_8', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-8-style', '--blogcast-global-preset-color-8') }); }); // preset 9 bind changes wp.customize( 'preset_color_9', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-9-style', '--blogcast-global-preset-color-9') }); }); // preset 10 bind changes wp.customize( 'preset_color_10', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-10-style', '--blogcast-global-preset-color-10') }); }); // preset 11 bind changes wp.customize( 'preset_color_11', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-11-style', '--blogcast-global-preset-color-11') }); }); // preset 12 bind changes wp.customize( 'preset_color_12', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-color-12-style', '--blogcast-global-preset-color-12') }); }); // preset gradient 1 bind changes wp.customize( 'preset_gradient_1', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-1-style', '--blogcast-global-preset-gradient-color-1') }); }); // preset gradient 2 bind changes wp.customize( 'preset_gradient_2', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-2-style', '--blogcast-global-preset-gradient-color-2') }); }); // preset gradient 3 bind changes wp.customize( 'preset_gradient_3', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-3-style', '--blogcast-global-preset-gradient-color-3') }); }); // preset gradient 4 bind changes wp.customize( 'preset_gradient_4', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-4-style', '--blogcast-global-preset-gradient-color-4') }); }); // preset gradient 5 bind changes wp.customize( 'preset_gradient_5', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-5-style', '--blogcast-global-preset-gradient-color-5') }); }); // preset gradient 6 bind changes wp.customize( 'preset_gradient_6', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-6-style', '--blogcast-global-preset-gradient-color-6') }); }); // preset gradient 7 bind changes wp.customize( 'preset_gradient_7', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-7-style', '--blogcast-global-preset-gradient-color-7') }); }); // preset gradient 8 bind changes wp.customize( 'preset_gradient_8', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-8-style', '--blogcast-global-preset-gradient-color-8') }); }); // preset gradient 9 bind changes wp.customize( 'preset_gradient_9', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-9-style', '--blogcast-global-preset-gradient-color-9') }); }); // preset gradient 10 bind changes wp.customize( 'preset_gradient_10', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-10-style', '--blogcast-global-preset-gradient-color-10') }); }); // preset gradient 11 bind changes wp.customize( 'preset_gradient_11', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-11-style', '--blogcast-global-preset-gradient-color-11') }); }); // preset gradient 12 bind changes wp.customize( 'preset_gradient_12', function( value ) { value.bind( function( to ) { helperFunctions.generateStyle(to, 'theme-preset-gradient-color-12-style', '--blogcast-global-preset-gradient-color-12') }); }); // scroll to top align wp.customize( 'stt_alignment', function( value ) { value.bind( function(to) { $( "#blogcast-scroll-to-top" ).removeClass( "align--left align--center align--right" ) $( "#blogcast-scroll-to-top" ).addClass( "align--" + to ) }); }); // mobile option sub menu option wp.customize( 'sub_menu_mobile_option', function( value ) { value.bind( function(to) { if( to ) { $( "#site-navigation" ).removeClass( "sub-menu-hide-on-mobile" ) } else { $( "#site-navigation" ).addClass( "sub-menu-hide-on-mobile" ) } }); }); // mobile option scroll to top option wp.customize( 'scroll_to_top_mobile_option', function( value ) { value.bind( function(to) { if( to ) { $( "#blogcast-scroll-to-top" ).removeClass( "hide-on-mobile" ) } else { $( "#blogcast-scroll-to-top" ).addClass( "hide-on-mobile" ) } }); }); // mobile option show custom button text option wp.customize( 'show_custom_button_text_mobile_option', function( value ) { value.bind( function(to) { if( to ) { $( ".subscribe-section .header-custom-button .custom-button-label" ).removeClass( "hide-on-mobile" ) } else { $( ".subscribe-section .header-custom-button .custom-button-label" ).addClass( "hide-on-mobile" ) } }); }); // mobile option archive readmore button option wp.customize( 'show_readmore_button_mobile_option', function( value ) { value.bind( function(to) { if( to ) { $( "body.blog .blogcast-article-inner .post-meta .post-button, body.archive .blogcast-article-inner .post-meta .post-button, body.home .blogcast-article-inner .post-meta .post-button, body.search .blogcast-article-inner .post-meta .post-button" ).removeClass( "hide-on-mobile" ) } else { $( "body.blog .blogcast-article-inner .post-meta .post-button, body.archive .blogcast-article-inner .post-meta .post-button, body.home .blogcast-article-inner .post-meta .post-button, body.search .blogcast-article-inner .post-meta .post-button" ).addClass( "hide-on-mobile" ) } }); }); // single post related articles title option wp.customize( 'single_post_related_posts_title', function( value ) { value.bind( function(to) { if( $( ".single-related-posts-section-wrap" ).find('.blogcast-block-title span').length > 0 ) { $( ".single-related-posts-section-wrap" ).find('.blogcast-block-title span').text( to ) } else { $( ".single-related-posts-section-wrap .single-related-posts-section" ).prepend('

'+ to +'

') } }); }); // single post image ratio wp.customize( 'single_responsive_image_ratio', function( value ) { value.bind( function(to) { var cssCode = '' if( to.desktop ) { cssCode += 'body { --blogcast-single-post-image-ratio: ' + to.desktop + ' }'; } if( to.tablet ) { cssCode += 'body { --blogcast-single-post-image-ratio-tab: ' + to.tablet + ' }'; } if( to.smartphone ) { cssCode += 'body { --blogcast-single-post-image-ratio-mobile: ' + to.smartphone + ' }'; } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-single-post-image-ratio' ) }); }); // global sidebar sticky option wp.customize( 'sidebar_sticky_option', function( value ) { value.bind( function(to) { if( to ) { $("body").addClass( "blogcast-sidebar--enabled" ).removeClass( "blogcast-sidebar--disabled" ) } else { $("body").removeClass( "blogcast-sidebar--enabled" ).addClass( "blogcast-sidebar--disabled" ) } }); }); // Site title and description. wp.customize( 'blogname', function( value ) { value.bind( function( to ) { $( '.site-title a' ).text( to ); } ); }); wp.customize( 'blogdescription', function( value ) { value.bind( function( to ) { $( '.site-description' ).text( to ); } ); }); // blog description wp.customize( 'blogdescription_option', function( value ) { value.bind(function(to) { if( to ) { $( '.site-description' ).css( { clip: 'auto', position: 'relative', } ); } else { $( '.site-description' ).css( { clip: 'rect(1px, 1px, 1px, 1px)', position: 'absolute', } ); } }) }); // Header text color. wp.customize( 'header_textcolor', function( value ) { value.bind( function( to ) { if ( 'blank' === to ) { $( '.site-title' ).css( { clip: 'rect(1px, 1px, 1px, 1px)', position: 'absolute', } ); } else { $( '.site-title' ).css( { clip: 'auto', position: 'relative', } ); $( '.site-title a' ).css( { color: to, } ); } } ); }); // site title hover color wp.customize( 'site_title_hover_textcolor', function( value ) { value.bind( function( to ) { $( '.site-title a:hover' ).css( { color: to, }); } ); }); // site description color wp.customize( 'site_description_color', function( value ) { value.bind( function( to ) { $( '.site-description' ).css( { color: to, }); } ); }); // site title typo wp.customize( 'site_title_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-site-title' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-site-title-typo' ) }) }) // site tagline typo wp.customize( 'site_description_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-site-description' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-site-tagline-typo' ) }) }) // site logo width wp.customize( 'blogcast_site_logo_width', function( value ) { value.bind( function(to) { if( to ) { var cssCode = '' if( to.desktop ) { cssCode += 'body .site-branding img{ width: ' + to.desktop + 'px} ' } if( to.tablet ) { cssCode += '@media(max-width: 994px) { body .site-branding img{ width: ' + to.tablet + 'px} } ' } if( to.smartphone ) { cssCode += '@media(max-width: 610px) { body .site-branding img{ width: ' + to.smartphone + 'px} } ' } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-site-logo-width' ) } else { themeCalls.blogcastGenerateStyleTag( '', 'blogcast-site-logo-width' ) } }); }); // scroll to top color wp.customize( 'stt_color_group', function( value ) { value.bind( function(to) { if( to ) { var cssCode = '' var selector = '--blogcast-scroll-text-color' if( to.color ) { cssCode += 'body { ' + selector + ' : ' + blogcast_get_color_format( to.color ) + ' } ' } if( to.hover ) { cssCode += 'body { ' + selector + '-hover : ' + blogcast_get_color_format( to.hover ) + ' } ' } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-scroll-to-top-style' ) } else { themeCalls.blogcastGenerateStyleTag( '', 'blogcast-scroll-to-top-style' ) } }); }); // scroll to top background color wp.customize( 'stt_background_color_group', function( value ) { value.bind( function(to) { var parsedValue = JSON.parse(to) if( parsedValue ) { var cssCode = '' var selector = '--blogcast-scroll-top-bk-color' if( parsedValue.initial[parsedValue.initial.type] ) { cssCode += 'body { ' + selector + ' : ' + blogcast_get_color_format( parsedValue.initial[parsedValue.initial.type] ) + ' } ' } if( parsedValue.hover[parsedValue.hover.type] ) { cssCode += 'body { ' + selector + '-hover : ' + blogcast_get_color_format( parsedValue.hover[parsedValue.hover.type] ) + ' } ' } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-scroll-to-top-background-style' ) } else { themeCalls.blogcastGenerateStyleTag( '', 'blogcast-scroll-to-top-background-style' ) } }); }); // var parsedCats = JSON.parse( blogcastPreviewObject.totalCats ) var parsedCats = blogcastPreviewObject.totalCats if( parsedCats ) { var parsedCats = Object.keys(parsedCats).map(function (key) { return parsedCats[key]; }); parsedCats.forEach(function(item) { wp.customize( 'category_' + item.term_id + '_color', function( value ) { value.bind( function(to) { var cssCode = '' if( to.color ) { cssCode += "body .post-categories .cat-item.cat-" + item.term_id + " a, body.archive.category.category-" + item.term_id + " #blogcast-main-wrap .page-header .blogcast-container i { color : " + blogcast_get_color_format( to.color ) + " } " } if( to.hover ) { cssCode += "body .post-categories .cat-item.cat-" + item.term_id + " a:hover, body.archive.category.category-" + item.term_id + " #blogcast-main-wrap .page-header .blogcast-container i:hover { color : " + blogcast_get_color_format( to.hover ) + " } " } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-category-' + item.term_id + '-style' ) }) }) wp.customize( 'category_background_' + item.term_id + '_color', function( value ) { value.bind( function(to) { var parsedValue = JSON.parse( to ) var cssCode = '' if( parsedValue ) { if( parsedValue.initial[parsedValue.initial.type] ) { cssCode += "body .post-categories .cat-item.cat-" + item.term_id + " a, body.archive.category.category-" + item.term_id + " #blogcast-main-wrap .page-header .blogcast-container i { background : " + blogcast_get_color_format( parsedValue.initial[parsedValue.initial.type] ) + " } " } if( parsedValue.hover[parsedValue.hover.type] ) { cssCode += "body .post-categories .cat-item.cat-" + item.term_id + " a:hover, body.archive.category.category-" + item.term_id + " #blogcast-main-wrap .page-header .blogcast-container i:hover { background : " + blogcast_get_color_format( parsedValue.hover[parsedValue.hover.type] ) + " } " } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-category-background-' + item.term_id + '-style' ) } else { themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-category-background-' + item.term_id + '-style' ) } }) }) }) } // var parsedTags = JSON.parse(blogcastPreviewObject.totalTags) var parsedTags = blogcastPreviewObject.totalTags if( parsedTags ) { var parsedTags = Object.keys(parsedTags).map(function (key) { return parsedTags[key]; }); parsedTags.forEach(function(item) { wp.customize( 'tag_' + item.term_id + '_color', function( value ) { value.bind( function(to) { var cssCode = '' if( to.color ) { cssCode += "body .tags-wrap .tags-item.tag-" + item.term_id + " span, body.archive.tag.tag-" + item.term_id + " #blogcast-main-wrap .page-header .blogcast-container i { color : " + blogcast_get_color_format( to.color ) + " } " } if( to.hover ) { cssCode += "body .tags-wrap .tags-item.tag-" + item.term_id + ":hover span, body.archive.tag.tag-" + item.term_id + " #blogcast-main-wrap .page-header .blogcast-container i:hover { color : " + blogcast_get_color_format( to.hover ) + " } " } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-tag-' + item.term_id + '-style' ) }) }) wp.customize( 'tag_background_' + item.term_id + '_color', function( value ) { value.bind( function(to) { var parsedValue = JSON.parse( to ) var cssCode = '' if( parsedValue ) { if( parsedValue.initial[parsedValue.initial.type] ) { cssCode += "body .tags-wrap .tags-item.tag-" + item.term_id + ", body.archive.tag.tag-" + item.term_id + " #blogcast-main-wrap .page-header .blogcast-container i { background : " + blogcast_get_color_format( parsedValue.initial[parsedValue.initial.type] ) + " } " } if( parsedValue.hover[parsedValue.hover.type] ) { cssCode += "body .tags-wrap .tags-item.tag-" + item.term_id + ":hover, body.archive.tag.tag-" + item.term_id + " #blogcast-main-wrap .page-header .blogcast-container i:hover { background : " + blogcast_get_color_format( parsedValue.hover[parsedValue.hover.type] ) + " } " } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-tag-background-' + item.term_id + '-style' ) } else { themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-tag-background-' + item.term_id + '-style' ) } }) }) }) } // header menu alignment wp.customize( 'menu_options_menu_alignment', function( value ) { value.bind( function(to) { $(".main-header").removeClass( "menu-aligment--right menu-aligment--center menu-aligment--left" ) $(".main-header").addClass( "menu-aligment--" + to ) }) }) // menu hover effects wp.customize( 'blogcast_header_menu_hover_effect', function( value ) { value.bind( function(to) { $("#site-navigation").removeClass( "hover-effect--none hover-effect--one hover-effect--two hover-effect--three hover-effect--four" ) $("#site-navigation").addClass( "hover-effect--" + to ) }) }) // header menu color wp.customize( 'header_menu_color', function( value ) { value.bind( function(to) { var cssCode = '' var selector = '--blogcast-menu-color' if( to.color ) { cssCode += "body { " + selector + " : " + blogcast_get_color_format( to.color ) + " } " } if( to.hover ) { cssCode += "body { " + selector + "-hover : " + blogcast_get_color_format( to.hover ) + " } " } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-menu-style' ) }) }) // main menu typo wp.customize( 'main_menu_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-menu' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-main-menu-typo' ) }) }) // sub menu typo wp.customize( 'main_menu_sub_menu_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-submenu' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-main-sub-menu-typo' ) }) }) // custom button typography wp.customize( 'blogcast_custom_button_text_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-custom-button' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-custom-button-typo' ) }) }) // custom button text color wp.customize( 'blogcast_custom_button_text_color', function( value ) { value.bind( function(to) { var cssCode = '' var selector = '--blogcast-custom-button-color' if( to.color ) { cssCode += "body { " + selector + " : " + blogcast_get_color_format( to.color ) + " } " } if( to.hover ) { cssCode += "body { " + selector + "-hover : " + blogcast_get_color_format( to.hover ) + " } " } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-custom-button-text-color-style' ) }) }) // custom button icon color wp.customize( 'blogcast_custom_button_icon_color', function( value ) { value.bind( function(to) { var cssCode = '' var selector = '--blogcast-custom-button-icon-color' if( to.color ) { cssCode += "body { " + selector + " : " + blogcast_get_color_format( to.color ) + " } " } if( to.hover ) { cssCode += "body { " + selector + "-hover : " + blogcast_get_color_format( to.hover ) + " } " } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-custom-button-icon-color-style' ) }) }) // banner elements alignment wp.customize( 'main_banner_post_elements_alignment', function( value ) { value.bind( function( to ) { $(".blogcast-main-banner-section").removeClass("banner-align--right banner-align--center banner-align--left") $(".blogcast-main-banner-section").addClass("banner-align--" + to) }) }) // banner image ratio wp.customize( 'main_banner_responsive_image_ratio', function( value ) { value.bind( function( to ) { var cssCode = '' if( to.desktop && to.desktop > 0 ) { cssCode += "body .blogcast-main-banner-section article.post-item .post-thumb { padding-bottom : calc(" + to.desktop + " * 100%) } " } if( to.tablet && to.tablet > 0) { cssCode += "@media(max-width: 940px) { body .blogcast-main-banner-section article.post-item .post-thumb { padding-bottom : calc(" + to.tablet + " * 100%) } } " } if( to.smartphone && to.smartphone > 0 ) { cssCode += "@media(max-width: 610px) { body .blogcast-main-banner-section article.post-item .post-thumb { padding-bottom : calc(" + to.smartphone + " * 100%) } } " } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-banner-image-ratio' ) }) }) // banner title typography wp.customize( 'main_banner_design_post_title_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '.blogcast_font_typography .blogcast-main-banner-section .main-banner-wrap .post-elements .post-title' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-banner-title-typo' ) }) }) // banner excerpt typography wp.customize( 'main_banner_design_post_excerpt_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '.blogcast_font_typography .blogcast-main-banner-section .main-banner-wrap .post-elements .post-excerpt' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-banner-excerpt-typo' ) }) }) // banner categories typography wp.customize( 'main_banner_design_post_categories_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '.blogcast_font_typography .blogcast-main-banner-section .post-categories .cat-item a' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-banner-categories-typo' ) }) }) // banner date typography wp.customize( 'main_banner_design_post_date_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '.blogcast_font_typography .blogcast-main-banner-section .main-banner-wrap .post-elements .post-date' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-banner-date-typo' ) }) }) // banner date typography wp.customize( 'main_banner_design_post_author_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '.blogcast_font_typography .blogcast-main-banner-section .main-banner-wrap .post-elements .author' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-banner-author-typo' ) }) }) // carousel image ratio wp.customize( 'carousel_responsive_image_ratio', function( value ) { value.bind( function( to ) { var cssCode = '' if( to.desktop && to.desktop > 0 ) { cssCode += "body .blogcast-carousel-section article.post-item .post-thumb { padding-bottom : calc(" + to.desktop + " * 100%) } " } if( to.tablet && to.tablet > 0 ) { cssCode += "@media(max-width: 940px) { body .blogcast-carousel-section article.post-item .post-thumb { padding-bottom : calc(" + to.tablet + " * 100%) } } " } if( to.smartphone && to.smartphone > 0 ) { cssCode += "@media(max-width: 610px) { body .blogcast-carousel-section article.post-item .post-thumb { padding-bottom : calc(" + to.smartphone + " * 100%) } } " } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-carousel-image-ratio' ) }) }) // carousel title typography wp.customize( 'carousel_design_post_title_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '.blogcast_font_typography .blogcast-carousel-section .carousel-wrap .post-elements .post-title' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-carousel-title-typo' ) }) }) // carousel excerpt typography wp.customize( 'carousel_design_post_excerpt_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '.blogcast_font_typography .blogcast-carousel-section .carousel-wrap .post-elements .post-excerpt' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-carousel-excerpt-typo' ) }) }) // carousel categories typography wp.customize( 'carousel_design_post_categories_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '.blogcast_font_typography .blogcast-carousel-section .carousel-wrap .post-categories .cat-item a' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-carousel-categories-typo' ) }) }) // carousel date typography wp.customize( 'carousel_design_post_date_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '.blogcast_font_typography .blogcast-carousel-section .carousel-wrap .post-elements .post-date' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-carousel-date-typo' ) }) }) // carousel author typography wp.customize( 'carousel_design_post_author_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '.blogcast_font_typography .blogcast-carousel-section .carousel-wrap .post-elements .author' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-carousel-date-typo' ) }) }) // archive posts column wp.customize( 'archive_post_column', function( value ) { value.bind( function( to ) { if( to.desktop ) { $("body").removeClass( "archive-desktop-column--one archive-desktop-column--two archive-desktop-column--three" ) $("body").addClass( "archive-desktop-column--" + blogcast_get_numeric_string( to.desktop ) ) } if( to.tablet ) { $("body").removeClass( "archive-tablet-column--one archive-tablet-column--two archive-tablet-column--three" ) $("body").addClass( "archive-tablet-column--" + blogcast_get_numeric_string( to.tablet ) ) } if( to.smartphone ) { $("body").removeClass( "archive-mobile-column--one archive-mobile-column--two archive-mobile-column--three" ) $("body").addClass( "archive-mobile-column--" + blogcast_get_numeric_string( to.smartphone ) ) } }) }) // archive posts elements alignment wp.customize( 'archive_post_elements_alignment', function( value ) { value.bind( function( to ) { if( to ) { $("body.archive .blogcast-inner-content-wrap, body.blog .blogcast-inner-content-wrap, body.home .blogcast-inner-content-wrap, body.search .blogcast-inner-content-wrap").removeClass( "archive-align--left archive-align--center archive-align--right" ) $("body.archive .blogcast-inner-content-wrap, body.blog .blogcast-inner-content-wrap, body.home .blogcast-inner-content-wrap, body.search .blogcast-inner-content-wrap").addClass( "archive-align--" + to ) } }) }) // archive posts image ratio wp.customize( 'archive_responsive_image_ratio', function( value ) { value.bind( function( to ) { var cssCode = '' var selector = '--blogcast-post-image-ratio' if( to.desktop && to.desktop > 0 ) { cssCode += 'body { ' + selector + ': ' + to.desktop + ' }' } if( to.tablet && to.tablet > 0) { cssCode += 'body { ' + selector + '-tablet: ' + to.desktop + ' }' } if( to.smartphone && to.smartphone > 0 ) { cssCode += 'body { ' + selector + '-mobile: ' + to.desktop + ' }' } themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-posts-image-ratio' ) }) }) // archive button text wp.customize( 'archive_button_text', function( value ) { value.bind( function( to ) { $(".button-text").text(to) }) }) // archive title typo wp.customize( 'archive_title_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-post-title-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-title-typo' ) }) }) // archive excerpt typo wp.customize( 'archive_excerpt_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-post-content-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-excerpt-typo' ) }) }) // archive category typo wp.customize( 'archive_category_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-category-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-category-typo' ) }) }) // archive date typo wp.customize( 'archive_date_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-date-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-date-typo' ) }) }) // archive author typo wp.customize( 'archive_author_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-author-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-author-typo' ) }) }) // archive read time typo wp.customize( 'archive_read_time_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-readtime-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-read-time-typo' ) }) }) // archive comment typo wp.customize( 'archive_comment_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-comment-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-comment-typo' ) }) }) // archive button typo wp.customize( 'archive_button_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-readmore-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-readmore-typo' ) }) }) // archive category box typo wp.customize( 'archive_category_info_box_title_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.blogcast_font_typography.archive.category .page-header .page-title' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-category-page-title-typo' ) }) }) // archive category description typo wp.customize( 'archive_category_info_box_description_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.blogcast_font_typography.archive.category .page-header .archive-description' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-category-page-description-typo' ) }) }) // archive tag page title typo wp.customize( 'archive_tag_info_box_title_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.blogcast_font_typography.archive.tag .page-header .page-title' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-tag-page-title-typo' ) }) }) // archive tag page description typo wp.customize( 'archive_tag_info_box_description_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.blogcast_font_typography.archive.tag .page-header .archive-description' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-tag-page-description-typo' ) }) }) // archive author page title typo wp.customize( 'archive_author_info_box_title_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.blogcast_font_typography.archive.author .page-header .page-title' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-author-page-title-typo' ) }) }) // archive author page description typo wp.customize( 'archive_author_info_box_description_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.blogcast_font_typography.archive.author .page-header .archive-description' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-archive-author-page-description-typo' ) }) }) // single title typo wp.customize( 'single_title_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.single-post .site-main article .entry-title' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-single-title-typo' ) }) }) // single content typo wp.customize( 'single_content_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.single-post .site-main article .entry-content' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-single-content-typo' ) }) }) // single category typo wp.customize( 'single_category_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.single-post #primary article .post-categories .cat-item a' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-single-category-typo' ) }) }) // single date typo wp.customize( 'single_date_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.single-post #primary .blogcast-inner-content-wrap .post-meta .post-date' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-single-date-typo' ) }) }) // single author typo wp.customize( 'single_author_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.single-post .site-main article .post-meta-wrap .byline' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-single-author-typo' ) }) }) // single read time typo wp.customize( 'single_read_time_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.single-post #primary .blogcast-inner-content-wrap .post-meta .post-read-time' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-single-read-time-typo' ) }) }) // page title typo wp.customize( 'page_title_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.page #blogcast-main-wrap #primary article .entry-title' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-page-title-typo' ) }) }) // page content typo wp.customize( 'page_content_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body.page-template-default article .entry-content' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-page-content-typo' ) }) }) // heading one typo wp.customize( 'heading_one_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body article h1' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-heading-one-typo' ) }) }) // heading two typo wp.customize( 'heading_two_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body article h2' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-heading-two-typo' ) }) }) // heading three typo wp.customize( 'heading_three_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body article h3' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-heading-three-typo' ) }) }) // heading four typo wp.customize( 'heading_four_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body article h4' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-heading-four-typo' ) }) }) // heading five typo wp.customize( 'heading_five_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body article h5' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-heading-five-typo' ) }) }) // heading six typo wp.customize( 'heading_six_typo', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = 'body article h6' cssCode = themeCalls.blogcastGenerateTypoCssWithSelector(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-heading-six-typo' ) }) }) // sidebar block title typo wp.customize( 'sidebar_block_title_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-widget-block-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-sidebar-block-title-typo' ) }) }) // sidebar post title typo wp.customize( 'sidebar_post_title_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-widget-title-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-sidebar-post-title-typo' ) }) }) // sidebar post category typo wp.customize( 'sidebar_category_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-widget-category-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-sidebar-post-category-typo' ) }) }) // sidebar post date typo wp.customize( 'sidebar_date_typography', function( value ) { value.bind( function( to ) { ajaxFunctions.typoFontsEnqueue() var cssCode = '' var selector = '--blogcast-widget-date-font' cssCode = themeCalls.blogcastGenerateTypoCss(selector,to) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-sidebar-post-date-typo' ) }) }) // site title custom css wp.customize( 'site_title_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", ".site-branding-section" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-site-title-custom-css' ) } }) }) // social icon custom css wp.customize( 'social_icon_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", ".blogcast-social-icon" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-social-icon-custom-css' ) } }) }) // breadcrumb custom css wp.customize( 'breadcrumb_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", ".blogcast-breadcrumb-wrap" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-breadcrumb-custom-css' ) } }) }) // scroll to top custom css wp.customize( 'scroll_to_top_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", "#blogcast-scroll-to-top" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-scroll-to-top-custom-css' ) } }) }) // scroll to top custom css wp.customize( 'header_menu_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", "#site-navigation" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-header-menu-custom-css' ) } }) }) // header search custom css wp.customize( 'header_search_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", ".search-wrap" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-header-search-custom-css' ) } }) }) // header custom button custom css wp.customize( 'header_custom_button_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", ".header-custom-button" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-header-custom-button-custom-css' ) } }) }) // canvas menu custom css wp.customize( 'canvas_menu_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", ".blogcast-canvas-menu" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-canvas-menu-custom-css' ) } }) }) // main banner custom css wp.customize( 'main_banner_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", ".blogcast-main-banner-section" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-main-banner-custom-css' ) } }) }) // carousel custom css wp.customize( 'carousel_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", ".blogcast-carousel-section" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-carousel-custom-css' ) } }) }) // footer custom css wp.customize( 'footer_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", "footer#colophon" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-footer-custom-css' ) } }) }) // bottom footer custom css wp.customize( 'bottom_footer_custom_css', function( value ) { value.bind( function( to ) { if( to ) { var cssCode = '' cssCode += to.replace( "{wrapper}", ".bottom-footer" ) themeCalls.blogcastGenerateStyleTag( cssCode, 'blogcast-bottom-footer-custom-css' ) } }) }) // check if string is variable and formats function blogcast_get_color_format(color) { if( color.indexOf( '--blogcast-global-preset' ) != -1 ) { return( 'var( ' + color + ' )' ); } else { return color; } } // converts integer to string for attibutes value function blogcast_get_numeric_string(int) { switch( int ) { case 2: return "two"; break; case 3: return "three"; break; case 4: return "four"; break; case 5: return "five"; break; case 6: return "six"; break; default: return "one"; } } // constants const ajaxFunctions = { typoFontsEnqueue: function() { var action = themeContstants.prefix + "typography_fonts_url",id ="customizer-typo-fonts-css" themeCalls.blogcastGenerateLinkTag( action, id ) } } // constants const helperFunctions = { generateStyle: function(color, id, variable) { if(color) { if( id == 'theme-color-style' ) { var styleText = 'body { ' + variable + ': ' + blogcast_get_color_format(color) + '}'; } else { var styleText = 'body { ' + variable + ': ' + blogcast_get_color_format(color) + '}'; } if( $( "head #" + id ).length > 0 ) { $( "head #" + id).text( styleText ) } else { $( "head" ).append( '' ) } } } } }( jQuery ) );