From 3339bf87bc3be294c378d1d464adb3665a9b8475 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Sat, 18 Apr 2020 14:59:58 +0200 Subject: [PATCH] Implemented download selection --- public/index.html | 2 +- public/js/app/app.js | 9 +-------- public/js/app/search.js | 11 +++++++++-- public/js/app/stackedTabs.js | 11 ++++++++++- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/public/index.html b/public/index.html index c5f3ac7..06fec72 100644 --- a/public/index.html +++ b/public/index.html @@ -436,7 +436,7 @@

{{ metadata }}{{ rele {{ label }} diff --git a/public/js/app/app.js b/public/js/app/app.js index 9635263..69d3eb7 100644 --- a/public/js/app/app.js +++ b/public/js/app/app.js @@ -221,13 +221,6 @@ function openQualityModal(link){ function modalQualityButton(bitrate){ var url=$(modalQuality).data("url") - if (url.indexOf(";") != -1){ - urls = url.split(";") - urls.forEach(url=>{ - sendAddToQueue(url, bitrate) - }) - }else{ - sendAddToQueue(url, bitrate) - } + sendAddToQueue(url, bitrate) $(modalQuality).addClass('animated fadeOut') } diff --git a/public/js/app/search.js b/public/js/app/search.js index 4058a82..de054a8 100644 --- a/public/js/app/search.js +++ b/public/js/app/search.js @@ -53,7 +53,14 @@ function clickElement(button) { } function sendAddToQueue(url, bitrate = null) { - socket.emit('addToQueue', { url: url, bitrate: bitrate }) + if (url.indexOf(";") != -1){ + urls = url.split(";") + urls.forEach(url=>{ + socket.emit('addToQueue', { url: url, bitrate: bitrate }) + }) + }else{ + socket.emit('addToQueue', { url: url, bitrate: bitrate }) + } } let MainSearch = new Vue({ @@ -173,7 +180,7 @@ $("#searchbar").keyup(function(e){ } }else{ console.log( term ); - + if (term != MainSearch.results.QUERY || main_selected == 'search_tab'){ document.getElementById("search_tab_content").style.display = "none"; socket.emit("mainSearch", {term: term}); diff --git a/public/js/app/stackedTabs.js b/public/js/app/stackedTabs.js index 974a3ea..13359ab 100644 --- a/public/js/app/stackedTabs.js +++ b/public/js/app/stackedTabs.js @@ -69,11 +69,20 @@ var tracklistTab = new Vue({ addToQueue: function(e){e.stopPropagation(); sendAddToQueue(e.currentTarget.dataset.link)}, openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)}, toggleAll: function(e){ - tracklistTab.body.forEach((item) => { + this.body.forEach((item) => { if (item.type == 'track'){ item.selected = e.currentTarget.checked } }); + }, + selectedLinks: function(){ + selected = [] + if (this.body){ + this.body.forEach((item) => { + if (item.type == 'track' && item.selected) selected.push(item.link) + }) + } + return selected.join(";") } } })