mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 05:01:25 -07:00
WebUI: Fix displaying RSS panel on load
The required JS may not yet be loaded, resulting in an error when calling `window.qBittorrent.Rss.init()`. Signed-off-by: Thomas Piccirello <thomas@piccirello.com> PR #21689.
This commit is contained in:
parent
e0e61ffd02
commit
be3eefd8de
1 changed files with 14 additions and 0 deletions
|
@ -155,6 +155,7 @@ let toggleFilterDisplay = function() {};
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
let isSearchPanelLoaded = false;
|
let isSearchPanelLoaded = false;
|
||||||
let isLogPanelLoaded = false;
|
let isLogPanelLoaded = false;
|
||||||
|
let isRssPanelLoaded = false;
|
||||||
|
|
||||||
const saveColumnSizes = function() {
|
const saveColumnSizes = function() {
|
||||||
const filters_width = $("Filters").getSize().x;
|
const filters_width = $("Filters").getSize().x;
|
||||||
|
@ -1274,6 +1275,16 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
let rssTabInitialized = false;
|
let rssTabInitialized = false;
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
// we must wait until the panel is fully loaded before proceeding.
|
||||||
|
// this include's the panel's custom js, which is loaded via MochaUI.Panel's 'require' field.
|
||||||
|
// MochaUI loads these files asynchronously and thus all required libs may not be available immediately
|
||||||
|
if (!isRssPanelLoaded) {
|
||||||
|
setTimeout(() => {
|
||||||
|
showRssTab();
|
||||||
|
}, 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!rssTabInitialized) {
|
if (!rssTabInitialized) {
|
||||||
window.qBittorrent.Rss.init();
|
window.qBittorrent.Rss.init();
|
||||||
rssTabInitialized = true;
|
rssTabInitialized = true;
|
||||||
|
@ -1374,6 +1385,9 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
},
|
},
|
||||||
loadMethod: "xhr",
|
loadMethod: "xhr",
|
||||||
contentURL: "views/rss.html",
|
contentURL: "views/rss.html",
|
||||||
|
onContentLoaded: () => {
|
||||||
|
isRssPanelLoaded = true;
|
||||||
|
},
|
||||||
content: "",
|
content: "",
|
||||||
column: "rssTabColumn",
|
column: "rssTabColumn",
|
||||||
height: null
|
height: null
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue