mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Support using separate download path in WebUI
Signed-off-by: Thomas Piccirello <thomas@piccirello.com>
This commit is contained in:
parent
cb25cfa323
commit
4e09974f2a
2 changed files with 40 additions and 4 deletions
|
@ -130,6 +130,16 @@
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<fieldset class="settings">
|
||||||
|
<legend>
|
||||||
|
<input type="checkbox" id="useDownloadPath" name="useDownloadPath" value="true">
|
||||||
|
<label for="useDownloadPath">QBT_TR(Use another path for incomplete torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
|
||||||
|
</legend>
|
||||||
|
<div class="formRow">
|
||||||
|
<label for="downloadPath">QBT_TR(Save path:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
|
||||||
|
<input type="text" id="downloadPath" name="downloadPath" class="pathDirectory" disabled>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="settings" style="text-align: left;">
|
<fieldset class="settings" style="text-align: left;">
|
||||||
<legend>QBT_TR(Torrent settings)QBT_TR[CONTEXT=AddNewTorrentDialog]</legend>
|
<legend>QBT_TR(Torrent settings)QBT_TR[CONTEXT=AddNewTorrentDialog]</legend>
|
||||||
|
|
|
@ -123,17 +123,39 @@ window.qBittorrent.AddTorrent ??= (() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeTMM = (item) => {
|
const changeTMM = (item) => {
|
||||||
|
const savepath = document.getElementById("savepath");
|
||||||
|
const useDownloadPath = document.getElementById("useDownloadPath");
|
||||||
if (item.selectedIndex === 1) {
|
if (item.selectedIndex === 1) {
|
||||||
document.getElementById("savepath").disabled = true;
|
savepath.disabled = true;
|
||||||
|
|
||||||
const categorySelect = document.getElementById("categorySelect");
|
const categorySelect = document.getElementById("categorySelect");
|
||||||
const categoryName = categorySelect.options[categorySelect.selectedIndex].value;
|
const categoryName = categorySelect.options[categorySelect.selectedIndex].value;
|
||||||
const category = categories[categoryName];
|
const category = categories[categoryName];
|
||||||
document.getElementById("savepath").value = (category === undefined) ? "" : category["savePath"];
|
savepath.value = (category === undefined) ? "" : category["savePath"];
|
||||||
|
|
||||||
|
useDownloadPath.disabled = true;
|
||||||
|
useDownloadPath.checked = false;
|
||||||
|
changeUseDownloadPath(useDownloadPath);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
document.getElementById("savepath").disabled = false;
|
savepath.disabled = false;
|
||||||
document.getElementById("savepath").value = defaultSavePath;
|
savepath.value = defaultSavePath;
|
||||||
|
|
||||||
|
useDownloadPath.disabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
changeUseDownloadPath(useDownloadPath);
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeUseDownloadPath = (elem) => {
|
||||||
|
const downloadPath = document.getElementById("downloadPath");
|
||||||
|
if (elem.checked) {
|
||||||
|
downloadPath.disabled = false;
|
||||||
|
downloadPath.value = defaultSavePath;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
downloadPath.disabled = true;
|
||||||
|
downloadPath.value = "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -220,6 +242,10 @@ window.qBittorrent.AddTorrent ??= (() => {
|
||||||
getCategories();
|
getCategories();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
document.getElementById("useDownloadPath").addEventListener("change", (e) => changeUseDownloadPath(e.target));
|
||||||
|
});
|
||||||
|
|
||||||
return exports();
|
return exports();
|
||||||
})();
|
})();
|
||||||
Object.freeze(window.qBittorrent.AddTorrent);
|
Object.freeze(window.qBittorrent.AddTorrent);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue