Created
October 27, 2015 00:42
-
-
Save elecay/7e122c38ba39224ccf99 to your computer and use it in GitHub Desktop.
Video total time to watch for a week on a Coursera Course
This file contains hidden or 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
/* | |
A quick way to know how many hours and minutes you have to watch for a week on a Coursera course. | |
Just copy and paste this code on your console on a Course Content Week page. | |
How to open your console you say?: | |
- On Chrome: https://developers.google.com/web/tools/chrome-devtools/debug/console/console-ui?hl=en | |
- On Safari: https://developer.apple.com/library/mac/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/GettingStarted/GettingStarted.html | |
- On Firefox: https://developer.mozilla.org/es/docs/Tools/Web_Console | |
*/ | |
var effort = $('.rc-EffortText'); | |
var week = $('.c-selected span').text(); | |
var course = $('.rc-CourseHeader .headline-1-text').text(); | |
var totalTime = 0; | |
for (var i = 0; i < effort.length; i++) { | |
var time = $(effort[i]).text(); | |
var minutes = time.split(' min'); | |
minutes = minutes.length > 1 ? minutes[0] : 0; | |
totalTime += Number(minutes); | |
} | |
var hours = Math.floor(totalTime / 60); | |
var min = (totalTime % 60); | |
alert('Total time for ' + week + ' of ' + course + ' => ' + hours + ' hour(s) and ' + min + ' minute(s).'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment