Created
July 8, 2016 10:47
-
-
Save Naoray/567de3d395c93485d790f9d3a2c1977f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var time = ''; | |
var hour = 0; | |
var min = 0; | |
var sec = 0; | |
$.each($('.Lesson-List__length'), function(i, el) { | |
min += parseInt($(el).text().split(':')[0]); | |
sec += parseInt($(el).text().split(':')[1]); | |
if(sec >= 60) { | |
min += parseInt(sec/60); | |
sec %= 60; | |
} | |
if(min >= 60) { | |
hour += parseInt(min/60); | |
min %= 60; | |
} | |
}); | |
time = 'It will take me ' + ((hour.toString().length == 1) ? '0' + hour : hour) + ':' + ((min.toString().length == 1) ? '0' + min : min) + ':' + ((sec.toString().length == 1) ? '0' + sec: sec) + ' hours to watch all those videos!'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment