Implemented download selection

This commit is contained in:
RemixDev 2020-04-18 14:59:58 +02:00
parent 20ae210fd0
commit 3339bf87bc
4 changed files with 21 additions and 12 deletions

View File

@ -436,7 +436,7 @@ <h2><span v-if="metadata">{{ metadata }}</span><span v-if="release_date">{{ rele
<span v-if="label" style="opacity: 0.40;margin-top: 8px;display: inline-block;font-size: 13px;">{{ label }}</span> <span v-if="label" style="opacity: 0.40;margin-top: 8px;display: inline-block;font-size: 13px;">{{ label }}</span>
<footer> <footer>
<button v-on:contextmenu="openQualityModal(event)" v-on:click="addToQueue(event)" v-bind:data-link="link">Download {{ type }}</button> <button v-on:contextmenu="openQualityModal(event)" v-on:click="addToQueue(event)" v-bind:data-link="link">Download {{ type }}</button>
<button>Download selection<i class="material-icons right">file_download</i></button> <button v-on:contextmenu="openQualityModal(event)" v-on:click="addToQueue(event)" v-bind:data-link="selectedLinks()">Download selection<i class="material-icons right">file_download</i></button>
<button onclick="backTab()">Back</button> <button onclick="backTab()">Back</button>
</footer> </footer>
</div> </div>

View File

@ -221,13 +221,6 @@ function openQualityModal(link){
function modalQualityButton(bitrate){ function modalQualityButton(bitrate){
var url=$(modalQuality).data("url") var url=$(modalQuality).data("url")
if (url.indexOf(";") != -1){
urls = url.split(";")
urls.forEach(url=>{
sendAddToQueue(url, bitrate) sendAddToQueue(url, bitrate)
})
}else{
sendAddToQueue(url, bitrate)
}
$(modalQuality).addClass('animated fadeOut') $(modalQuality).addClass('animated fadeOut')
} }

View File

@ -53,7 +53,14 @@ function clickElement(button) {
} }
function sendAddToQueue(url, bitrate = null) { function sendAddToQueue(url, bitrate = null) {
if (url.indexOf(";") != -1){
urls = url.split(";")
urls.forEach(url=>{
socket.emit('addToQueue', { url: url, bitrate: bitrate }) socket.emit('addToQueue', { url: url, bitrate: bitrate })
})
}else{
socket.emit('addToQueue', { url: url, bitrate: bitrate })
}
} }
let MainSearch = new Vue({ let MainSearch = new Vue({

View File

@ -69,11 +69,20 @@ var tracklistTab = new Vue({
addToQueue: function(e){e.stopPropagation(); sendAddToQueue(e.currentTarget.dataset.link)}, addToQueue: function(e){e.stopPropagation(); sendAddToQueue(e.currentTarget.dataset.link)},
openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)}, openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)},
toggleAll: function(e){ toggleAll: function(e){
tracklistTab.body.forEach((item) => { this.body.forEach((item) => {
if (item.type == 'track'){ if (item.type == 'track'){
item.selected = e.currentTarget.checked 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(";")
} }
} }
}) })