mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
parent
54dffa1051
commit
837d39dac7
1 changed files with 15 additions and 1 deletions
|
@ -488,7 +488,21 @@ window.addEvent('load', function() {
|
||||||
Object.each(category_list, function(category) {
|
Object.each(category_list, function(category) {
|
||||||
sortedCategories.push(category.name);
|
sortedCategories.push(category.name);
|
||||||
});
|
});
|
||||||
sortedCategories.sort();
|
sortedCategories.sort(function(category1, category2) {
|
||||||
|
for (let i = 0; i < Math.min(category1.length, category2.length); ++i) {
|
||||||
|
if (category1[i] === "/" && category2[i] !== "/") {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else if (category1[i] !== "/" && category2[i] === "/") {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if (category1[i] !== category2[i]) {
|
||||||
|
return category1[i].localeCompare(category2[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return category1.length - category2.length;
|
||||||
|
});
|
||||||
|
|
||||||
for (let i = 0; i < sortedCategories.length; ++i) {
|
for (let i = 0; i < sortedCategories.length; ++i) {
|
||||||
const categoryName = sortedCategories[i];
|
const categoryName = sortedCategories[i];
|
||||||
|
|
Loading…
Reference in a new issue