Created
May 13, 2015 08:51
-
-
Save gido/f14e149bd382d63c6b0a to your computer and use it in GitHub Desktop.
Bookmarlet to display/preview the total hours in Harvest Estimate
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 totalH = 0; | |
var hours = document.getElementsByClassName('item-qty desktop'); | |
Array.prototype.forEach.call(hours, function(el) { totalH += parseFloat(el.innerHTML); }); | |
var totalRow = document.querySelector('tr.total'); | |
var totalLabelCol = document.querySelector('tr.total td.label'); | |
var totalAmoundCol = document.querySelector('tr.total td.total'); | |
var totalHoursCol = document.createElement('td'); | |
totalHoursCol.innerHTML = totalH; | |
totalRow.insertBefore(totalHoursCol, totalAmoundCol); | |
totalLabelCol.setAttribute('colspan', 2); | |
totalAmoundCol.setAttribute('colspan', 2); |
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
<html> | |
<head> | |
<title>Install my Harvest bookmarklet</title> | |
</head> | |
<body> | |
<h2>Bookmarlet to display/preview the total hours in Harvest Estimate</h2> | |
<p> | |
Drag the following link into your favorite bar to install: | |
<a href="javascript:(function(){var totalH=0;var hours=document.getElementsByClassName('item-qty desktop');Array.prototype.forEach.call(hours,function(el){totalH+=parseFloat(el.innerHTML);});var totalRow=document.querySelector('tr.total');var totalLabelCol=document.querySelector('tr.total td.label');var totalAmoundCol=document.querySelector('tr.total td.total');var totalHoursCol=document.createElement('td');totalHoursCol.innerHTML=totalH;totalRow.insertBefore(totalHoursCol,totalAmoundCol);totalLabelCol.setAttribute('colspan',2);totalAmoundCol.setAttribute('colspan',2);})();">Harvest Add Total Hours</a> | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment