123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <?php
- /**
- * JavaScript and CSS files.
- *
- * @package Pen
- */
- if ( ! defined( 'ABSPATH' ) ) {
- exit;
- }
- if ( ! function_exists( 'pen_assets' ) ) {
- /**
- * Enqueue scripts and styles.
- */
- function pen_assets() {
- $theme_directory = "//cdn.yoqi.me/blog/wp-content/themes/pen";
- $css_files = array(
- 'normalize' => '/assets/css/normalize.css',
- 'animate' => '/assets/css/plugins/animate.css',
- 'slicknav' => '/assets/css/plugins/jquery.slicknav.css',
- 'base' => '/assets/css/pen-base.css',
- 'fonts' => '/assets/css/pen-fonts.css',
- 'typography' => '/assets/css/pen-typography.css',
- 'layout' => '/assets/css/pen-layout.css',
- 'buttons' => '/assets/css/pen-buttons.css',
- 'bottom' => '/assets/css/pen-bottom.css',
- 'comments' => '/assets/css/pen-comments.css',
- 'footer' => '/assets/css/pen-footer.css',
- 'header' => '/assets/css/pen-header.css',
- 'menus' => '/assets/css/pen-menus.css',
- 'navigation' => '/assets/css/pen-navigation.css',
- 'forms' => '/assets/css/pen-forms.css',
- 'content' => '/assets/css/pen-content.css',
- 'thumbnails' => '/assets/css/pen-thumbnails.css',
- 'author' => '/assets/css/pen-author.css',
- 'pagination' => '/assets/css/pen-pagination.css',
- 'share' => '/assets/css/pen-share.css',
- 'search-bar' => '/assets/css/pen-search-bar.css',
- 'top' => '/assets/css/pen-top.css',
- 'widgets' => '/assets/css/pen-widgets.css',
- );
- // The key has to be the same as the slug in the inline CSS of the customize.php file.
- $css_files['css'] = '/assets/css/pen-general.css';
- if ( file_exists( $theme_directory . '/assets/css/custom.css' ) ) {
- $css_files['custom'] = '/assets/css/custom.css';
- }
- // foreach ( $css_files as $key => $value ) {
- // wp_enqueue_style( 'pen-' . $key, $theme_directory . $value, array(), PEN_THEME_VERSION );
- // }
- wp_enqueue_style( 'pen-css', $theme_directory . "/dist/css/pan-4af3e60461.min.css", array(), PEN_THEME_VERSION );
- //wp_enqueue_script( 'jquery-fittext', $theme_directory . '/assets/js/plugins/jquery.fittext.js', array( 'jquery' ), '1.2', true );
- //wp_enqueue_script( 'autosize', $theme_directory . '/assets/js/plugins/autosize.js', array(), '4.0', true );
- //wp_enqueue_script( 'respond', $theme_directory . '/assets/js/plugins/respond.js', array( 'jquery' ), '1.4.2', true );
- //wp_enqueue_script( 'pen-skip', $theme_directory . '/assets/js/skip-link-focus-fix.js', array( 'jquery' ), PEN_THEME_VERSION, true );
- wp_enqueue_script( 'pen-js', $theme_directory . '/dist/js/pan-3480f10a61.min.js', array(), '3.7.3', false );
- if ( is_singular() ) {
- wp_enqueue_script( 'comment-reply' );
- }
- ob_start( 'pen_compress_html' );
- get_template_part( 'partials/site', 'navigation' );
- $navigation_easing = array();
- $navigation = ob_get_clean();
- if ( $navigation ) {
- wp_enqueue_script( 'hoverIntent' );
- wp_enqueue_script( 'jquery-superfish', $theme_directory . '/assets/js/plugins/jquery.superfish.js', array( 'jquery' ), '1.7.9', true );
- wp_enqueue_script( 'jquery-slicknav', $theme_directory . '/assets/js/plugins/jquery.slicknav.js', array( 'jquery' ), '1.0.10', true );
- $easing = pen_option_get( 'navigation_easing' );
- if ( $easing ) {
- wp_enqueue_script( 'jquery-easing', $theme_directory . '/assets/js/plugins/jquery.easing.js', array( 'jquery' ), '1.3', true );
- $navigation_easing = array(
- 'height' => array( 'show', $easing ),
- );
- }
- }
- wp_enqueue_script( 'jquery-waypoints', $theme_directory . '/assets/js/plugins/jquery.waypoints.js', array( 'jquery' ), '4.0.1', true );
- $content_list_type = pen_list_type();
- if ( 'masonry' === $content_list_type ) {
- wp_enqueue_script( 'imagesloaded' );
- wp_enqueue_script( 'masonry' );
- }
- wp_enqueue_script( 'pen-modernizr', $theme_directory . '/assets/js/plugins/modernizr.js', array(), '3.6', true );
- $site_background_effect = pen_option_get( 'color_site_background_effect' );
- $trianglify = false;
- $trianglify_colors = false;
- if ( 'trianglify' === $site_background_effect ) {
- $trianglify = true;
- /**
- * Dear WP.org reviewer,
- * Base64 is required to generate a DataURI for a SVG background.
- * We can remove this feature entirely if you don't like it?
- */
- wp_enqueue_script( 'base64', $theme_directory . '/assets/js/plugins/base64.js', array( 'jquery' ), PEN_THEME_VERSION, true );
- $trianglify_colors = array(
- pen_option_get( 'color_site_background' ),
- pen_option_get( 'color_button_background_primary' ),
- pen_option_get( 'color_button_background_secondary' ),
- pen_option_get( 'color_header_background_primary' ),
- pen_option_get( 'color_header_background_secondary' ),
- pen_option_get( 'color_navigation_background_primary' ),
- pen_option_get( 'color_navigation_background_secondary' ),
- );
- wp_enqueue_script( 'trianglify', $theme_directory . '/assets/js/plugins/trianglify.js', array( 'jquery', 'base64' ), '2.0.0', true );
- }
- $shards = false;
- $shards_colors = false;
- if ( 'shards' === $site_background_effect ) {
- $shards = true;
- $site_background = new \Pen\Color( pen_option_get( 'color_site_background' ) );
- $site_background = array_values( $site_background->getRgb() );
- $site_background[] = 0.25;
- $header_background_primary = new \Pen\Color( pen_option_get( 'color_header_background_primary' ) );
- $header_background_primary = array_values( $header_background_primary->getRgb() );
- $header_background_primary[] = 0.25;
- $shards_colors = array(
- $site_background,
- $header_background_primary,
- );
- wp_enqueue_script( 'shards', $theme_directory . '/assets/js/plugins/shards.js', array( 'jquery' ), '1.1', true );
- }
- wp_enqueue_script(
- 'pen-js',
- $theme_directory . '/assets/js/pen-scripts.js',
- array_filter(
- array(
- 'jquery',
- 'jquery-masonry',
- $shards ? 'shards' : '',
- $trianglify ? 'trianglify' : '',
- )
- ),
- PEN_THEME_VERSION,
- true
- );
- wp_localize_script(
- 'pen-js',
- 'pen_js',
- array(
- 'header_sticky' => pen_option_get( 'header_sticky' ),
- 'list_type' => $content_list_type,
- 'trianglify_colors' => $trianglify_colors,
- 'shards_colors' => $shards_colors,
- 'navigation_arrows' => pen_option_get( 'navigation_arrows' ) ? true : false,
- 'navigation_easing' => $navigation_easing,
- 'navigation_mobile' => pen_option_get( 'navigation_mobile_display' ) ? true : false,
- 'animation_comments' => pen_option_get( 'comments_animation_reveal' ),
- 'animation_navigation_speed' => pen_option_get( 'navigation_animation_speed' ),
- 'animation_list' => pen_option_get( 'list_animation_reveal' ),
- 'animation_list_thumbnails' => pen_option_get( 'list_thumbnail_animation_reveal' ),
- 'animation_content' => pen_option_get( 'content_animation_reveal' ),
- 'animation_content_thumbnails' => pen_option_get( 'content_thumbnail_animation_reveal' ),
- /* phpcs:disable */
- 'font_resize' => array(
- 'site_title' => pen_option_get( 'font_resize_sitetitle' ),
- ),
- 'text' => array(
- 'pen_theme' => __( 'Pen', 'pen' ),
- 'loading' => __( 'Loading...', 'pen' ),
- 'enter_keyword' => __( 'Please enter some keywords.', 'pen' ),
- 'close' => __( 'Close', 'pen' ),
- 'menu' => __( 'Menu', 'pen' ),
- 'overview_options_post' => __( 'Content settings overview', 'pen' ),
- 'expand_collapse' => __( 'Expand\Collapse', 'pen' ),
- 'theme_specific' => __( "This is a part of the 'Pen' theme, so if you switch to another theme this nice little editing tool will be no longer available.", 'pen' ),
- ),
- /* phpcs:enable */
- )
- );
- if ( file_exists( $theme_directory . '/assets/js/custom.js' ) ) {
- wp_enqueue_script( 'pen-custom', $theme_directory . '/assets/js/custom.js', array( 'jquery' ), PEN_THEME_VERSION, true );
- }
- wp_enqueue_script( 'html5shiv', $theme_directory . '/assets/js/plugins/html5.js', array(), '3.7.3', false );
- wp_script_add_data( 'html5shiv', 'conditional', 'lt IE 9' );
- }
- add_action( 'wp_enqueue_scripts', 'pen_assets' );
- }
|