Amire80 has uploaded a new change for review.

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

Change subject: Query for <a> elements with first-child
......................................................................

Query for <a> elements with first-child

This is an alternative to I2909ce31e19087358d194e0e108e1ba038e7273e .
Only one of them should be merged and the other should be abandoned.

This solution for bug T135378 is somewhat less robust in general
and more coupled to the particular gadget, but it
doesn't depend on core changes.

Bug: T135378
Change-Id: I98ad6483c7d0dd54ee176e4df9312102b4b6d627
---
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/34/309734/1

diff --git a/resources/js/ext.uls.compactlinks.js 
b/resources/js/ext.uls.compactlinks.js
index 3174cbe..04b2182 100644
--- a/resources/js/ext.uls.compactlinks.js
+++ b/resources/js/ext.uls.compactlinks.js
@@ -392,7 +392,9 @@
         */
        CompactInterlanguageList.prototype.filterByBadges = function () {
                return $( '#p-lang' ).find( '[class*="badge"]' ).map( function 
( i, el ) {
-                       return convertMediaWikiLanguageCodeToULS( $( el ).find( 
'a' ).attr( 'lang' ) );
+                       return convertMediaWikiLanguageCodeToULS(
+                               $( el ).find( 'a:first-child' ).attr( 'lang' )
+                       );
                } ).toArray();
        };
 
@@ -405,7 +407,7 @@
        CompactInterlanguageList.prototype.getInterlanguageList = function () {
                var interlanguageList = {};
 
-               this.$interlanguageList.find( 'li.interlanguage-link > a' 
).each( function () {
+               this.$interlanguageList.find( 'li.interlanguage-link > 
a:first-child' ).each( function () {
                        var langCode = convertMediaWikiLanguageCodeToULS( 
this.getAttribute( 'lang' ) );
 
                        interlanguageList[ langCode ] = {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98ad6483c7d0dd54ee176e4df9312102b4b6d627
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Amire80 <amir.ahar...@mail.huji.ac.il>

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

Reply via email to