Skip to content

Instantly share code, notes, and snippets.

@joom
Created April 4, 2014 20:50
Show Gist options
  • Save joom/9982861 to your computer and use it in GitHub Desktop.
Save joom/9982861 to your computer and use it in GitHub Desktop.
Wesleyan University Timeclock Total Hours Calculator
/*
//Human readable version:
var frame = document.querySelectorAll('frame')[1].contentWindow.document;
var list = Array.prototype.slice.call(frame.querySelectorAll('center tr'));
list = list.slice(1);
list.map(function(tr) {
return parseFloat(tr.querySelectorAll('td:nth-child(4)')[0].innerText);
}).reduce(function(pre, cur){
return pre + cur;
});
*/
//minified version:
Array.prototype.slice.call(document.querySelectorAll("frame")[1].contentWindow.document.querySelectorAll("center tr")).slice(1).map(function(e){return parseFloat(e.querySelectorAll("td:nth-child(4)")[0].innerText)}).reduce(function(e,t){return e+t})
@joom
Copy link
Author

joom commented Apr 4, 2014

Copy the minified line to JavaScript console when you are in the Timeclock page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment