 /**
   * The Customize Theme Script.
   *
   *
   * @package   serenity WordPress Theme
   * @copyright Copyright (C) 2015, OrdaSoft
   * @license  http://www.gnu.org/licenses/gpl-2.0.html  GNU General Public License v2 or later
   * @author    AUTHOR <www.ordasoft.com>
   * themeslug is distributed under the terms of the GNU GPL
   */
( function( $ ) {

//***********************General*********************
wp.customize( 'serenity_soc_facebook', function( value ) {
        value.bind( function( newval ) {
            $('.facebook').keypress( newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.theme-color').css('background', newval );
        } );
    } );

//----------------------Body font
    wp.customize( 'serenity_body_font', function( value ) {
        value.bind( function( newval ) {
            $('body').css('font-family', newval );
        } );
    } );

//-------------------Body font size
    wp.customize( 'serenity_font_size', function( value ) {
        value.bind( function( newval ) {
            $('body').css('font-size', newval+'px' );
        } );
    } );

//---------------------Body font color
    wp.customize( 'serenity_font_color', function( value ) {
        value.bind( function( newval ) {
            $('body').css('color', newval );
        } );
    } );

//----------------------Theme Color
    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.widget_title').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.theme-color').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.more-button').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.add_to_cart_button').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('input[type="submit"]').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.page-numbers').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.button').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.onsale').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('#wp-calendar caption').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.menu-item-has-children ul').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.shadow').css('text-shadow', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.desc').css('border-left-color', newval );
        } );
    } );

    wp.customize( 'serenity_theme_color', function( value ) {
        value.bind( function( newval ) {
            $('.menu-item:before').css('border-color', newval );
        } );
    } );

    wp.customize( 'serenity_custom_css', function( value ) {
        value.bind( function( newval ) {
          $( '#serenity-custom-css' ).html( newval );
        } );
      } );

    wp.customize( 'header_layout_home', function( value ) {
        value.bind( function( newval ) {
          $( '.header' ).html( newval );
        } );
      } );

//----------------------Body link size
    wp.customize( 'serenity_link_size', function( value ) {
        value.bind( function( newval ) {
            $('body a').css('font-size', newval );
        } );
    } );

//----------------------Body links color
    wp.customize( 'serenity_link_color', function( value ) {
        value.bind( function( newval ) {
            $('body a').css('color', newval );
        } );
    } );

//---------------Body link hover color
    wp.customize( 'serenity_link_hover_color', function( value ) {
        value.bind( function( newval ) {
            $('body a:hover').css('color', newval );
        } );
    } );

//------------------Body link decoration
    wp.customize( 'serenity_link_underline', function( value ) {
        value.bind( function( newval ) {
            $('body a').css('text-decoration', newval );
        } );
    } );

//--------------------Body link hover decoration
    wp.customize( 'serenity_link_underline_hover', function( value ) {
        value.bind( function( newval ) {
            $('body a:hover').css('text-decoration', newval );
        } );
    } );

//--------------------Custom CSS
    wp.customize( 'serenity_custom_css', function( value ) {
        value.bind( function( newval ) {
            $('body').text(' ', newval );
        } );
    } );


//--------------------Logo
    wp.customize( 'serenity_logo_img', function( value ) {
        value.bind( function( newval ) {
            $('body').html('img', newval );
        } );
    } );

    wp.customize( 'serenity_soc_size', function( value ) {
        value.bind( function( newval ) {
            $('#social a').css('font-size', newval );
        } );
    } );


//--------------------------------typography------------------------------------------

wp.customize( 'serenity_h1_font', function( value ) {
        value.bind( function( newval ) {
            $('body h1').css('font-family', newval );
        } );
    } );
wp.customize( 'serenity_h1_color', function( value ) {
        value.bind( function( newval ) {
            $('body h1').css('color', newval );
        } );
    } );

wp.customize( 'serenity_h2_font', function( value ) {
        value.bind( function( newval ) {
            $('body h2').css('font-family', newval );
        } );
    } );
wp.customize( 'serenity_h2_color', function( value ) {
        value.bind( function( newval ) {
            $('body h2').css('color', newval );
        } );
    } );

wp.customize( 'serenity_h3_font', function( value ) {
        value.bind( function( newval ) {
            $('body h3').css('font-family', newval );
        } );
    } );
wp.customize( 'serenity_h3_color', function( value ) {
        value.bind( function( newval ) {
            $('body h3').css('color', newval );
        } );
    } );

wp.customize( 'serenity_h4_font', function( value ) {
        value.bind( function( newval ) {
            $('body h4').css('font-family', newval );
        } );
    } );
wp.customize( 'serenity_h4_color', function( value ) {
        value.bind( function( newval ) {
            $('body h4').css('color', newval );
        } );
    } );

wp.customize( 'serenity_h5_font', function( value ) {
        value.bind( function( newval ) {
            $('body h5').css('font-family', newval );
        } );
    } );
wp.customize( 'serenity_h5_color', function( value ) {
        value.bind( function( newval ) {
            $('body h5').css('color', newval );
        } );
    } );

wp.customize( 'serenity_h6_font', function( value ) {
        value.bind( function( newval ) {
            $('body h6').css('font-family', newval );
        } );
    } );
wp.customize( 'serenity_h6_color', function( value ) {
        value.bind( function( newval ) {
            $('body h6').css('color', newval );
        } );
    } );


//-----------------------------menu-------------------------------------------
    wp.customize( 'serenity_menu_font', function( value ) {
        value.bind( function( newval ) {
            $('.nav-menu ul li a').css('font-family', newval );
        } );
    } );

    wp.customize( 'serenity_menu_font', function( value ) {
        value.bind( function( newval ) {
            $('#menu-menu li a').css('font-family', newval );
        } );
    } );

    wp.customize( 'serenity_menu_font_size', function( value ) {
        value.bind( function( newval ) {
            $('.nav-menu ul li a').css('font-size', newval+'px');
        } );
    } );

    wp.customize( 'serenity_menu_font_size', function( value ) {
        value.bind( function( newval ) {
            $('#menu-menu li a').css('font-size', newval+'px');
        } );
    } );

    wp.customize( 'serenity_menu_margin', function( value ) {
        value.bind( function( newval ) {
            $('.nav-menu ul li').css('margin', newval+'px');
        } );
    } );

    wp.customize( 'serenity_menu_margin', function( value ) {
        value.bind( function( newval ) {
            $('#menu-menu li').css('margin', newval+'px');
        } );
    } );

    wp.customize( 'serenity_menu_color', function( value ) {
        value.bind( function( newval ) {
            $('.nav-menu ul li a').css('color', newval );
        } );
    } );

    wp.customize( 'serenity_menu_hover_color', function( value ) {
        value.bind( function( newval ) {
            $('.nav-menu ul li a:hover').css('color', newval  );
        } );
    } );

    wp.customize( 'serenity_menu_underline', function( value ) {
        value.bind( function( newval ) {
            $('.nav-menu ul li a').css('text-decoration', newval  );
        } );
    } );

    wp.customize( 'serenity_menu_underline_hover', function( value ) {
        value.bind( function( newval ) {
            $('.nav-menu ul li a:hover').css('text-decoration', newval  );
        } );
    } );

    wp.customize( 'serenity_submenu_color', function( value ) {
        value.bind( function( newval ) {
            $('.children li a').css('color', newval  );
        } );
    } );

    wp.customize( 'serenity_submenu_hover_color', function( value ) {
        value.bind( function( newval ) {
            $('.children li a:hover').css('color', newval  );
        } );
    } );

//soc icons---------------------------------------------------------------------------------------------------------------------------------------------------

    wp.customize( 'serenity_soc_size', function( value ) {
        value.bind( function( newval ) {
            $('#social a').css('font-size', newval+'px' );
        } );
    } );

    wp.customize( 'serenity_soc_color', function( value ) {
        value.bind( function( newval ) {
            $('#social a').css('color', newval );
        } );
    } );

    wp.customize( 'serenity_soc_color_hover', function( value ) {
        value.bind( function( newval ) {
            $('#social a:hover').css('color', newval );
        } );
    } );



    wp.customize( 'serenity_home_width', function( value ) {
        value.bind( function( newval ) {
          $( '#content' ).removeClass("container").addClass( newval );
        } );
    } );


    wp.customize( 'serenity_products_column', function( value ) {
        value.bind( function( newval ) {
          $( 'div[row="one-product"]' ).removeClass().addClass( newval );
        } );
    } );

    wp.customize( 'serenity_shop_show', function( value ) {
        value.bind( function( newval ) {
          $( '#shop-section' ).attr( 'style', newval );
        } );
    } );

    wp.customize( 'serenity_any_section_show', function( value ) {
        value.bind( function( newval ) {
          $( '#any-section' ).attr( 'style', newval );
        } );
    } );

    wp.customize( 'serenity_content_show', function( value ) {
        value.bind( function( newval ) {
          $( '.page-content' ).attr( 'style', newval );
        } );
    } );

//--------------------------------Header text shw-------------------------------------------------

    wp.customize( 'serenity_header_text_show', function( value ) {
        value.bind( function( newval ) {
          $( '#plate' ).attr( 'style', newval );
        } );
    } );

    wp.customize( 'serenity_header_text1', function( value ) {
        value.bind( function( newval ) {
          $( '.text5' ).html( newval );
        } );
      } );

    wp.customize( 'serenity_header_text2', function( value ) {
        value.bind( function( newval ) {
          $( '.text1' ).html( newval );
        } );
      } );

    wp.customize( 'serenity_header_text3', function( value ) {
        value.bind( function( newval ) {
          $( '.text2' ).html( newval );
        } );
      } );

    wp.customize( 'serenity_header_text4', function( value ) {
        value.bind( function( newval ) {
          $( '.text3' ).html( newval );
        } );
      } );

    wp.customize( 'serenity_header_text5', function( value ) {
        value.bind( function( newval ) {
          $( '.text4' ).html( newval );
        } );
      } );

//-----------------------header layout -------------------------------------------------

    wp.customize( 'serenity_button_text', function( value ) {
        value.bind( function( newval ) {
          $( '.button-about' ).html( newval );
        } );
      } );

    wp.customize( 'serenity_more_button', function( value ) {
        value.bind( function( newval ) {
          $( '.more-button' ).html( newval );
        } );
      } );


    wp.customize( 'serenity_header_layout_home', function( value ) {
            value.bind( function( newval ) {
              $( '.header' ).attr("id", newval);
            } );
        } );

     wp.customize( 'serenity_home_blog_title', function( value ) {
        value.bind( function( newval ) {
          $( '.title' ).html( newval );
        } );
    } );

     wp.customize( 'serenity_home_blog_desc', function( value ) {
        value.bind( function( newval ) {
          $( '.title-desc' ).html( newval );
        } );
    } );

     wp.customize( 'serenity_home_shop_title', function( value ) {
        value.bind( function( newval ) {
          $( '.title' ).html( newval );
        } );
    } );

     wp.customize( 'serenity_home_shop_desc', function( value ) {
        value.bind( function( newval ) {
          $( '.title-desc' ).html( newval );
        } );
    } );

     wp.customize( 'serenity_any_section_title', function( value ) {
        value.bind( function( newval ) {
          $( '.title' ).html( newval );
        } );
    } );

     wp.customize( 'serenity_any_section_desc', function( value ) {
        value.bind( function( newval ) {
          $( '.title-desc' ).html( newval );
        } );
    } );


    //Footer-------------------

    wp.customize( 'serenity_footer_background', function( value ) {
        value.bind( function( newval ) {
            $('.site-footer').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_copyright_text', function( value ) {
        value.bind( function( newval ) {
            $('.site-footer').css('background', newval );
        } );
    } );

    wp.customize( 'serenity_copyright_font', function( value ) {
        value.bind( function( newval ) {
            $('#copyright p').css('font-family', newval );
        } );
    } );

    wp.customize( 'serenity_copyright_font', function( value ) {
        value.bind( function( newval ) {
            $('#copyright a').css('font-family', newval );
        } );
    } );

    wp.customize( 'serenity_copyright_font_size', function( value ) {
        value.bind( function( newval ) {
            $('#copyright a').css('font-size', newval+'px' );
        } );
    } );

    wp.customize( 'serenity_copyright_font_size', function( value ) {
        value.bind( function( newval ) {
            $('#copyright p').css('font-size', newval+'px' );
        } );
    } );

    wp.customize( 'serenity_copyright_color', function( value ) {
        value.bind( function( newval ) {
            $('#copyright p').css('color', newval );
        } );
    } );

    wp.customize( 'serenity_copyright_color', function( value ) {
        value.bind( function( newval ) {
            $('#copyright a').css('color', newval );
        } );
    } );

    wp.customize( 'serenity_copyright_hover_color', function( value ) {
        value.bind( function( newval ) {
            $('#copyright a:hover').css('color', newval );
        } );
    } );

    wp.customize( 'serenity_copyright_underline', function( value ) {
        value.bind( function( newval ) {
            $('#copyright a').css('text-decoration', newval );
        } );
    } );

    wp.customize( 'serenity_copyright_underline_hover', function( value ) {
        value.bind( function( newval ) {
            $('#copyright a:hover').css('text-decoration', newval );
        } );
    } );

    wp.customize( 'serenity_copyright_text', function( value ) {
        value.bind( function( newval ) {
          $( '#copyright p' ).html( newval );
        } );
    } );


} )( jQuery );

