WordPress.org

Plugin Directory

Changeset 621453


Ignore:
Timestamp:
11/05/12 22:17:29 (18 months ago)
Author:
jblz
Message:

Jetpack: Load all Notifications Javascript in the head to avoid issues with head.js and other resource optimization plugins

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/notes.php

    r618676 r621453  
    7373        if ( !has_filter( 'show_admin_bar', '__return_true' ) && !is_user_logged_in() ) 
    7474            return; 
     75        add_action( 'admin_bar_menu', array( &$this, 'admin_bar_menu'), 120 ); 
     76        add_action( 'wp_head', array( &$this, 'styles_and_scripts') ); 
     77        add_action( 'admin_head', array( &$this, 'styles_and_scripts') ); 
     78    } 
     79 
     80    function styles_and_scripts() { 
    7581        wp_enqueue_style( 'notes-admin-bar-rest', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/admin-bar-rest.css' ), array(), JETPACK_NOTES__CACHE_BUSTER ); 
    7682        wp_enqueue_style( 'noticons', $this->wpcom_static_url( '/i/noticons/noticons.css' ), array(), JETPACK_NOTES__CACHE_BUSTER ); 
     83 
     84        $this->print_js(); 
    7785        wp_enqueue_script( 'spin', $this->wpcom_static_url( '/wp-includes/js/spin.js' ), array( 'jquery' ), JETPACK_NOTES__CACHE_BUSTER ); 
    7886        wp_enqueue_script( 'jquery.spin', $this->wpcom_static_url( '/wp-includes/js/jquery/jquery.spin.js' ), array( 'jquery', 'spin' ), JETPACK_NOTES__CACHE_BUSTER ); 
    79         wp_enqueue_script( 'notes-postmessage', $this->wpcom_static_url( '/wp-content/js/postmessage.js' ), array(), JETPACK_NOTES__CACHE_BUSTER, true ); 
    80         wp_enqueue_script( 'mustache', $this->wpcom_static_url( '/wp-content/js/mustache.js' ), null, JETPACK_NOTES__CACHE_BUSTER, true ); 
    81         wp_enqueue_script( 'underscore', $this->wpcom_static_url( '/wp-content/js/underscore.js' ), null, JETPACK_NOTES__CACHE_BUSTER, true ); 
    82         wp_enqueue_script( 'backbone', $this->wpcom_static_url( '/wp-content/js/backbone.js' ), array( 'jquery', 'underscore' ), JETPACK_NOTES__CACHE_BUSTER, true ); 
    83         wp_enqueue_script( 'notes-rest-common', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/notes-rest-common.js' ), array( 'backbone', 'mustache' ), JETPACK_NOTES__CACHE_BUSTER, true ); 
    84         wp_enqueue_script( 'notes-admin-bar-rest', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/admin-bar-rest.js' ), array( 'jquery', 'underscore', 'backbone' ), JETPACK_NOTES__CACHE_BUSTER, true ); 
    85         add_action( 'admin_bar_menu', array( &$this, 'admin_bar_menu'), 120 ); 
    86         add_action( 'wp_print_scripts', array( &$this, 'print_js'), 0 ); 
     87        wp_enqueue_script( 'notes-postmessage', $this->wpcom_static_url( '/wp-content/js/postmessage.js' ), array(), JETPACK_NOTES__CACHE_BUSTER ); 
     88        wp_enqueue_script( 'mustache', $this->wpcom_static_url( '/wp-content/js/mustache.js' ), null, JETPACK_NOTES__CACHE_BUSTER ); 
     89        wp_enqueue_script( 'underscore', $this->wpcom_static_url( '/wp-content/js/underscore.js' ), null, JETPACK_NOTES__CACHE_BUSTER ); 
     90        wp_enqueue_script( 'backbone', $this->wpcom_static_url( '/wp-content/js/backbone.js' ), array( 'jquery', 'underscore' ), JETPACK_NOTES__CACHE_BUSTER ); 
     91        wp_enqueue_script( 'notes-rest-common', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/notes-rest-common.js' ), array( 'backbone', 'mustache' ), JETPACK_NOTES__CACHE_BUSTER ); 
     92        wp_enqueue_script( 'notes-admin-bar-rest', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/admin-bar-rest.js' ), array( 'jquery', 'underscore', 'backbone' ), JETPACK_NOTES__CACHE_BUSTER ); 
    8793    } 
    8894 
Note: See TracChangeset for help on using the changeset viewer.