Merge "CompactLinks: support sortPrepend from WikiBaseClient"

This commit is contained in:
jenkins-bot
2016-08-02 05:14:55 +00:00
committed by Gerrit Code Review
2 changed files with 23 additions and 1 deletions

View File

@@ -226,6 +226,8 @@
// Previous languages are always the better suggestion
// because the user has explicitly chosen them.
filterByPreviousLanguages,
// Site specific highlights, mostly used on Wikimedia sites
filterBySitePicks,
// Add all common languages to the beginning of array.
// These are the most probable languages predicted by ULS.
this.getCommonLanguages,
@@ -279,6 +281,19 @@
} );
}
/**
* Filter the language list by site picks.
*
* @return {Array} List of language codes supported by the article
*/
function filterBySitePicks( languages ) {
var picks = mw.config.get( 'wgULSCompactLinksPrepend' ) || [];
return $.grep( picks, function ( language ) {
return $.inArray( language, languages ) >= 0;
} );
}
/**
* Filter the language list by common languages.
* Common languages are the most probable languages predicted by ULS.