Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/287569

Change subject: Compact links: Avoid duplicate call of filterByCommonLanguages
......................................................................

Compact links: Avoid duplicate call of filterByCommonLanguages

It re-triggers mw.uls.getFrequentLanguageList(),
getPreviousLanguages() and $.cookie() read.

In this patch the result was saved and reused.

Bug: T122341
Change-Id: I14839eb611cd3e995e8d8ab729ee3f714840f9ad
---
M resources/js/ext.uls.compactlinks.js
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/69/287569/1

diff --git a/resources/js/ext.uls.compactlinks.js 
b/resources/js/ext.uls.compactlinks.js
index 9146946..e09beea 100644
--- a/resources/js/ext.uls.compactlinks.js
+++ b/resources/js/ext.uls.compactlinks.js
@@ -47,6 +47,7 @@
                this.options = options || {};
                this.interlanguageList = {};
                this.compactList = {};
+               this.commonInterlanguageList = {};
                this.$trigger = null;
                this.compactSize = 0;
                this.listSize = 0;
@@ -175,7 +176,7 @@
                                compact: true,
                                languages: ulsLanguageList,
                                // Show common languages
-                               quickList: self.filterByCommonLanguages( 
languages )
+                               quickList: this.commonInterlanguageList
                        } );
                },
 
@@ -223,6 +224,7 @@
                compact: function ( languages ) {
                        var compactLanguages = [];
 
+                       this.commonInterlanguageList = 
this.filterByCommonLanguages( languages );
                        compactLanguages = compactLanguages.concat(
                                // Add user-defined assistant languages on 
wikis with Translate extension.
                                this.filterByAssistantLanguages( languages ),
@@ -234,7 +236,7 @@
 
                                // Add all common languages to the beginning of 
array.
                                // These are the most probable languages 
predicted by ULS.
-                               this.filterByCommonLanguages( languages ),
+                               this.commonInterlanguageList,
 
                                // Finally add the whole languages array too.
                                // We will remove duplicates and cut down to 
required size.

-- 
To view, visit https://gerrit.wikimedia.org/r/287569
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14839eb611cd3e995e8d8ab729ee3f714840f9ad
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to