Fixed progressbar on page reload
authorRemixDev <deezloaderremix@gmail.com>
Sat, 16 Mar 2019 18:07:59 +0000 (19:07 +0100)
committerRemixDev <deezloaderremix@gmail.com>
Sat, 16 Mar 2019 18:07:59 +0000 (19:07 +0100)
app/public/js/frontend.js

index 515db156cde7e0b95da8e1261e9be44682221b50..bdf1eb1920656efce2b389a8a24cdd03fa7cea19 100644 (file)
@@ -1076,7 +1076,7 @@ function addObjToQueue(data){
                        <td class="queueSize">${data.size}</td>
                        <td class="queueDownloaded">${data.downloaded}</td>
                        <td class="queueFailed">${data.failed}</td>
-                       <td><div class="progress"><div class="indeterminate"></div></div></td>
+                       <td><div class="progress"><div class="changeThis indeterminate"></div></div></td>
                        </tr>`)
 
        var btn_remove = $('<a href="#" class="btn-flat waves-effect"><i class="material-icons">remove</i></a>')
@@ -1101,7 +1101,7 @@ socket.on("downloadStarted", function (data) {
        //data.queueId -> queueId of started download
 
        //Switch progress type indeterminate to determinate
-       $('#' + data.queueId).find('.indeterminate').removeClass('indeterminate').addClass('determinate')
+       $('#' + data.queueId).find('.changeThis').removeClass('indeterminate').addClass('determinate')
        $('#' + data.queueId).find('.eventBtn').find('a').html('<i class="material-icons">clear</i>')
 
 })
@@ -1134,7 +1134,9 @@ socket.on("downloadProgress", function (data) {
        //data.queueId -> id (string)
        //data.percentage -> float/double, percentage
        //updated in 1% steps
-       $('#' + data.queueId).find('.determinate').css('width', data.percentage + '%')
+       let progressbar = $('#' + data.queueId).find('.changeThis')
+       if (progressbar.hasClass('indeterminate')) progressbar.removeClass('indeterminate').addClass('determinate')
+       $('#' + data.queueId).find('.changeThis').css('width', data.percentage + '%')
 
 })