| @@ -16,9 +16,9 @@ | ||
| 16 | 16 | |
| 17 | 17 | use Automattic\Jetpack\Connection\Manager as Connection_Manager; |
| 18 | 18 | |
| 19 | 19 | if ( ! defined( 'JETPACK_NOTES__CACHE_BUSTER' ) ) { |
| 20 | - define( 'JETPACK_NOTES__CACHE_BUSTER', JETPACK__VERSION . '-' . gmdate( 'oW' ) . '-lite' ); | |
| 20 | + define( 'JETPACK_NOTES__CACHE_BUSTER', JETPACK__VERSION . '-' . gmdate( 'oW' ) ); | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Notifications class. |
| @@ -129,11 +129,28 @@ | ||
| 129 | 129 | wp_enqueue_style( 'noticons', $this->wpcom_static_url( '/i/noticons/noticons.css' ), array( 'wpcom-notes-admin-bar' ), JETPACK_NOTES__CACHE_BUSTER ); |
| 130 | 130 | |
| 131 | 131 | $this->print_js(); |
| 132 | 132 | |
| 133 | + // attempt to use core or plugin libraries if registered. | |
| 133 | 134 | $script_handles = array(); |
| 134 | - wp_register_script( 'wpcom-notes-common', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/notes-common-lite.min.js' ), array(), JETPACK_NOTES__CACHE_BUSTER, true ); | |
| 135 | + if ( ! wp_script_is( 'mustache', 'registered' ) ) { | |
| 136 | + wp_register_script( 'mustache', $this->wpcom_static_url( '/wp-content/js/mustache.js' ), null, JETPACK_NOTES__CACHE_BUSTER, true ); | |
| 137 | + } | |
| 138 | + $script_handles[] = 'mustache'; | |
| 139 | + if ( ! wp_script_is( 'underscore', 'registered' ) ) { | |
| 140 | + wp_register_script( 'underscore', $this->wpcom_static_url( '/wp-includes/js/underscore.min.js' ), null, JETPACK_NOTES__CACHE_BUSTER, true ); | |
| 141 | + } | |
| 142 | + $script_handles[] = 'underscore'; | |
| 143 | + if ( ! wp_script_is( 'backbone', 'registered' ) ) { | |
| 144 | + wp_register_script( 'backbone', $this->wpcom_static_url( '/wp-includes/js/backbone.min.js' ), array( 'underscore' ), JETPACK_NOTES__CACHE_BUSTER, true ); | |
| 145 | + } | |
| 146 | + $script_handles[] = 'backbone'; | |
| 147 | + | |
| 148 | + wp_register_script( 'wpcom-notes-common', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/notes-common-v2.js' ), array( 'jquery', 'underscore', 'backbone', 'mustache' ), JETPACK_NOTES__CACHE_BUSTER, true ); | |
| 135 | 149 | $script_handles[] = 'wpcom-notes-common'; |
| 150 | + $script_handles[] = 'jquery'; | |
| 151 | + $script_handles[] = 'jquery-migrate'; | |
| 152 | + $script_handles[] = 'jquery-core'; | |
| 136 | 153 | wp_enqueue_script( 'wpcom-notes-admin-bar', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/admin-bar-v2.js' ), array( 'wpcom-notes-common' ), JETPACK_NOTES__CACHE_BUSTER, true ); |
| 137 | 154 | $script_handles[] = 'wpcom-notes-admin-bar'; |
| 138 | 155 | |
| 139 | 156 | if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) { |