Skip to content

Instantly share code, notes, and snippets.

@jacquesbh
Created May 2, 2013 11:57
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 jacquesbh/1353873b8c13970af60d to your computer and use it in GitHub Desktop.
Save jacquesbh/1353873b8c13970af60d to your computer and use it in GitHub Desktop.
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