Skip to content

Instantly share code, notes, and snippets.

@arion
Created March 26, 2013 06:03
Show Gist options
  • Save arion/5243461 to your computer and use it in GitHub Desktop.
Save arion/5243461 to your computer and use it in GitHub Desktop.
IMO.IM userscript for fluid
window.fluid.dockBadge = 0;
setTimeout(updateDockBadge, 500);
setInterval(updateDockBadge, 1000);
function updateDockBadge() {
var elements = document.querySelectorAll(".attention-bubble>span");
var element;
var sumNotice = 0;
for (var i = 0; i < elements.length; i++) {
element = parseInt(elements[i].innerHTML);
if(!isNaN(element)) {
sumNotice = sumNotice + element;
}
}
if(sumNotice > window.fluid.dockBadge) {
window.fluid.playSound("Glass");
}
window.fluid.dockBadge = sumNotice;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment