Skip to content

Instantly share code, notes, and snippets.

@grahams
Last active December 20, 2015 09:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahams/6108514 to your computer and use it in GitHub Desktop.
Save grahams/6108514 to your computer and use it in GitHub Desktop.
Fluid userscript for Feedly to badge the dock icon with a better count (instead of maxing out at 100+)
(function() {
// Load the script
var script = document.createElement("SCRIPT");
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
script.type = 'text/javascript';
document.getElementsByTagName("head")[0].appendChild(script);
// Poll for jQuery to come into existance
var checkReady = function(callback) {
if (window.jQuery) {
callback(jQuery);
}
else {
window.setTimeout(function() { checkReady(callback); }, 100);
}
};
// Start polling...
checkReady(function($) {
window.fluid.dockBadge = '';
setInterval(updateDockBadge, 2000);
function updateDockBadge() {
var count = parseInt($("#latesttab .staticSimpleUnreadCount").html(), 10)
if((count === 0) || (isNaN(count))) {
window.fluid.dockBadge = '';
}
else {
window.fluid.dockBadge = count;
}
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment