Changeset 939811
- Timestamp:
- 06/27/2014 07:26:25 PM (12 years ago)
- Location:
- combine-js
- Files:
-
- 11 added
- 3 edited
-
tags/1.9 (added)
-
tags/1.9/classes (added)
-
tags/1.9/classes/combine-js-class.php (added)
-
tags/1.9/classes/jsmin.php (added)
-
tags/1.9/combine-js.php (added)
-
tags/1.9/js.php (added)
-
tags/1.9/lang (added)
-
tags/1.9/readme.txt (added)
-
tags/1.9/screenshot-1.png (added)
-
tags/1.9/views (added)
-
tags/1.9/views/admin_settings_form.php (added)
-
trunk/classes/combine-js-class.php (modified) (7 diffs)
-
trunk/combine-js.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
combine-js/trunk/classes/combine-js-class.php
r939305 r939811 8 8 const nspace = 'combine-js'; 9 9 const pname = 'Combine JS'; 10 const version = 1. 8;10 const version = 1.9; 11 11 12 12 protected $_plugin_file; … … 30 30 var $settings_data = array(); 31 31 var $js_files_ignore = array( 'admin-bar.js', 'admin-bar.min.js' ); 32 32 33 var $js_handles_found = array(); 34 var $js_handles_count_first = 0; 35 var $js_handles_count_last = 0; 36 var $js_handles_order = array(); 33 37 var $js_footer_handles_found = array(); 34 var $debug = false;35 38 var $footer = false; 36 var $move_to_footer _top= array();37 var $move_to_footer_bottom = array(); 39 var $move_to_footer = array(); 40 38 41 var $combined = false; 39 42 var $paths_set = false; 43 var $debug = false; 40 44 41 45 /** … … 281 285 282 286 global $wp_scripts; 287 $handle_count = 0; 283 288 foreach ( $to_do as $key => $handle ) { 289 290 // keep order of all handles 291 292 $this->js_handles_order[$handle] = $handle_count++; 284 293 285 294 // keep track of footer files … … 322 331 $this->js_handles_found[$handle] = $js_src; 323 332 unset( $to_do[$key] ); 333 if ( ! $this->js_handles_count_first ) $this->js_handles_count_first = $handle_count; 334 $this->js_handles_count_last = $handle_count; 324 335 } 325 336 elseif ( $this->footer && @strlen( $wp_scripts->registered[$handle]->src ) ) { … … 327 338 // keep track of external and/or ignored js files to move to footer 328 339 329 if ( array_keys( $this->js_handles_found ) ) $this->move_to_footer_bottom[$handle] = $wp_scripts->registered[$handle]->src; 330 else $this->move_to_footer_top[$handle] = $wp_scripts->registered[$handle]->src; 340 $this->move_to_footer[$handle] = $wp_scripts->registered[$handle]->src; 331 341 } 332 342 } … … 623 633 } 624 634 625 foreach ( $this->move_to_footer_top as $handle => $src ) { 635 // if move to footer set to yes, 636 // figure out what js should be above or below our combined file 637 638 $top = $bottom = array(); 639 if ( $this->footer && array_keys( $this->move_to_footer ) ) { 640 foreach ( $this->move_to_footer as $handle => $src ) { 641 if ( $this->js_handles_order[$handle] < $this->js_handles_count_first ) $top[$handle] = $src; 642 else $bottom[$handle] = $src; 643 } 644 } 645 646 // add js above combined file 647 648 foreach ( $top as $handle => $src ) { 626 649 echo "\t\t" . '<script type="text/javascript" src="' . $src . '"></script>' . "\n"; 627 650 } … … 635 658 } 636 659 637 foreach ( $this->move_to_footer_bottom as $handle => $src ) { 660 // add js below combined file 661 662 foreach ( $bottom as $handle => $src ) { 638 663 echo "\t\t" . '<script type="text/javascript" src="' . $src . '"></script>' . "\n"; 639 664 } -
combine-js/trunk/combine-js.php
r939296 r939811 5 5 Description: WordPress plugin that attempts to combine, minify, and compress JS. 6 6 Author: Convoy 7 Version: 1. 87 Version: 1.9 8 8 Author URI: http://www.weareconvoy.com 9 9 Requires at least: 3.0.0 -
combine-js/trunk/readme.txt
r939296 r939811 5 5 Requires at least: 3.0.1 6 6 Tested up to: 3.9.1 7 Stable tag: 1. 87 Stable tag: 1.9 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 38 38 39 39 == Changelog == 40 41 = 1.9 = 42 * Continued improving of javascript ordering when "Move all JS to footer?" is set to yes. 40 43 41 44 = 1.8 =
Note: See TracChangeset
for help on using the changeset viewer.