Version Description
- don't async (or defer) on AMP-pages
- disable async/ defer by when
?aj_noptimize=1
is part of the URL
Download this release
Release Info
Developer | futtta |
Plugin | Async JavaScript |
Version | 2.18.05.24 |
Comparing to | |
See all releases |
Code changes from version 2.18.04.23 to 2.18.05.24
- async-javascript.php +1 -1
- asyncjsFrontendClass.php +30 -1
- readme.txt +6 -1
async-javascript.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Async JavaScript
|
4 |
* Plugin URI: https://autoptimize.com/
|
5 |
* Description: Async JavaScript gives you full control of which scripts to add a 'async' or 'defer' attribute to or to exclude to help increase the performance of your WordPress website
|
6 |
-
* Version: 2.18.
|
7 |
* Author: Frank Goossens (futtta)
|
8 |
* Author URI: https://autoptimize.com/
|
9 |
* Text Domain: asyncjs
|
3 |
* Plugin Name: Async JavaScript
|
4 |
* Plugin URI: https://autoptimize.com/
|
5 |
* Description: Async JavaScript gives you full control of which scripts to add a 'async' or 'defer' attribute to or to exclude to help increase the performance of your WordPress website
|
6 |
+
* Version: 2.18.05.24
|
7 |
* Author: Frank Goossens (futtta)
|
8 |
* Author URI: https://autoptimize.com/
|
9 |
* Text Domain: asyncjs
|
asyncjsFrontendClass.php
CHANGED
@@ -65,7 +65,7 @@ class AsyncJavaScriptFrontend {
|
|
65 |
$aj_plugin_exclusions = get_option( 'aj_plugin_exclusions', array() );
|
66 |
$aj_theme_exclusions = get_option( 'aj_theme_exclusions', array() );
|
67 |
}
|
68 |
-
if ( false !== $aj_enabled && false === is_admin() ) {
|
69 |
if ( is_array( $aj_plugin_exclusions ) && !empty( $aj_plugin_exclusions ) ) {
|
70 |
foreach ( $aj_plugin_exclusions as $aj_plugin_exclusion ) {
|
71 |
$aj_plugin_exclusion = trim( $aj_plugin_exclusion );
|
@@ -149,4 +149,33 @@ class AsyncJavaScriptFrontend {
|
|
149 |
}
|
150 |
return '';
|
151 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
}
|
65 |
$aj_plugin_exclusions = get_option( 'aj_plugin_exclusions', array() );
|
66 |
$aj_theme_exclusions = get_option( 'aj_theme_exclusions', array() );
|
67 |
}
|
68 |
+
if ( false !== $aj_enabled && false === is_admin() && false === $this->aj_is_amp() && false === $this->aj_noptimize() ) {
|
69 |
if ( is_array( $aj_plugin_exclusions ) && !empty( $aj_plugin_exclusions ) ) {
|
70 |
foreach ( $aj_plugin_exclusions as $aj_plugin_exclusion ) {
|
71 |
$aj_plugin_exclusion = trim( $aj_plugin_exclusion );
|
149 |
}
|
150 |
return '';
|
151 |
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Returns true if given current page is AMP.
|
155 |
+
*
|
156 |
+
* @return bool
|
157 |
+
*/
|
158 |
+
public static function aj_is_amp()
|
159 |
+
{
|
160 |
+
if ( !function_exists('is_amp_endpoint') || !is_amp_endpoint() ) {
|
161 |
+
return false;
|
162 |
+
} else {
|
163 |
+
return true;
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Returns true if aj_noptimize=1 was found in URL.
|
169 |
+
*
|
170 |
+
* @return bool
|
171 |
+
*/
|
172 |
+
public static function aj_noptimize()
|
173 |
+
{
|
174 |
+
$key = 'aj_noptimize';
|
175 |
+
if ( array_key_exists( $key, $_GET ) && '1' === $_GET[ $key ] ) {
|
176 |
+
return true;
|
177 |
+
} else {
|
178 |
+
return false;
|
179 |
+
}
|
180 |
+
}
|
181 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
|
|
4 |
Tags: async, javascript, pagespeed, performance, render blocking
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 2.18.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -61,6 +61,11 @@ Coming soon!
|
|
61 |
|
62 |
== Changelog ==
|
63 |
|
|
|
|
|
|
|
|
|
|
|
64 |
= 2.18.04.23 =
|
65 |
|
66 |
* Re-arrange content on the different tabs of the settings page.
|
4 |
Tags: async, javascript, pagespeed, performance, render blocking
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 2.18.05.24
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
61 |
|
62 |
== Changelog ==
|
63 |
|
64 |
+
= 2.18.05.24 =
|
65 |
+
|
66 |
+
* don't async (or defer) on AMP-pages
|
67 |
+
* disable async/ defer by when `?aj_noptimize=1` is part of the URL
|
68 |
+
|
69 |
= 2.18.04.23 =
|
70 |
|
71 |
* Re-arrange content on the different tabs of the settings page.
|