From 3aeca37c5d8d18d0f204b433c6e6e71638611204 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 3d2bc6b0d..771c777f3 100644 --- a/src/webui/www/private/download.html +++ b/src/webui/www/private/download.html @@ -72,11 +72,11 @@ - + - - + + @@ -89,10 +89,11 @@ - + - + + @@ -149,6 +150,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; }); @@ -157,10 +161,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 049e98741..45279c01b 100644 --- a/src/webui/www/private/scripts/download.js +++ b/src/webui/www/private/scripts/download.js @@ -53,19 +53,20 @@ 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 3adacebae..d89d3b669 100644 --- a/src/webui/www/private/upload.html +++ b/src/webui/www/private/upload.html @@ -60,11 +60,11 @@ - + - - + + @@ -77,10 +77,11 @@ - + - + + @@ -125,6 +126,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; }); @@ -133,10 +137,6 @@ if (submitted) window.parent.closeWindows(); }); - - $('start_torrent').addEventListener('change', function() { - $('add_paused').value = !$('start_torrent').checked; - });