Niharika29 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/118728
Change subject: WIP Preserve GA and FA classes for interwiki links
......................................................................
WIP Preserve GA and FA classes for interwiki links
Bug: 62376
Change-Id: I425d68b183018fffe146b194982bca7156575349
---
M UniversalLanguageSelector.hooks.php
M resources/js/ext.uls.compactlinks.js
2 files changed, 41 insertions(+), 3 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector
refs/changes/28/118728/1
diff --git a/UniversalLanguageSelector.hooks.php
b/UniversalLanguageSelector.hooks.php
index 27b224e..6dbf067 100644
--- a/UniversalLanguageSelector.hooks.php
+++ b/UniversalLanguageSelector.hooks.php
@@ -337,7 +337,7 @@
public static function onGetBetaFeaturePreferences( $user, &$prefs ) {
global $wgExtensionAssetsPath, $wgULSCompactLinks,
$wgHideInterlanguageLinks, $wgInterwikiMagic;
- if ( $wgULSCompactLinks && $wgInterwikiMagic == true &&
$wgHideInterlanguageLinks == false) {
+ if ( $wgULSCompactLinks && $wgInterwikiMagic == true &&
$wgHideInterlanguageLinks == false ) {
$prefs['uls-compact-links'] = array(
'label-message' => 'uls-betafeature-label',
'desc-message' => 'uls-betafeature-desc',
diff --git a/resources/js/ext.uls.compactlinks.js
b/resources/js/ext.uls.compactlinks.js
index c3fdcfc..02673d8 100644
--- a/resources/js/ext.uls.compactlinks.js
+++ b/resources/js/ext.uls.compactlinks.js
@@ -20,6 +20,32 @@
( function ( $, mw ) {
'use strict';
+
+ /*
+ * Function to fetch all languages which have a 'Good Article' tag
+ * @return {Array} List of language names having a featured article
+ */
+ function goodArticleList() {
+ var goodArticles = [];
+ $( '.GA' ).each( function() {
+ goodArticles.push( $.uls.data.getAutonym($( this
).attr( 'lang' )) );
+ } );
+ return goodArticles;
+ }
+
+
+ /*
+ * Function to fetch all languages which have a 'Featured Article' tag
+ * @return {Array} List of language names having a featured article
+ */
+ function featuredArticleList() {
+ var featuredArticles = [];
+ $( '.FA' ).each( function() {
+ featuredArticles.push( $.uls.data.getAutonym($( this
).attr( 'lang' )) );
+ } );
+ return featuredArticles;
+ }
+
/**
* Add a language to the interlanguage list
* @param {string} name Name of language in Autonym font
@@ -28,7 +54,9 @@
function addLanguage( name, url ) {
var $linkNode,
$listNode,
- $interlanguageList;
+ $interlanguageList,
+ goodArticles = goodArticleList(),
+ featuredArticles = featuredArticleList();
$linkNode = $( '<a>' )
.addClass( 'active' )
@@ -36,7 +64,17 @@
.text( name );
$listNode = $( '<li>' )
- .append( $linkNode );
+ .append( $linkNode )
+ .addClass( 'interlanguage-link' );
+
+ if( $.inArray( name, goodArticles ) >= 0 ) {
+ $listNode.addClass( 'GA' )
+ .title( 'This is a good article in this
language' );
+ }
+ if( $.inArray( name, featuredArticles ) >= 0 ) {
+ $listNode.addClass( 'FA' )
+ .title( 'This is a featured article in this
language' );
+ }
$interlanguageList = $( '#p-lang > div > ul' );
$interlanguageList.append( $listNode );
--
To view, visit https://gerrit.wikimedia.org/r/118728
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I425d68b183018fffe146b194982bca7156575349
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Niharika29 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits