Added progress bar

This commit is contained in:
RemixDev
2020-04-10 23:04:05 +02:00
parent c9b3588105
commit 4fafed97a9
4 changed files with 119 additions and 4 deletions

View File

@@ -114,8 +114,7 @@ var mainSearch = new Vue({
if (section != "TOP_RESULT")
clickElement('search_'+section.toLowerCase()+'_tab')
},
addToQueue: function(url){socket.emit("addToQueue", {url: url})
console.log(url)}
addToQueue: function(url){socket.emit("addToQueue", {url: url})}
}
})

View File

@@ -16,16 +16,21 @@ socket.on("addedToQueue", function(queueItem){
<span class="download_line"><span class="queue_downloaded">0</span>/${queueItem.size}</span>
</div>
</div>
<div class="download_bar progress" id="bar-uuid"></div>
<div class="download_bar progress"><div id="bar_${queueItem.uuid}" class="indeterminate"></div></div>
</div>`)
})
socket.on("startDownload", function(uuid){
$('#bar_' + uuid).removeClass('indeterminate').addClass('determinate')
})
socket.on("updateQueue", function(update){
if (update.uuid && queue.indexOf(update.uuid) > -1){
console.log(update)
if (update.downloaded){
queueList[update.uuid].downloaded++
$("#download_"+update.uuid+" .queue_downloaded").text(queueList[update.uuid].downloaded)
$('#bar_' + update.uuid).css('width', ((queueList[update.uuid].downloaded + queueList[update.uuid].failed) / queueList[update.uuid].size)*100 + '%')
}
if (update.failed){
queueList[update.uuid].failed++