From ec6e9d50cedc24798e6e951683f30c739230cffa Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Sat, 27 Mar 2021 14:34:58 +0800
Subject: [PATCH] show hour&minute when uploading
---
theme/classic.html | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/theme/classic.html b/theme/classic.html
index 4178de8..8f19cb9 100644
--- a/theme/classic.html
+++ b/theme/classic.html
@@ -825,6 +825,22 @@
}
return num.toFixed(2) + ' GB';
}
+ function seconds2hour(seconds) {
+ let h, m, s;
+ if (parseFloat(seconds)<60) {
+ return seconds + 's';
+ } else {
+ s = (seconds % 60).toFixed(0);
+ m = parseInt(seconds / 60);
+ if (parseInt(m)<60) {
+ return m + 'm' + s + 's';
+ } else {
+ h = parseInt(m / 60);
+ m = m % 60;
+ return h + 'h' + m + 'm' + s + 's';
+ }
+ }
+ }
function uploadbuttonhide() {
document.getElementById('upload_btns').style.display='none';
/*document.getElementById('upload_submit').disabled='disabled';
@@ -859,7 +875,7 @@
if (Object.keys(uploading).length<5) {
getuplink(i);
i++;
- } else console.log(Object.keys(uploading).length);
+ }// else console.log(Object.keys(uploading).length);
} else clearInterval(uploadList);
}, 1000);
//getuplink(i);
@@ -875,7 +891,7 @@
tr1.appendChild(td1);
td1.setAttribute('style','width:30%;word-break:break-word;');
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
- td1.innerHTML=(file.webkitRelativePath||file.name)+'
'+size_format(file.size);
+ td1.innerHTML=(file.webkitRelativePath||file.name)+'
'+size_format(file.size)+' ('+(i+1)+'/'+files.length+')';
td2=document.createElement('td');
tr1.appendChild(td2);
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
@@ -1023,7 +1039,7 @@
var tmptime = new Date();
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
var remaintime = (totalsize-asize-e.loaded)/tmpspeed;
- label.innerHTML=StartStr+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+remaintime.toFixed(1)+'s';
+ label.innerHTML=StartStr+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+seconds2hour(remaintime.toFixed(1));
}
}
var C_starttime = new Date();
@@ -1103,7 +1119,7 @@
if (Object.keys(uploading).length<5) {
getuplink(i);
i++;
- } else console.log(Object.keys(uploading).length);
+ }// else console.log(Object.keys(uploading).length);
} else clearInterval(uploadList);
}, 1000);
//getuplink(i);
@@ -1119,7 +1135,7 @@
tr1.appendChild(td1);
td1.setAttribute('style','width:30%;word-break:break-word;');
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
- td1.innerHTML=(file.webkitRelativePath||file.name)+'
'+size_format(file.size);
+ td1.innerHTML=(file.webkitRelativePath||file.name)+'
'+size_format(file.size)+' ('+(i+1)+'/'+files.length+')';
td2=document.createElement('td');
tr1.appendChild(td2);
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
@@ -1313,7 +1329,7 @@
var tmptime = new Date();
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
var remaintime = (totalsize-asize-e.loaded)/tmpspeed;
- label.innerHTML=StartStr+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+remaintime.toFixed(1)+'s';
+ label.innerHTML=StartStr+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+seconds2hour(remaintime.toFixed(1));
}
}
var C_starttime = new Date();