From 8aa8b19f37b0f47ec664fd509ec532dcc6974958 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 1 May 2019 11:46:46 +0800 Subject: [PATCH] Fix "Create subfolder" option is not working in WebUI Closes #10392. --- src/webui/www/private/download.html | 18 ++++++++-------- src/webui/www/private/scripts/download.js | 25 ++++++++++++----------- src/webui/www/private/upload.html | 18 ++++++++-------- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/webui/www/private/download.html b/src/webui/www/private/download.html index ab19a160d..c420a3be9 100644 --- a/src/webui/www/private/download.html +++ b/src/webui/www/private/download.html @@ -72,11 +72,11 @@ - + - - + + @@ -89,10 +89,11 @@ - + - + + @@ -151,6 +152,9 @@ var submitted = false; $('downloadForm').addEventListener("submit", function() { + $('startTorrentHidden').value = $('startTorrent').checked ? 'false' : 'true'; + $('rootFolderHidden').value = $('rootFolder').checked ? 'true' : 'false'; + $('download_spinner').style.display = "block"; submitted = true; }); @@ -159,10 +163,6 @@ if (submitted) window.parent.closeWindows(); }); - - $('start_torrent').addEventListener('change', function() { - $('add_paused').value = !$('start_torrent').checked; - });
diff --git a/src/webui/www/private/scripts/download.js b/src/webui/www/private/scripts/download.js index 4b5bacdb5..ed5d665a8 100644 --- a/src/webui/www/private/scripts/download.js +++ b/src/webui/www/private/scripts/download.js @@ -55,19 +55,20 @@ var getPreferences = function() { alert("Could not contact qBittorrent"); }, onSuccess: function(pref) { - if (pref) { - defaultSavePath = pref.save_path; - $('savepath').setProperty('value', defaultSavePath); - $('root_folder').checked = pref.create_subfolder_enabled; - $('start_torrent').checked = !pref.start_paused_enabled; + if (!pref) + return; - if (pref.auto_tmm_enabled == 1) { - $('autoTMM').selectedIndex = 1; - $('savepath').disabled = true; - } - else { - $('autoTMM').selectedIndex = 0; - } + defaultSavePath = pref.save_path; + $('savepath').setProperty('value', defaultSavePath); + $('rootFolder').checked = pref.create_subfolder_enabled; + $('startTorrent').checked = !pref.start_paused_enabled; + + if (pref.auto_tmm_enabled == 1) { + $('autoTMM').selectedIndex = 1; + $('savepath').disabled = true; + } + else { + $('autoTMM').selectedIndex = 0; } } }).send(); diff --git a/src/webui/www/private/upload.html b/src/webui/www/private/upload.html index 52670b2c6..f00395444 100644 --- a/src/webui/www/private/upload.html +++ b/src/webui/www/private/upload.html @@ -60,11 +60,11 @@ - + - - + + @@ -77,10 +77,11 @@ - + - + + @@ -127,6 +128,9 @@ var submitted = false; $('uploadForm').addEventListener("submit", function() { + $('startTorrentHidden').value = $('startTorrent').checked ? 'false' : 'true'; + $('rootFolderHidden').value = $('rootFolder').checked ? 'true' : 'false'; + $('upload_spinner').style.display = "block"; submitted = true; }); @@ -135,10 +139,6 @@ if (submitted) window.parent.closeWindows(); }); - - $('start_torrent').addEventListener('change', function() { - $('add_paused').value = !$('start_torrent').checked; - });