Last active
January 16, 2018 21:33
-
-
Save raik/76c9e7a2899a7cf916986987d18e48e6 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
| (function(){ | |
| let lists = document.querySelectorAll('.js-list') | |
| Array.from(lists).forEach(function(el, index, array) { | |
| let spans = el.querySelectorAll('span.badge-text') | |
| let sum = 0 | |
| Array.from(spans).forEach(function(el, index, array) { | |
| let str = el.innerText | |
| let re = /estimate\:\s+([+-]?([0-9]*[.])?[0-9]+)$/i; | |
| let nr = str.match(re) | |
| if (nr) { | |
| sum += Number(nr[1]) | |
| } | |
| }) | |
| let title = el.querySelector('.js-list-name-assist') | |
| title.insertAdjacentHTML('afterend', '<strong>Total: ' + sum + '</strong>') | |
| }) | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment