Created
February 28, 2014 15:49
-
-
Save Cyberlane/9273391 to your computer and use it in GitHub Desktop.
If you have TamperMoney installed on your web browser and make use of HuBoard, then you may like this handy script I made. It simple adds totals to each column - maybe in a future version of HuBoard this will no longer be required!
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
// ==UserScript== | |
// @name Counts on HuBoard | |
// @namespace http://www.cyber-lane.com/ | |
// @version 0.1 | |
// @description enter something useful | |
// @include http*://huboard.com/* | |
// @match http://huboard.com/* | |
// @match https://huboard.com/* | |
// @copyright 2014+, You | |
// ==/UserScript== | |
var o = { | |
init: function(){ | |
this.check(); | |
}, | |
check: function(){ | |
var self = this, | |
cols = document.querySelectorAll('.hb-task-column'), | |
length = cols.length; | |
while(length--){ | |
var col = cols[length]; | |
self.count(col, function(total){ | |
self.update(col, total); | |
}); | |
} | |
setTimeout(function(){ | |
self.check(); | |
}, 1000); | |
}, | |
count: function(el, fn) { | |
fn && fn(el.querySelectorAll('ul.sortable li').length); | |
}, | |
update: function(el, n){ | |
var span = el.querySelector('h3.ember-view .text'); | |
var original = span.getAttribute('data-original-text'); | |
if (original === null) { | |
span.setAttribute('data-original-text', span.innerText); | |
original = span.innerText; | |
} | |
span.innerText = original + ' (' + n + ')'; | |
} | |
}; | |
o.init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment