Create a gist now

Instantly share code, notes, and snippets.

@jacquesbh /zimbra.js Secret
Created May 2, 2013

What would you like to do?
zimbra fluid
var counter = 0;
var repeat_all_of = 3;
var over = 400;
var id = 'zti__main_Mail__2_textCell';
var badge = function () {
var field = document.getElementById(id);
var html = field.innerHTML;
var test = /Réception \([0-9]+\)/;
if (test.test(html)) {
var badge = html.replace(/.*Réception \(([0-9]+)\).*/g, "$1");
counter++;
if (window.fluid.dockBadge != badge) {
counter = 0;
window.fluid.requestUserAttention(false);
} else if (counter >= over) {
window.fluid.requestUserAttention(true);
} else if (counter++ % repeat_all_of == 0) {
window.fluid.requestUserAttention(false);
}
window.fluid.dockBadge = badge;
} else {
window.fluid.dockBadge = "";
counter = 0;
}
}
var timing = 5000;
var cron = function() {
badge();
};
window.setInterval(cron, timing);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment