From 30552e0d63f73c394d808037379f0cc57be19a3d Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Wed, 27 Jan 2010 04:17:49 +0000 Subject: [PATCH] * Moved js2stopgap.js to skins/common/jquery.js, like I said I was going to do months ago. * Add a $modules parameter to OutputPage::includeJQuery() so that we can include jquery.ui in the main UsabilityInitiative jQuery request in a reasonably flexible way, if we need to. * Removed $wgExtensionJavascriptLoader, added in r61137 without explanation, seems to be the usual misspelt JS2/mwEmbed rubbish that I keep deleting. --- includes/DefaultSettings.php | 7 ------ includes/OutputPage.php | 24 ++++++++++++------- js2/js2stopgap.js => skins/common/jquery.js | 0 .../common/jquery.min.js | 0 4 files changed, 16 insertions(+), 15 deletions(-) rename js2/js2stopgap.js => skins/common/jquery.js (100%) rename js2/js2stopgap.min.js => skins/common/jquery.min.js (100%) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 450d69bf40..e801009eb4 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4321,10 +4321,3 @@ $wgUploadMaintenance = false; */ $wgOldChangeTagsIndex = false; -/** - * Set of loader.js files to setup dynamic loading of javascript libraries using mwEmbed - * - * Extensions can add mwEmbed modules via adding paths to their loader.js to - * $wgExtensionJavascriptLoader[] = path/to/loader.js - */ -$wgExtensionJavascriptLoader = array(); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index ba4100d0fe..cf92eaf690 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -50,7 +50,7 @@ class OutputPage { /** * Whether to load jQuery core. */ - protected $mIncludeJQuery = false; + protected $mJQueryDone = false; private $mIndexPolicy = 'index'; private $mFollowPolicy = 'follow'; @@ -2131,19 +2131,27 @@ class OutputPage { /** * Include jQuery core. Use this to avoid loading it multiple times - * before we get usable script loader. + * before we get a usable script loader. + * + * @param array $modules List of jQuery modules which should be loaded + * + * Returns the list of modules which were not loaded. */ - public function includeJQuery() { - if ( $this->mIncludeJQuery ) return; - $this->mIncludeJQuery = true; - + public function includeJQuery( $modules = array() ) { global $wgScriptPath, $wgStyleVersion, $wgJsMimeType; + $supportedModules = array( 'ui' ); + $unsupported = array_diff( $modules, $supportedModules ); + $params = array( 'type' => $wgJsMimeType, - 'src' => "$wgScriptPath/js2/js2stopgap.min.js?$wgStyleVersion", + 'src' => "$wgScriptPath/skins/common/jquery.min.js?$wgStyleVersion", ); - $this->mScripts = Html::element( 'script', $params ) . "\n" . $this->mScripts; + if ( !$this->mJQueryDone ) { + $this->mJQueryDone = true; + $this->mScripts = Html::element( 'script', $params ) . "\n" . $this->mScripts; + } + return $unsupported; } } diff --git a/js2/js2stopgap.js b/skins/common/jquery.js similarity index 100% rename from js2/js2stopgap.js rename to skins/common/jquery.js diff --git a/js2/js2stopgap.min.js b/skins/common/jquery.min.js similarity index 100% rename from js2/js2stopgap.min.js rename to skins/common/jquery.min.js -- 2.20.1