Making WordPress.org


Ignore:
Timestamp:
03/20/2015 12:10:03 AM (11 years ago)
Author:
obenland
Message:

WP.org Themes: Consolidate JS handler.

Removes the dependency on the theme-install JS, as well as 4 unnecessary
requests each pageload.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php

    r1416 r1434  
    4141
    4242    if ( ! is_singular( 'page' ) ) {
    43         wp_enqueue_script( 'google-jsapi', '//www.google.com/jsapi', array( 'jquery' ), null );
     43        wp_enqueue_script( 'google-jsapi', '//www.google.com/jsapi', array( 'jquery' ), null, true );
     44        wp_enqueue_script( 'wporg-theme', get_template_directory_uri() . '/js/theme.js', array( 'wp-backbone' ), filemtime( __DIR__ . '/js/theme.js' ), true );
    4445
    45         wp_enqueue_script( 'theme', self_admin_url( 'js/theme.js' ), array( 'wp-backbone' ), false, true );
    46         wp_enqueue_script( 'wporg-theme', get_template_directory_uri() . '/js/theme.js', array( 'theme' ), filemtime( __DIR__ . '/js/theme.js' ), true );
    47 
    48         wp_localize_script( 'theme', '_wpThemeSettings', array(
     46        wp_localize_script( 'wporg-theme', '_wpThemeSettings', array(
    4947            'themes'   => false,
    5048            'query'    => wporg_themes_prepare_themes_for_js(),
    5149            'settings' => array(
    52                 'title'      => __( 'WordPress › %s « Free WordPress Themes', 'wporg-themes' ),
    53                 'isMobile'   => wp_is_mobile(),
    54                 'isInstall'  => true,
    55                 'canInstall' => false,
    56                 'installURI' => null,
    57                 'adminUrl'   => trailingslashit( parse_url( home_url(), PHP_URL_PATH ) ),
     50                'title'        => __( 'WordPress › %s « Free WordPress Themes', 'wporg-themes' ),
     51                'isMobile'     => wp_is_mobile(),
     52                'postsPerPage' => get_option( 'posts_per_page', 15 ),
     53                'path'         => trailingslashit( parse_url( home_url(), PHP_URL_PATH ) ),
    5854            ),
    5955            'l10n' => array(
    60                 'addNew'            => __( 'Add New Theme' ),
    61                 'search'            => __( 'Search Themes' ),
    62                 'searchPlaceholder' => __( 'Search themes...' ), // placeholder (no ellipsis)
    63                 'upload'            => __( 'Upload Theme' ),
    64                 'back'              => __( 'Back' ),
     56                'search'            => __( 'Search Themes', 'wporg-themes' ),
     57                'searchPlaceholder' => __( 'Search themes...', 'wporg-themes' ), // placeholder (no ellipsis)
    6558                'error'             => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ),
    6659
    6760                // Downloads Graph
    68                 'date'      => __( 'Date' ),
    69                 'downloads' => __( 'Downloads' ),
     61                'date'      => __( 'Date', 'wporg-themes' ),
     62                'downloads' => __( 'Downloads', 'wporg-themes' ),
    7063            ),
    71             'installedThemes' => array(),
    7264        ) );
    7365    }
     66
     67    // No emoji support needed.
     68    remove_action( 'wp_print_styles','print_emoji_styles' );
     69    wp_dequeue_script( 'emoji' );
     70
     71    // No Jetpack styles needed.
     72    add_filter( 'jetpack_implode_frontend_css', '__return_false' );
    7473}
    7574add_action( 'wp_enqueue_scripts', 'wporg_themes_scripts' );
Note: See TracChangeset for help on using the changeset viewer.