Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -47,6 +47,11 @@ |
48 | 48 | */ |
49 | 49 | var $styles = array(); |
50 | 50 | |
| 51 | + /** |
| 52 | + * Whether to load jQuery core. |
| 53 | + */ |
| 54 | + protected $mIncludeJQuery = false; |
| 55 | + |
51 | 56 | private $mIndexPolicy = 'index'; |
52 | 57 | private $mFollowPolicy = 'follow'; |
53 | 58 | private $mVaryHeader = array( 'Accept-Encoding' => array('list-contains=gzip'), |
— | — | @@ -2103,4 +2108,22 @@ |
2104 | 2109 | } |
2105 | 2110 | $this->addHTML( $this->parse( $s, /*linestart*/true, /*uilang*/true ) ); |
2106 | 2111 | } |
| 2112 | + |
| 2113 | + /** |
| 2114 | + * Include jQuery core. Use this to avoid loading it multiple times |
| 2115 | + * before we get usable script loader. |
| 2116 | + */ |
| 2117 | + public function includeJQuery() { |
| 2118 | + if ( $this->mIncludeJQuery ) return; |
| 2119 | + $this->mIncludeJQuery = true; |
| 2120 | + |
| 2121 | + global $wgScriptPath, $wgStyleVersion, $wgJsMimeType; |
| 2122 | + |
| 2123 | + $params = array( |
| 2124 | + 'type' => $wgJsMimeType, |
| 2125 | + 'src' => "$wgScriptPath/js2/js2stopgap.min.js?$wgStyleVersion", |
| 2126 | + ); |
| 2127 | + $this->mScripts = Html::element( 'script', $params ) . "\n" . $this->mScripts; |
| 2128 | + } |
| 2129 | + |
2107 | 2130 | } |
Index: trunk/extensions/Translate/utils/MessageTable.php |
— | — | @@ -54,10 +54,17 @@ |
55 | 55 | $prefix = "$wgExtensionAssetsPath/Translate/js"; |
56 | 56 | // Our class |
57 | 57 | $wgOut->addScriptFile( "$prefix/quickedit.js" ); |
| 58 | + |
58 | 59 | // Core jQuery |
59 | | - $wgOut->addScriptFile( "$wgScriptPath/js2/js2stopgap.min.js" ); |
60 | | - // Additional jQuery |
61 | | - $wgOut->addScriptFile( "$prefix/jquery-ui-1.7.2.custom.min.js" ); |
| 60 | + if ( method_exists( $wgOut, 'includeJQuery' ) ) { |
| 61 | + $wgOut->includeJQuery(); |
| 62 | + $wgOut->addScriptFile( "$prefix/jquery-ui-1.7.2.custom.min.js" ); |
| 63 | + } else { |
| 64 | + // MW 1.15 and older |
| 65 | + $wgOut->addScriptFile( "$prefix/js2stopgap.js" ); |
| 66 | + } |
| 67 | + |
| 68 | + // Additional jQuery stuff |
62 | 69 | $wgOut->addScriptFile( "$prefix/jquery.form.js" ); |
63 | 70 | $wgOut->addExtensionStyle( "$prefix/base/custom-theme/jquery-ui-1.7.2.custom.css" ); |
64 | 71 | } |