Index: trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php |
— | — | @@ -10,9 +10,36 @@ |
11 | 11 | * |
12 | 12 | * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
13 | 13 | */ |
14 | | -final class PushFunctions { |
| 14 | +final class LiveTranslateFunctions { |
15 | 15 | |
16 | 16 | /** |
| 17 | + * Loads the needed JavaScript. |
| 18 | + * Takes care of non-RL compatibility. |
| 19 | + * |
| 20 | + * @since 0.1 |
| 21 | + */ |
| 22 | + protected static function loadJs() { |
| 23 | + global $wgOut; |
| 24 | + |
| 25 | + // For backward compatibility with MW < 1.17. |
| 26 | + if ( is_callable( array( $wgOut, 'addModules' ) ) ) { |
| 27 | + $wgOut->addModules( 'ext.livetranslate' ); |
| 28 | + } |
| 29 | + else { |
| 30 | + global $egLiveTranslateScriptPath; |
| 31 | + |
| 32 | + self::addJSLocalisation(); |
| 33 | + |
| 34 | + $wgOut->includeJQuery(); |
| 35 | + |
| 36 | + $wgOut->addHeadItem( |
| 37 | + 'ext.livetranslate', |
| 38 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.livetranslate.js' ) |
| 39 | + ); |
| 40 | + } |
| 41 | + } |
| 42 | + |
| 43 | + /** |
17 | 44 | * Adds the needed JS messages to the page output. |
18 | 45 | * This is for backward compatibility with pre-RL MediaWiki. |
19 | 46 | * |