mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
WebUI: replace deprecated data type
`Hash` is deprecated by mootools. Also simplify related code. PR #22458.
This commit is contained in:
parent
d21653e8cf
commit
7b4a3fccc6
1 changed files with 24 additions and 17 deletions
|
@ -1866,22 +1866,32 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
};
|
};
|
||||||
|
|
||||||
const getWatchedFolders = () => {
|
const getWatchedFolders = () => {
|
||||||
const nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
|
const folders = {};
|
||||||
const folders = new Hash();
|
|
||||||
for (let i = 0; i < nb_folders; ++i) {
|
const entryCount = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
|
||||||
|
for (let i = 0; i < entryCount; ++i) {
|
||||||
const fpath = $(`text_watch_${i}`).value.trim();
|
const fpath = $(`text_watch_${i}`).value.trim();
|
||||||
if (fpath.length > 0) {
|
if (fpath.length <= 0)
|
||||||
const sel = $(`cb_watch_${i}`).value.trim();
|
continue;
|
||||||
|
|
||||||
let other;
|
const sel = $(`cb_watch_${i}`).value.trim();
|
||||||
if (sel === "other")
|
|
||||||
|
let other;
|
||||||
|
switch (sel) {
|
||||||
|
case "watch_folder":
|
||||||
|
other = 0;
|
||||||
|
break;
|
||||||
|
case "default_folder":
|
||||||
|
other = 1;
|
||||||
|
break;
|
||||||
|
case "other":
|
||||||
other = $(`cb_watch_txt_${i}`).value.trim();
|
other = $(`cb_watch_txt_${i}`).value.trim();
|
||||||
else
|
break;
|
||||||
other = (sel === "watch_folder") ? 0 : 1;
|
};
|
||||||
|
|
||||||
folders.set(fpath, other);
|
folders[fpath] = other;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return folders;
|
return folders;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2297,14 +2307,11 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const folderType = pref.scan_dirs[folder];
|
const folderType = pref.scan_dirs[folder];
|
||||||
let sel = "";
|
let sel = "other";
|
||||||
let other = "";
|
let other = folderType;
|
||||||
if (typeof folderType === "number") {
|
if (typeof folderType === "number") {
|
||||||
sel = (folderType === 0) ? "watch_folder" : "default_folder";
|
sel = (folderType === 0) ? "watch_folder" : "default_folder";
|
||||||
}
|
other = "";
|
||||||
else {
|
|
||||||
sel = "other";
|
|
||||||
other = folderType;
|
|
||||||
}
|
}
|
||||||
addWatchFolder(folder, sel, other);
|
addWatchFolder(folder, sel, other);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue