<?php

/**
 * mykd_scripts description
 * @return [type] [description]
 */
function mykd_scripts() {

    /**
     * ALL CSS FILES
    */
    wp_enqueue_style('xotric-fonts', MYKD_THEME_CSS_DIR . 'mykd-fonts.css', []);
    if( is_rtl() ){
        wp_enqueue_style( 'bootstrap-rtl', MYKD_THEME_CSS_DIR.'bootstrap.rtl.min.css', array() );
    }else{
        wp_enqueue_style( 'bootstrap', MYKD_THEME_CSS_DIR.'bootstrap.min.css', array() );
    }
    wp_enqueue_style( 'mykd-animate', MYKD_THEME_CSS_DIR . 'animate.min.css', [] );
    wp_enqueue_style( 'magnific-popup', MYKD_THEME_CSS_DIR . 'magnific-popup.css', [] );
    wp_enqueue_style( 'font-awesome-free', MYKD_THEME_CSS_DIR . 'fontawesome-all.min.css', [] );
    wp_enqueue_style( 'swiper-bundle', MYKD_THEME_CSS_DIR . 'swiper-bundle.css', [] );
    wp_enqueue_style( 'tg-cursor', MYKD_THEME_CSS_DIR . 'tg-cursor.css', [] );
    wp_enqueue_style( 'odometer', MYKD_THEME_CSS_DIR . 'odometer.css', [] );
    wp_enqueue_style( 'slick', MYKD_THEME_CSS_DIR . 'slick.css', [] );
    wp_enqueue_style( 'flaticon', MYKD_THEME_CSS_DIR . 'flaticon.css', [] );
    wp_enqueue_style( 'mykd-spacing', MYKD_THEME_CSS_DIR . 'spacing.css', [] );
    wp_enqueue_style( 'mykd-core', MYKD_THEME_CSS_DIR . 'mykd-core.css', [] );
    wp_enqueue_style( 'mykd-unit', MYKD_THEME_CSS_DIR . 'mykd-unit.css', [] );
    wp_enqueue_style( 'mykd-woo', MYKD_THEME_CSS_DIR . 'mykd-woo.css', [] );
    wp_enqueue_style( 'mykd-style', get_stylesheet_uri() );


    // ALL JS FILES
    $mykd_preloader = get_theme_mod('mykd_preloader', false);
    if (!empty($mykd_preloader)) {
        wp_enqueue_script('tg-page-head', MYKD_THEME_JS_DIR . 'tg-page-head.js', ['jquery'], '', false);
    }
    wp_enqueue_script( 'bootstrap-bundle', MYKD_THEME_JS_DIR . 'bootstrap.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'magnific-popup', MYKD_THEME_JS_DIR . 'jquery.magnific-popup.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'isotope', MYKD_THEME_JS_DIR . 'isotope.pkgd.min.js', [ 'imagesloaded' ], '', true );
    wp_enqueue_script( 'countdown', MYKD_THEME_JS_DIR . 'jquery.countdown.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'waypoints', MYKD_THEME_JS_DIR . 'jquery.waypoints.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'odometer', MYKD_THEME_JS_DIR . 'jquery.odometer.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'simpleParallax', MYKD_THEME_JS_DIR . 'simpleParallax.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'gsap', MYKD_THEME_JS_DIR . 'gsap.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'scrollTrigger', MYKD_THEME_JS_DIR . 'scrollTrigger.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'splitText', MYKD_THEME_JS_DIR . 'splitText.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'appear', MYKD_THEME_JS_DIR . 'jquery.appear.js', [ 'jquery' ], '', true );
    $mykd_cursor_mode = get_theme_mod('mykd_cursor_mode', false);
    if (!empty($mykd_cursor_mode)) {
        wp_enqueue_script( 'tg-cursor', MYKD_THEME_JS_DIR . 'tg-cursor.min.js', [ 'jquery' ], '', true );
    };
    wp_enqueue_script( 'swiper-bundle', MYKD_THEME_JS_DIR . 'swiper-bundle.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'jarallax', MYKD_THEME_JS_DIR . 'jarallax.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'slick', MYKD_THEME_JS_DIR . 'slick.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'slick-animation', MYKD_THEME_JS_DIR . 'slick-animation.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'vivus', MYKD_THEME_JS_DIR . 'vivus.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'wow', MYKD_THEME_JS_DIR . 'wow.min.js', [ 'jquery' ], '', true );
    wp_enqueue_script( 'mykd-main', MYKD_THEME_JS_DIR . 'main.js', [ 'jquery' ], false, true );

    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
        wp_enqueue_script( 'comment-reply' );
    }
}
add_action( 'wp_enqueue_scripts', 'mykd_scripts' );