Skip to content

Instantly share code, notes, and snippets.

@Cyberlane
Created February 28, 2014 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cyberlane/9273391 to your computer and use it in GitHub Desktop.
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!
// ==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