Catrope has uploaded a new change for review.
https://gerrit.wikimedia.org/r/99542
Change subject: Use proper conditional registration for jquery.uls
......................................................................
Use proper conditional registration for jquery.uls
Previously worked by checking for the UniversalLanguageSelector
extension, now actually checks for the modules themselves.
Change-Id: I99b1bfabb1953579d3aaa661ab0a4d824a7fe656
---
M VisualEditor.hooks.php
1 file changed, 49 insertions(+), 36 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/42/99542/1
diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index ab9a881..7ad33df 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -28,42 +28,6 @@
$wgResourceModules['ext.visualEditor.viewPageTarget.init']['messages'][] = $msg;
}
}
-
- // Only load jquery.ULS if ULS Extension isn't already
installed:
- if ( !class_exists( 'UniversalLanguageSelectorHooks' ) ) {
- $wgResourceModules['jquery.uls'] =
$wgVisualEditorResourceTemplate + array(
- 'scripts' => array(
- 'jquery.uls/src/jquery.uls.core.js',
- 'jquery.uls/src/jquery.uls.lcd.js',
-
'jquery.uls/src/jquery.uls.languagefilter.js',
-
'jquery.uls/src/jquery.uls.regionfilter.js',
- ),
- 'styles' => array(
- 'jquery.uls/css/jquery.uls.css',
- 'jquery.uls/css/jquery.uls.lcd.css',
- ),
- 'dependencies' => array(
- 'jquery.uls.grid',
- 'jquery.uls.data',
- 'jquery.uls.compact',
- ),
- );
- $wgResourceModules['jquery.uls.data'] =
$wgVisualEditorResourceTemplate + array(
- 'scripts' => array(
- 'jquery.uls/src/jquery.uls.data.js',
-
'jquery.uls/src/jquery.uls.data.utils.js',
- ),
- 'position' => 'top',
- );
- $wgResourceModules['jquery.uls.grid'] =
$wgVisualEditorResourceTemplate + array(
- 'styles' =>
'jquery.uls/css/jquery.uls.grid.css',
- 'position' => 'top',
- );
- $wgResourceModules['jquery.uls.compact'] =
$wgVisualEditorResourceTemplate + array(
- 'styles' =>
'jquery.uls/css/jquery.uls.compact.css',
- 'position' => 'top',
- );
- }
}
/**
@@ -405,6 +369,10 @@
/**
* Conditionally register the oojs and oojs-ui modules, in case they've
already been registered
* by a more recent version of MediaWiki core.
+ *
+ * Also conditionally register the jquery.uls modules, in case they've
already been registered
+ * by the UniversalLanguageSelector extension.
+ *
* @param ResourceLoader $resourceLoader
* @returns boolean true
*/
@@ -441,6 +409,51 @@
'targets' => array( 'desktop', 'mobile' ),
) );
}
+
+ if ( !isset( $wgResourceModules['jquery.uls'] ) &&
!$resourceLoader->getModule( 'jquery.uls' ) ) {
+ $resourceLoader->register( 'jquery.uls',
$wgVisualEditorResourceTemplate + array(
+ 'scripts' => array(
+ 'jquery.uls/src/jquery.uls.core.js',
+ 'jquery.uls/src/jquery.uls.lcd.js',
+
'jquery.uls/src/jquery.uls.languagefilter.js',
+
'jquery.uls/src/jquery.uls.regionfilter.js',
+ ),
+ 'styles' => array(
+ 'jquery.uls/css/jquery.uls.css',
+ 'jquery.uls/css/jquery.uls.lcd.css',
+ ),
+ 'dependencies' => array(
+ 'jquery.uls.grid',
+ 'jquery.uls.data',
+ 'jquery.uls.compact',
+ ),
+ ) );
+ }
+
+ if ( !isset( $wgResourceModules['jquery.uls.data'] ) &&
!$resourceLoader->getModule( 'jquery.uls.data' ) ) {
+ $resourceLoader->register( 'jquery.uls.data',
$wgVisualEditorResourceTemplate + array(
+ 'scripts' => array(
+ 'jquery.uls/src/jquery.uls.data.js',
+
'jquery.uls/src/jquery.uls.data.utils.js',
+ ),
+ 'position' => 'top',
+ ) );
+ }
+
+ if ( !isset( $wgResourceModules['jquery.uls.grid'] ) &&
!$resourceLoader->getModule( 'jquery.uls.grid' ) ) {
+ $resourceLoader->register( 'jquery.uls.grid',
$wgVisualEditorResourceTemplate + array(
+ 'styles' =>
'jquery.uls/css/jquery.uls.grid.css',
+ 'position' => 'top',
+ ) );
+ }
+
+ if ( !isset( $wgResourceModules['jquery.uls.compact'] ) &&
!$resourceLoader->getModule( 'jquery.uls.compact' ) ) {
+ $resourceLoader->register( 'jquery.uls.compact',
$wgVisualEditorResourceTemplate + array(
+ 'styles' =>
'jquery.uls/css/jquery.uls.compact.css',
+ 'position' => 'top',
+ ) );
+ }
+
return true;
}
--
To view, visit https://gerrit.wikimedia.org/r/99542
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I99b1bfabb1953579d3aaa661ab0a4d824a7fe656
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits