mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-11 15:56:17 -07:00
parent
40e28930a4
commit
b55d4b1733
10 changed files with 86 additions and 7 deletions
|
@ -33,6 +33,7 @@ let alternativeSpeedLimits = false;
|
|||
let queueing_enabled = true;
|
||||
let serverSyncMainDataInterval = 1500;
|
||||
let customSyncMainDataInterval = null;
|
||||
let useSubcategories = true;
|
||||
let searchTabInitialized = false;
|
||||
let rssTabInitialized = false;
|
||||
let logTabInitialized = false;
|
||||
|
@ -429,9 +430,17 @@ window.addEvent('load', function() {
|
|||
categoryList.empty();
|
||||
|
||||
const create_link = function(hash, text, count) {
|
||||
const html = '<a href="#" onclick="setCategoryFilter(' + hash + ');return false;">'
|
||||
let display_name = text;
|
||||
let margin_left = 0;
|
||||
if (useSubcategories) {
|
||||
const category_path = text.split("/");
|
||||
display_name = category_path[category_path.length - 1];
|
||||
margin_left = (category_path.length - 1) * 20;
|
||||
}
|
||||
|
||||
const html = '<a href="#" style="margin-left: ' + margin_left + 'px" onclick="setCategoryFilter(' + hash + ');return false;">'
|
||||
+ '<img src="images/view-categories.svg"/>'
|
||||
+ window.qBittorrent.Misc.escapeHtml(text) + ' (' + count + ')' + '</a>';
|
||||
+ window.qBittorrent.Misc.escapeHtml(display_name) + ' (' + count + ')' + '</a>';
|
||||
const el = new Element('li', {
|
||||
id: hash,
|
||||
html: html
|
||||
|
@ -455,11 +464,20 @@ window.addEvent('load', function() {
|
|||
});
|
||||
sortedCategories.sort();
|
||||
|
||||
Object.each(sortedCategories, function(categoryName) {
|
||||
for (let i = 0; i < sortedCategories.length; ++i) {
|
||||
const categoryName = sortedCategories[i];
|
||||
const categoryHash = genHash(categoryName);
|
||||
const categoryCount = category_list[categoryHash].torrents.length;
|
||||
let categoryCount = category_list[categoryHash].torrents.length;
|
||||
|
||||
if (useSubcategories) {
|
||||
for (let j = i + 1; j < sortedCategories.length && sortedCategories[j].startsWith(categoryName + "/"); ++j) {
|
||||
const hash = genHash(sortedCategories[j]);
|
||||
categoryCount += category_list[hash].torrents.length;
|
||||
}
|
||||
}
|
||||
|
||||
categoryList.appendChild(create_link(categoryHash, categoryName, categoryCount));
|
||||
});
|
||||
}
|
||||
|
||||
highlightSelectedCategory();
|
||||
};
|
||||
|
@ -821,6 +839,11 @@ window.addEvent('load', function() {
|
|||
updateAltSpeedIcon(alternativeSpeedLimits);
|
||||
}
|
||||
|
||||
if (useSubcategories != serverState.use_subcategories) {
|
||||
useSubcategories = serverState.use_subcategories;
|
||||
updateCategoryList();
|
||||
}
|
||||
|
||||
serverSyncMainDataInterval = Math.max(serverState.refresh_interval, 500);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue