|
|
@ -33,6 +33,7 @@ let alternativeSpeedLimits = false; |
|
|
|
let queueing_enabled = true; |
|
|
|
let queueing_enabled = true; |
|
|
|
let serverSyncMainDataInterval = 1500; |
|
|
|
let serverSyncMainDataInterval = 1500; |
|
|
|
let customSyncMainDataInterval = null; |
|
|
|
let customSyncMainDataInterval = null; |
|
|
|
|
|
|
|
let useSubcategories = true; |
|
|
|
let searchTabInitialized = false; |
|
|
|
let searchTabInitialized = false; |
|
|
|
let rssTabInitialized = false; |
|
|
|
let rssTabInitialized = false; |
|
|
|
let logTabInitialized = false; |
|
|
|
let logTabInitialized = false; |
|
|
@ -429,9 +430,17 @@ window.addEvent('load', function() { |
|
|
|
categoryList.empty(); |
|
|
|
categoryList.empty(); |
|
|
|
|
|
|
|
|
|
|
|
const create_link = function(hash, text, count) { |
|
|
|
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"/>' |
|
|
|
+ '<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', { |
|
|
|
const el = new Element('li', { |
|
|
|
id: hash, |
|
|
|
id: hash, |
|
|
|
html: html |
|
|
|
html: html |
|
|
@ -455,11 +464,20 @@ window.addEvent('load', function() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
sortedCategories.sort(); |
|
|
|
sortedCategories.sort(); |
|
|
|
|
|
|
|
|
|
|
|
Object.each(sortedCategories, function(categoryName) { |
|
|
|
for (let i = 0; i < sortedCategories.length; ++i) { |
|
|
|
|
|
|
|
const categoryName = sortedCategories[i]; |
|
|
|
const categoryHash = genHash(categoryName); |
|
|
|
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)); |
|
|
|
categoryList.appendChild(create_link(categoryHash, categoryName, categoryCount)); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
highlightSelectedCategory(); |
|
|
|
highlightSelectedCategory(); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -821,6 +839,11 @@ window.addEvent('load', function() { |
|
|
|
updateAltSpeedIcon(alternativeSpeedLimits); |
|
|
|
updateAltSpeedIcon(alternativeSpeedLimits); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (useSubcategories != serverState.use_subcategories) { |
|
|
|
|
|
|
|
useSubcategories = serverState.use_subcategories; |
|
|
|
|
|
|
|
updateCategoryList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
serverSyncMainDataInterval = Math.max(serverState.refresh_interval, 500); |
|
|
|
serverSyncMainDataInterval = Math.max(serverState.refresh_interval, 500); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|