-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnano.save
41 lines (30 loc) · 844 Bytes
/
nano.save
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
times = document.getElementsByClassName('style-scope ytd-thumbnail-overlay-time-status-renderer');
total_time = 0;
for(i=1;i<times.length;i+=2)
{
curr_time = times[i].innerText.trim();
curr_time_list = curr_time.split(':');
if(curr_time_list.length < 2)
{
// Add 0 minute
curr_time_list = [0].concat(curr_time_list);
}
if(curr_time_list.length < 3)
{
// Add 0 hour
curr_time_list = [0].concat(curr_time_list);
}
curr_seconds = curr_time_list[0]*60*60 + curr_time_list[1]*60 + curr_time_list[2]*1;
total_time += curr_seconds;
}
total_hours = 0
if(total_time>=3600)
{
total_hours = Math.floor(total_time / 3600);
total_time %= 3600;
}
total_minutes = 0
if(total_time>60)
total_minutes = Math.floor(total_time / 60);
total_seconds = total_time % 60;
console.log(total_hours,":",total_minutes,":",total_seconds);