Making WordPress.org

Changeset 7439


Ignore:
Timestamp:
07/12/2018 05:49:22 PM (7 years ago)
Author:
obenland
Message:

Plugins: Update jQuery dependencies.

Properly specifies dependencies, removes unused script, and refrains from using CDN on sandboxes.

See [7436], [7437].

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins
Files:
2 edited

Legend:

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

    r7437 r7439  
    6363    wp_style_add_data( 'wporg-style', 'rtl', 'replace' );
    6464
     65    // Make jQuery a footer script.
     66    wp_scripts()->add_data( 'jquery', 'group', 1 );
     67    wp_scripts()->add_data( 'jquery-core', 'group', 1 );
     68    wp_scripts()->add_data( 'jquery-migrate', 'group', 1 );
     69
    6570    wp_enqueue_script( 'wporg-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
    6671    wp_enqueue_script( 'wporg-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
    6772
    6873    if ( is_singular( 'plugin' ) ) {
    69         wp_enqueue_script( 'wporg-plugins-popover', get_stylesheet_directory_uri() . '/js/popover.js', array(), '20171002', true );
     74        wp_enqueue_script( 'wporg-plugins-popover', get_stylesheet_directory_uri() . '/js/popover.js', array( 'jquery' ), '20171002', true );
    7075        wp_enqueue_script( 'wporg-plugins-faq', get_stylesheet_directory_uri() . '/js/section-faq.js', array( 'jquery' ), '20180131', true );
    7176    }
    7277
    7378    if ( ! is_404() ) {
    74         wp_enqueue_script( 'wporg-plugins-locale-banner', get_stylesheet_directory_uri() . '/js/locale-banner.js', array(), '20171116', true );
     79        wp_enqueue_script( 'wporg-plugins-locale-banner', get_stylesheet_directory_uri() . '/js/locale-banner.js', array( 'jquery' ), '20171116', true );
    7580        wp_localize_script( 'wporg-plugins-locale-banner', 'wporgLocaleBanner', array(
    7681            'apiURL'        => rest_url( '/plugins/v1/locale-banner' ),
     
    120125    add_filter( 'jetpack_implode_frontend_css', '__return_false' );
    121126    wp_dequeue_script( 'devicepx' );
     127    wp_register_script( 'grofiles-cards', false );
     128    wp_enqueue_script( 'grofiles-cards' );
    122129}
    123130add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\scripts' );
     
    134141        'dashicons',
    135142        'wp-embed',
     143        'jquery-core',
     144        'jquery-migrate',
    136145        'wporg-style',
    137146        'wporg-navigation',
     
    144153    ];
    145154
    146     if ( false === strpos( home_url(), 'wordpress.org' ) ) {
     155    if ( defined( 'WPORG_SANDBOXED' ) && WPORG_SANDBOXED ) {
    147156        return $src;
    148157    }
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php

    r6541 r7439  
    8585        </span>
    8686        </a>
    87         <script>
    88             jQuery( '.plugin-favorite-heart' )
     87    </div>
     88    <?php
     89        wp_add_inline_script(
     90            'wporg-plugins-faq',
     91            "jQuery( '.plugin-favorite-heart' )
    8992                .on( 'click touchstart animationend', function () {
    9093                    jQuery( this ).toggleClass( 'is-animating' );
     
    9295                .on( 'click', function () {
    9396                    jQuery( this ).toggleClass( 'favorited' );
    94                 } );
    95         </script>
    96     </div>
    97     <?php
     97                } );"
     98        );
    9899}
    99100
Note: See TracChangeset for help on using the changeset viewer.