aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2020-01-19 14:29:50 -0800
committerJames Taylor <user234683@users.noreply.github.com>2020-01-19 14:29:50 -0800
commitc13a8f677dd0e2fe5e3ee260d51e95665d71ba36 (patch)
tree48836ff1fb131e48eae856efed12e0fb535a7e06 /youtube
parenta677b47c4a6dec3b0b214a8d935ada251bd2ee4a (diff)
downloadyt-local-c13a8f677dd0e2fe5e3ee260d51e95665d71ba36.tar.lz
yt-local-c13a8f677dd0e2fe5e3ee260d51e95665d71ba36.tar.xz
yt-local-c13a8f677dd0e2fe5e3ee260d51e95665d71ba36.zip
local playlists: Display error message if no videos are selected or no playlist is chosen when using "add to playlist"
See #4
Diffstat (limited to 'youtube')
-rw-r--r--youtube/templates/base.html10
1 files changed, 10 insertions, 0 deletions
diff --git a/youtube/templates/base.html b/youtube/templates/base.html
index 554e116..4ff83c5 100644
--- a/youtube/templates/base.html
+++ b/youtube/templates/base.html
@@ -155,6 +155,16 @@
var XHR = new XMLHttpRequest();
var FD = new FormData(playlistAddForm);
+ if(FD.getAll('video_info_list').length === 0){
+ displayMessage('Error: No videos selected', true);
+ return;
+ }
+
+ if(FD.get('playlist_name') === ""){
+ displayMessage('Error: No playlist selected', true);
+ return;
+ }
+
// https://stackoverflow.com/questions/48322876/formdata-doesnt-include-value-of-buttons
FD.append('action', 'add');