|
73 | 73 | * Load styles and scripts to head. |
74 | 74 | */ |
75 | 75 | function ableplayer_enqueue_scripts() { |
| 76 | + $version = ABLEPLAYER_VERSION; |
| 77 | + $version = ( SCRIPT_DEBUG ) ? $version . '-' . wp_rand( 1000,9999 ) : $version; |
76 | 78 | // Register/enqueue other dependencies. |
77 | | - wp_enqueue_script( 'js-cookie', plugins_url( 'thirdparty', __FILE__ ) . '/js.cookie.js', array( 'jquery' ), ABLEPLAYER_VERSION, true ); |
78 | | - wp_enqueue_script( 'vimeo', 'https://player.vimeo.com/api/player.js', array(), ABLEPLAYER_VERSION, true ); |
79 | | - wp_register_script( 'ableplayer-video', plugins_url( 'assets', __FILE__ ) . '/js/media.js', array(), ABLEPLAYER_VERSION, true ); |
| 79 | + wp_enqueue_script( 'js-cookie', plugins_url( 'thirdparty', __FILE__ ) . '/js.cookie.js', array( 'jquery' ), $version, true ); |
| 80 | + wp_enqueue_script( 'vimeo', 'https://player.vimeo.com/api/player.js', array(), $version, true ); |
| 81 | + wp_register_script( 'ableplayer-video', plugins_url( 'assets', __FILE__ ) . '/js/media.js', array(), $version, true ); |
80 | 82 | wp_localize_script( |
81 | 83 | 'ableplayer-video', |
82 | 84 | 'ableplayer', |
|
124 | 126 | * @return {array} |
125 | 127 | */ |
126 | 128 | $dependencies = apply_filters( 'ableplayer_dependencies', $dependencies, $is_production ); |
127 | | - wp_enqueue_script( 'ableplayer', $js_dir, $dependencies, ABLEPLAYER_VERSION, true ); |
128 | | - wp_enqueue_style( 'ableplayer', $css_dir, array(), ABLEPLAYER_VERSION ); |
| 129 | + wp_enqueue_script( 'ableplayer', $js_dir, $dependencies, $version, true ); |
| 130 | + wp_enqueue_style( 'ableplayer', $css_dir, array(), $version ); |
129 | 131 | } |
130 | 132 | add_action( 'wp_enqueue_scripts', 'ableplayer_enqueue_scripts' ); |
131 | 133 |
|
132 | 134 | /** |
133 | 135 | * Enqueue admin JS and CSS. |
134 | 136 | */ |
135 | 137 | function ableplayer_admin_scripts() { |
136 | | - wp_enqueue_script( 'ableplayer-js', plugins_url( '/assets/js/admin.js', __FILE__ ), array( 'jquery' ), ABLEPLAYER_VERSION, true ); |
| 138 | + $version = ABLEPLAYER_VERSION; |
| 139 | + $version = ( SCRIPT_DEBUG ) ? $version . '-' . wp_rand( 1000,9999 ) : $version; |
| 140 | + wp_enqueue_script( 'ableplayer-js', plugins_url( '/assets/js/admin.js', __FILE__ ), array( 'jquery' ), $version, true ); |
137 | 141 | wp_localize_script( |
138 | 142 | 'ableplayer-js', |
139 | 143 | 'ableplayer', |
140 | 144 | array( |
141 | 145 | 'firstItem' => 'tab_settings', |
142 | 146 | ) |
143 | 147 | ); |
144 | | - wp_enqueue_style( 'ableplayer', plugins_url( '/assets/css/admin.css', __FILE__ ), array(), ABLEPLAYER_VERSION ); |
| 148 | + wp_enqueue_style( 'ableplayer', plugins_url( '/assets/css/admin.css', __FILE__ ), array(), $version ); |
145 | 149 | } |
146 | 150 | add_action( 'admin_enqueue_scripts', 'ableplayer_admin_scripts' ); |
147 | 151 |
|
|
0 commit comments