Skip to content

Instantly share code, notes, and snippets.

@q0rban
Last active September 29, 2015 21:27
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 q0rban/1671089 to your computer and use it in GitHub Desktop.
Save q0rban/1671089 to your computer and use it in GitHub Desktop.
Fluid Userscript for Yammer
// ==UserScript==
// @name fluid-dock-badge
// @namespace http://fluidapp.com
// @description Dock badge for unread messages on Yammer.com
// @include *
// @author Joe Shindelar (eojthebrave)
// ==/UserScript==
(function ($) {
if (window.fluid) {
setInterval(dockBadge, 5000);
}
function dockBadge() {
var msg = jQuery('.yj-new-messages-link:visible span:last').html();
if (msg != null) {
var count = msg.replace(/.*\s([0-9]*)\s.*/, '$1');
if (count.length) {
window.fluid.dockBadge = count;
}
else {
window.fluid.dockBadge = "";
}
// Clear the badge immediatly when someone clicks the banner.
jQuery('.yj-new-messages-link:visible span:last').click(function() {
window.fluid.dockBadge = "";
})
}
else {
window.fluid.dockBadge = "";
}
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment