WebUI: simplify close window implementation

The caller site now take the responsibility to ensure the element is valid.

PR #21892.
This commit is contained in:
Chocobo1 2024-11-26 00:40:05 +08:00 committed by GitHub
commit e1bd1038c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 22 additions and 23 deletions

View file

@ -64,15 +64,12 @@ window.qBittorrent.Client ??= (() => {
}
};
const closeWindow = (windowID) => {
const window = document.getElementById(windowID);
if (!window)
return;
const closeWindow = (window) => {
MochaUI.closeWindow(window);
};
const closeFrameWindow = (window) => {
closeWindow(window.frameElement.closest("div.mocha").id);
MochaUI.closeWindow(window.frameElement.closest("div.mocha"));
};
const getSyncMainDataInterval = () => {