Index: trunk/phase3/includes/Skin.php |
— | — | @@ -333,14 +333,21 @@ |
334 | 334 | static function makeVariablesScript( $data ) { |
335 | 335 | global $wgJsMimeType; |
336 | 336 | |
337 | | - $r = array( "<script type=\"$wgJsMimeType\">/*<![CDATA[*/" ); |
| 337 | + $doneFirstVar = false; |
| 338 | + $r = array( "<script type=\"$wgJsMimeType\">/*<![CDATA[*/\n" ); |
338 | 339 | foreach ( $data as $name => $value ) { |
339 | 340 | $encValue = Xml::encodeJsVar( $value ); |
340 | | - $r[] = "var $name = $encValue;"; |
| 341 | + if ( $doneFirstVar ) |
| 342 | + $r[] = ",\n$name=$encValue"; |
| 343 | + else { |
| 344 | + $r[] = "var $name=$encValue"; |
| 345 | + $doneFirstVar = true; |
| 346 | + } |
341 | 347 | } |
342 | | - $r[] = "/*]]>*/</script>\n"; |
| 348 | + # No need for ; since the script is terminating |
| 349 | + $r[] = "\n/*]]>*/</script>\n"; |
343 | 350 | |
344 | | - return implode( "\n", $r ); |
| 351 | + return implode( $r ); |
345 | 352 | } |
346 | 353 | |
347 | 354 | /** |