mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
init.mw.ArticleTarget: sort categories correctly in renderCategories
I.e. don't sort them, because they're provided in source order and that's all we need. Bug: T197759 Change-Id: I3b9508ff49233ccfbeba1d111a6df9f29f0fc318
This commit is contained in:
parent
9bb4ebda5c
commit
71e42d50fe
|
@ -2624,19 +2624,7 @@ ve.init.mw.ArticleTarget.prototype.renderCategories = function ( categoryItems )
|
|||
}
|
||||
return $list;
|
||||
}
|
||||
function categorySort( a, b ) {
|
||||
var sortA = a.sortkey || a.category,
|
||||
sortB = b.sortkey || b.category;
|
||||
if ( sortA < sortB ) {
|
||||
return -1;
|
||||
}
|
||||
if ( sortA > sortB ) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if ( categories.normal.length ) {
|
||||
categories.normal.sort( categorySort );
|
||||
$normal = $( '<div class="mw-normal-catlinks" />' );
|
||||
$normal.append(
|
||||
renderPageLink( ve.msg( 'pagecategorieslink' ) ).text( ve.msg( 'pagecategories', categories.normal.length ) ),
|
||||
|
@ -2646,7 +2634,6 @@ ve.init.mw.ArticleTarget.prototype.renderCategories = function ( categoryItems )
|
|||
$output.append( $normal );
|
||||
}
|
||||
if ( categories.hidden.length ) {
|
||||
categories.hidden.sort( categorySort );
|
||||
$hidden = $( '<div class="mw-hidden-catlinks" />' );
|
||||
if ( mw.user.options.get( 'showhiddencats' ) ) {
|
||||
$hidden.addClass( 'mw-hidden-cats-user-shown' );
|
||||
|
|
Loading…
Reference in a new issue