jenkins-bot has submitted this change and it was merged.
Change subject: Update ULS from upstream
......................................................................
Update ULS from upstream
Change-Id: Ic1bcfb82ad433600ebb4896e303f3cf205d384e1
---
M lib/jquery.uls/src/jquery.uls.core.js
M lib/jquery.uls/src/jquery.uls.languagefilter.js
2 files changed, 29 insertions(+), 3 deletions(-)
Approvals:
Nikerabbit: Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/jquery.uls/src/jquery.uls.core.js
b/lib/jquery.uls/src/jquery.uls.core.js
index 6352239..7490682 100644
--- a/lib/jquery.uls/src/jquery.uls.core.js
+++ b/lib/jquery.uls/src/jquery.uls.core.js
@@ -114,9 +114,30 @@
ULS.prototype = {
constructor: ULS,
+ /**
+ * A "hook" that runs after the ULS constructor.
+ * At this point it is not guaranteed that the ULS has its
dimensions
+ * and that the languages lists are initialized.
+ *
+ * To use it, pass a function as the onReady parameter
+ * in the options when initializing ULS.
+ */
ready: function () {
if ( this.options.onReady ) {
this.options.onReady.call( this );
+ }
+ },
+
+ /**
+ * A "hook" that runs after the ULS panel becomes visible
+ * by using the show method.
+ *
+ * To use it, pass a function as the onVisible parameter
+ * in the options when initializing ULS.
+ */
+ visible: function () {
+ if ( this.options.onVisible ) {
+ this.options.onVisible.call( this );
}
},
@@ -152,13 +173,15 @@
if ( !this.initialized ) {
$( 'body' ).prepend( this.$menu );
this.i18n();
+
// Initialize with a full search.
// This happens on first time click of uls
trigger.
this.defaultSearch();
+
this.initialized = true;
}
- // hide any other ULS visible
+ // hide any other visible ULS
$( '.uls-menu' ).hide();
this.$menu.show();
@@ -167,6 +190,8 @@
if ( !this.isMobile() ) {
this.$languageFilter.focus();
}
+
+ this.visible();
},
i18n: function () {
diff --git a/lib/jquery.uls/src/jquery.uls.languagefilter.js
b/lib/jquery.uls/src/jquery.uls.languagefilter.js
index 28140f8..c5e245e 100644
--- a/lib/jquery.uls/src/jquery.uls.languagefilter.js
+++ b/lib/jquery.uls/src/jquery.uls.languagefilter.js
@@ -159,14 +159,15 @@
},
search: function() {
- var query = $.trim( this.$element.val() ),
+ var languagesInScript,
+ query = $.trim( this.$element.val() ),
languages =
$.uls.data.getLanguagesByScriptGroup( this.options.languages ),
scriptGroup, langNum, langCode;
this.resultCount = 0;
for ( scriptGroup in languages ) {
- var languagesInScript = languages[scriptGroup];
+ languagesInScript = languages[scriptGroup];
languagesInScript.sort(
$.uls.data.sortByAutonym );
--
To view, visit https://gerrit.wikimedia.org/r/60825
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic1bcfb82ad433600ebb4896e303f3cf205d384e1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits