Index: trunk/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -502,16 +502,27 @@ |
503 | 503 | ); |
504 | 504 | } |
505 | 505 | } else { |
506 | | - // Calculate the highest timestamp |
507 | | - var version = 0; |
| 506 | + // Split into groups |
| 507 | + var groups = {}; |
508 | 508 | for ( var b = 0; b < batch.length; b++ ) { |
509 | | - if ( registry[batch[b]].version > version ) { |
510 | | - version = registry[batch[b]].version; |
| 509 | + var group = registry[batch[b]].group; |
| 510 | + if ( !( group in groups ) ) { |
| 511 | + groups[group] = []; |
511 | 512 | } |
| 513 | + groups[group][groups[group].length] = batch[b]; |
512 | 514 | } |
513 | | - requests[requests.length] = $.extend( |
514 | | - { 'modules': batch.join( '|' ), 'version': formatVersionNumber( version ) }, base |
515 | | - ); |
| 515 | + for ( var group in groups ) { |
| 516 | + // Calculate the highest timestamp |
| 517 | + var version = 0; |
| 518 | + for ( var g = 0; g < groups[group].length; g++ ) { |
| 519 | + if ( registry[groups[group][g]].version > version ) { |
| 520 | + version = registry[groups[group][g]].version; |
| 521 | + } |
| 522 | + } |
| 523 | + requests[requests.length] = $.extend( |
| 524 | + { 'modules': groups[group].join( '|' ), 'version': formatVersionNumber( version ) }, base |
| 525 | + ); |
| 526 | + } |
516 | 527 | } |
517 | 528 | // Clear the batch - this MUST happen before we append the script element to the body or it's |
518 | 529 | // possible that the script will be locally cached, instantly load, and work the batch again, |