Async JavaScript - Version 1.16.09.30

Version Description

  • MOD: Better detection of jQuery core file
Download this release

Release Info

Developer cloughit
Plugin Icon 128x128 Async JavaScript
Version 1.16.09.30
Comparing to
See all releases

Code changes from version 1.16.09.29 to 1.16.09.30

Files changed (2) hide show
  1. async-javascript.php +8 -4
  2. readme.txt +5 -1
async-javascript.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
  Plugin Name: Async JavaScript
5
  Plugin URI: https://cloughit.com.au/product/async-javascript/
6
  Description: Async JavaScript adds a 'async' or 'defer' attribute to scripts loaded via wp_enqueue_script
7
- Version: 1.16.09.29
8
  Author: Clough I.T. Solutions
9
  Author URI: http://www.cloughit.com.au/
10
  Text Domain: async-javascript
@@ -23,7 +23,7 @@ add_action( 'admin_init', 'aj_admin_init' );
23
  function aj_admin_init() {
24
  define( 'AJ_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
25
  define( 'AJ_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
26
- define( 'AJ_VERSION', '1.16.09.29' );
27
  wp_register_style(
28
  'aj_admin_styles',
29
  plugins_url( '/css/admin.css', __FILE__ )
@@ -222,7 +222,7 @@ function async_js( $tag, $handle, $src ) {
222
  }
223
  }
224
  }
225
- if ( false !== strpos( strtolower( $src ), 'jquery.js' ) ) {
226
  if ( $aj_jquery == 'async' || $aj_jquery == 'defer' ) {
227
  $tag = str_replace( 'src=', $aj_jquery . "='" . $aj_jquery . "' src=", $tag );
228
  return $tag;
@@ -246,10 +246,14 @@ function async_js( $tag, $handle, $src ) {
246
  */
247
  add_filter( 'autoptimize_filter_js_defer', 'my_autoptimize_defer', 11 );
248
  function my_autoptimize_defer( $defer ) {
249
- $aj_enabled = ( get_option( 'aj_enabled' ) == 1 ) ? true : false;
 
250
  $aj_method = ( get_option( 'aj_method' ) != 'async' ) ? 'defer' : 'async';
 
251
  $aj_autoptimize_enabled = ( get_option( 'aj_autoptimize_enabled' ) == 1 ) ? true : false;
 
252
  $aj_autoptimize_method = ( get_option( 'aj_autoptimize_method' ) != 'async' ) ? 'defer' : 'async';
 
253
  if ( false !== $aj_enabled && false === is_admin() ) {
254
  if ( false !== $aj_autoptimize_enabled ) {
255
  return " " . $aj_autoptimize_method . "='" . $aj_autoptimize_method . "' ";
4
  Plugin Name: Async JavaScript
5
  Plugin URI: https://cloughit.com.au/product/async-javascript/
6
  Description: Async JavaScript adds a 'async' or 'defer' attribute to scripts loaded via wp_enqueue_script
7
+ Version: 1.16.09.30
8
  Author: Clough I.T. Solutions
9
  Author URI: http://www.cloughit.com.au/
10
  Text Domain: async-javascript
23
  function aj_admin_init() {
24
  define( 'AJ_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
25
  define( 'AJ_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
26
+ define( 'AJ_VERSION', '1.16.09.30' );
27
  wp_register_style(
28
  'aj_admin_styles',
29
  plugins_url( '/css/admin.css', __FILE__ )
222
  }
223
  }
224
  }
225
+ if ( false !== strpos( strtolower( $src ), 'js/jquery/jquery.js' ) ) {
226
  if ( $aj_jquery == 'async' || $aj_jquery == 'defer' ) {
227
  $tag = str_replace( 'src=', $aj_jquery . "='" . $aj_jquery . "' src=", $tag );
228
  return $tag;
246
  */
247
  add_filter( 'autoptimize_filter_js_defer', 'my_autoptimize_defer', 11 );
248
  function my_autoptimize_defer( $defer ) {
249
+ $aj_enabled = ( get_option( 'aj_enabled' ) == 1 ) ? true : false;
250
+ $aj_enabled = ( isset( $_GET['aj_enabled'] ) && $_GET['aj_enabled'] == 1 ) ? true : $aj_enabled;
251
  $aj_method = ( get_option( 'aj_method' ) != 'async' ) ? 'defer' : 'async';
252
+ $aj_method = ( isset( $_GET['aj_method'] ) ) ? $_GET['aj_method'] : $aj_method;
253
  $aj_autoptimize_enabled = ( get_option( 'aj_autoptimize_enabled' ) == 1 ) ? true : false;
254
+ $aj_autoptimize_enabled = ( isset( $_GET['aj_autoptimize_enabled'] ) && $_GET['aj_autoptimize_enabled'] == 1 ) ? true : $aj_autoptimize_enabled;
255
  $aj_autoptimize_method = ( get_option( 'aj_autoptimize_method' ) != 'async' ) ? 'defer' : 'async';
256
+ $aj_autoptimize_method = ( isset( $_GET['aj_autoptimize_method'] ) ) ? $_GET['aj_autoptimize_method'] : $aj_autoptimize_method;
257
  if ( false !== $aj_enabled && false === is_admin() ) {
258
  if ( false !== $aj_autoptimize_enabled ) {
259
  return " " . $aj_autoptimize_method . "='" . $aj_autoptimize_method . "' ";
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.cloughit.com.au/donate/ (coming soon)
4
  Tags: async,javascript,google,pagespeed,js,speed,performance,boost,render,blocking,above-the-fold
5
  Requires at least: 2.8
6
  Tested up to: 4.6.1
7
- Stable tag: 1.16.09.29
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -70,6 +70,10 @@ Please lodge a support request at <a href="https://cloughit.com.au/support/?wpsc
70
 
71
  == Changelog ==
72
 
 
 
 
 
73
  = 1.16.08.17 =
74
 
75
  * FIX: Typo in variable name
4
  Tags: async,javascript,google,pagespeed,js,speed,performance,boost,render,blocking,above-the-fold
5
  Requires at least: 2.8
6
  Tested up to: 4.6.1
7
+ Stable tag: 1.16.09.30
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
70
 
71
  == Changelog ==
72
 
73
+ = 1.16.09.30 =
74
+
75
+ * MOD: Better detection of jQuery core file
76
+
77
  = 1.16.08.17 =
78
 
79
  * FIX: Typo in variable name