Async JavaScript - Version 1.16.02.18

Version Description

  • NEW: Added dismissable upgrade notice
Download this release

Release Info

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

Code changes from version 1.16.02.17 to 1.16.02.18

Files changed (3) hide show
  1. async-javascript.php +25 -3
  2. js/admin.js +9 -0
  3. readme.txt +14 -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: http://www.cloughit.com.au/wordpress/plugins/async-javascript-wordpress-plugin/
6
  Description: Async Javascript adds a 'async' or 'defer' attribute to scripts loaded via wp_enqueue_script
7
- Version: 1.16.02.17
8
  Author: David Clough (cloughit)
9
  Author URI: http://www.cloughit.com.au/
10
  Text Domain: async-javascript
@@ -23,6 +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
  wp_register_style(
27
  'aj_admin_styles',
28
  plugins_url('/css/admin.css',__FILE__)
@@ -34,6 +35,22 @@ function aj_admin_init() {
34
  array('jquery'),
35
  time()
36
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
  /**
39
  * async_javascript_menu()
@@ -73,7 +90,7 @@ function async_javascript_admin() {
73
  <table class="form-table" width="100%" cellpadding="10">
74
  <tbody>
75
  <tr>
76
- <td style="width:67%;">
77
  <table class="form-table" width="100%" cellpadding="10">
78
  <tbody>
79
  <tr><td scope="row" align="left" colspan="2"><h3>Enable Async Javascript</h3></td></tr>
@@ -137,7 +154,7 @@ function async_javascript_admin() {
137
  <input type="hidden" name="page_options" value="aj_enabled,aj_method,autoptimize_enabled,aj_exclusions" />
138
  <input type="submit" name="Submit" value="Update" />
139
  </td>
140
- <td style="width:33%;">
141
  <a href="http://cloughit.com.au/product/async-javascript-pro/" target="_blank"><img src="<?php echo AJ_PLUGIN_URL; ?>images/async-javascript-pro.jpg"></a>
142
  </td>
143
  </tr>
@@ -196,4 +213,9 @@ function my_autoptimize_defer($defer) {
196
  }
197
  }
198
  }
 
 
 
 
 
199
  ?>
4
  Plugin Name: Async Javascript
5
  Plugin URI: http://www.cloughit.com.au/wordpress/plugins/async-javascript-wordpress-plugin/
6
  Description: Async Javascript adds a 'async' or 'defer' attribute to scripts loaded via wp_enqueue_script
7
+ Version: 1.16.02.18
8
  Author: David Clough (cloughit)
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.02.18' );
27
  wp_register_style(
28
  'aj_admin_styles',
29
  plugins_url('/css/admin.css',__FILE__)
35
  array('jquery'),
36
  time()
37
  );
38
+ wp_localize_script( 'aj_admin_scripts', 'aj', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
39
+ }
40
+ /**
41
+ * async_javascript_menu()
42
+ *
43
+ * register admin menu
44
+ *
45
+ * @param n/a
46
+ * @return n/a
47
+ */
48
+ add_action( 'admin_notices', 'async_javascript_upgrade_notice' );
49
+ function async_javascript_upgrade_notice() {
50
+ $aj_upgrade_notice = get_option( 'aj_upgrade_notice' );
51
+ if ( $aj_upgrade_notice != AJ_VERSION ) {
52
+ echo '<div class="notice notice-warning is-dismissible aj-upgrade-notice"><p><em>Take full control with </em><strong>Async Javascript Pro.</strong> <a href="http://cloughit.com.au/product/async-javascript-pro/" target="_blank">Read more...</a></p></div>';
53
+ }
54
  }
55
  /**
56
  * async_javascript_menu()
90
  <table class="form-table" width="100%" cellpadding="10">
91
  <tbody>
92
  <tr>
93
+ <td style="width:67%;vertical-align: top;">
94
  <table class="form-table" width="100%" cellpadding="10">
95
  <tbody>
96
  <tr><td scope="row" align="left" colspan="2"><h3>Enable Async Javascript</h3></td></tr>
154
  <input type="hidden" name="page_options" value="aj_enabled,aj_method,autoptimize_enabled,aj_exclusions" />
155
  <input type="submit" name="Submit" value="Update" />
156
  </td>
157
+ <td style="width:33%;vertical-align: top;">
158
  <a href="http://cloughit.com.au/product/async-javascript-pro/" target="_blank"><img src="<?php echo AJ_PLUGIN_URL; ?>images/async-javascript-pro.jpg"></a>
159
  </td>
160
  </tr>
213
  }
214
  }
215
  }
216
+ add_action( 'wp_ajax_async_javascript_dismiss_upgrade', 'async_javascript_dismiss_upgrade' );
217
+ function async_javascript_dismiss_upgrade() {
218
+ update_option( 'aj_upgrade_notice', AJ_VERSION );
219
+ die();
220
+ }
221
  ?>
js/admin.js CHANGED
@@ -35,4 +35,13 @@ jQuery(document).ready(function() {
35
  jQuery(document).on('click','#aj_enabled',function() {
36
  isChecked();
37
  });
 
 
 
 
 
 
 
 
 
38
  });
35
  jQuery(document).on('click','#aj_enabled',function() {
36
  isChecked();
37
  });
38
+
39
+ jQuery(document).on('click','.aj-upgrade-notice',function() {
40
+ jQuery.ajax({
41
+ url: aj.ajaxurl,
42
+ data: {
43
+ action: 'async_javascript_dismiss_upgrade'
44
+ }
45
+ });
46
+ });
47
  });
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.4.2
7
- Stable tag: 1.16.02.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -18,6 +18,15 @@ Render-blocking Javascript prevents above-the-fold content on your page from bei
18
 
19
  Async Javascript adds a 'async' or 'defer' attribute to all scripts loaded by the WordPress wp_enqueue_script function. This 'async' or 'defer' attribute forces the javascript to be loaded asynchronously or deferred, therefore speeding up page delivery.
20
 
 
 
 
 
 
 
 
 
 
21
  == Installation ==
22
 
23
  Just install from your WordPress "Plugins | Add New" screen and all will be well. Manual installation is very straightforward as well:
@@ -62,6 +71,10 @@ Please lodge a support request at https://wordpress.org/support/plugin/async-jav
62
 
63
  == Changelog ==
64
 
 
 
 
 
65
  = 1.16.02.17 =
66
 
67
  * NEW: Added information for Async Javascript Pro
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.4.2
7
+ Stable tag: 1.16.02.18
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
18
 
19
  Async Javascript adds a 'async' or 'defer' attribute to all scripts loaded by the WordPress wp_enqueue_script function. This 'async' or 'defer' attribute forces the javascript to be loaded asynchronously or deferred, therefore speeding up page delivery.
20
 
21
+ <em>Take full control with </em><strong>Async Javascript Pro</strong>
22
+
23
+ * Selective 'async'
24
+ * Selective 'defer'
25
+ * Exclude individual scripts
26
+ * Exclude plugins
27
+
28
+ <a href="http://cloughit.com.au/product/async-javascript-pro/" target="_blank">Read more...</a>
29
+
30
  == Installation ==
31
 
32
  Just install from your WordPress "Plugins | Add New" screen and all will be well. Manual installation is very straightforward as well:
71
 
72
  == Changelog ==
73
 
74
+ = 1.16.02.18 =
75
+
76
+ * NEW: Added dismissable upgrade notice
77
+
78
  = 1.16.02.17 =
79
 
80
  * NEW: Added information for Async Javascript Pro