Last active
October 26, 2018 10:25
-
-
Save atomita/95aaceebef5910d36eea87bfa4fd4083 to your computer and use it in GitHub Desktop.
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
| [].map.call(document.getElementsByTagName("table"),table => { | |
| try { | |
| let task = table.children[0].children[0].children[0].textContent | |
| if ("task" == task) { | |
| return [].map.call(table.children[1].children, record => { | |
| let spend = record.children[2] | |
| let text = spend.childNodes[0] | |
| let times = text.nodeValue | |
| if (times && /\d+:\d+(:\d+)?(\s*\+\s*\d+:\d+(:\d+)?)*/.test(times)) { | |
| spend.innerText = [ | |
| times.split(/\s*\+\s*/).map( | |
| (v) => [ | |
| v.split(":") | |
| ].reduce((_,[h,m=0,s=0]) => h*60**2+m*60+s, 0) | |
| ) | |
| .reduce((acc,v)=>acc+v, 0) | |
| ].reduce((_,v) => Math.floor(v/60**2) + ":" + ("0"+v%60**2/60).slice(-2) + ":" + ("0"+(v%60**2)%60).slice(-2), 0) | |
| } | |
| }) | |
| } | |
| } catch (e) {} | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment