Skip to content

Commit 56dfebc

Browse files
committed
Only add js-cookie to dependencies array conditionally.
1 parent 000caf5 commit 56dfebc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/ableplayer.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ function ableplayer_plugin_deactivated() {
4848
* Load styles and scripts to head.
4949
*/
5050
function ableplayer_enqueue_scripts() {
51-
$debug = ( SCRIPT_DEBUG || ABLEPLAYER_DEBUG ) ? true : false;
52-
$version = ABLEPLAYER_VERSION;
53-
$version = ( $debug ) ? $version . '-' . wp_rand( 1000, 9999 ) : $version;
51+
$debug = ( SCRIPT_DEBUG || ABLEPLAYER_DEBUG ) ? true : false;
52+
$version = ABLEPLAYER_VERSION;
53+
$version = ( $debug ) ? $version . '-' . wp_rand( 1000, 9999 ) : $version;
54+
$dependencies = array( 'jquery', 'ableplayer-video' );
55+
5456
// Register/enqueue other dependencies.
5557
if ( 'true' === ableplayer_get_settings( 'cookies' ) ) {
5658
$cookie_js = ( $debug ) ? '/js.cookie.js' : '/js.cookie.min.js';
5759
wp_enqueue_script( 'js-cookie', plugins_url( 'thirdparty', __FILE__ ) . $cookie_js, array(), $version, true );
60+
$dependencies = array( 'js-cookie', 'jquery', 'ableplayer-video' );
5861
}
5962
if ( 'true' === ableplayer_get_settings( 'vimeo' ) ) {
6063
wp_enqueue_script( 'vimeo', 'https://player.vimeo.com/api/player.js', array(), $version, true );
@@ -106,7 +109,6 @@ function ableplayer_enqueue_scripts() {
106109
*/
107110
$css_dir = apply_filters( 'able_player_css', plugins_url( '', __FILE__ ) . '/' . $css_file, $debug );
108111

109-
$dependencies = array( 'js-cookie', 'jquery', 'ableplayer-video' );
110112
/**
111113
* Filter the Able Player script dependencies.
112114
*

0 commit comments

Comments
 (0)