Skip to content

Commit 892ecf2

Browse files
committed
Wordpress already orders dependencies, updated as head.js doesn't support multiple dependency resolution
1 parent af9bed1 commit 892ecf2

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

README.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ This plugin will not work out the box with the following plugins (unless they ar
4343

4444
== Changelog ==
4545

46+
= 1.2.0 =
47+
* Wordpress already orders dependencies, updated as head.js doesn't support multiple dependency resolution
48+
4649
= 1.1.2 =
4750
* Starting incompatibility list
4851

asynchronous-javascript.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: Asynchronous Javascript
44
Plugin URI: http://wordpress.org/extend/plugins/asynchronous-javascript/
55
Description: Improve page load performance by asynchronously loading javascript using head.js
6-
Version: 1.1.2
6+
Version: 1.2.0
77
Author: Paris Holley
88
Author URI: http://www.linkedin.com/in/parisholley
99
Author Email: mail@parisholley.com
@@ -73,16 +73,14 @@ function filter_headjs(){
7373
self::$head_loaded = true;
7474
}
7575

76+
$handles = array();
77+
7678
foreach(self::$depends as $handle => $depend){
77-
if(is_array($depend['deps']) && count($depend['deps']) > 0){
78-
echo '<script type="text/javascript">head.ready("' . implode(',', $depend['deps']) . '", function(){head.js({"' . $handle . '": "' . $depend['src'] . '"})})</script>';
79-
}elseif(is_string($depend['deps'])){
80-
echo '<script type="text/javascript">head.ready("' . $depend['deps'] . '", function(){head.js({"' . $handle . '": "' . $depend['src'] . '"})})</script>';
81-
}else{
82-
echo '<script type="text/javascript">head.js({"' . $handle . '": "' . $depend['src'] . '"});</script>';
83-
}
79+
$handles[] = '{"' . $handle . '": "' . $depend['src'] . '"}';
8480
}
8581

82+
echo '<script type="text/javascript">head.js(' . implode(',', $handles) . ');</script>';
83+
8684
self::$depends = array();
8785
}
8886

0 commit comments

Comments
 (0)