// For use with fluidapp.com (pro version)// For Google Chrome/Firefox/Safari: https://greasyfork.org/en/scripts/6118-asana-notifications-favicon
(function() { // changes the favicon. avoids setting the same favicon twice. function updateFavicon(unread) { if(this.lastState != unread) { // ensures we're not changing the icon all the time window.fluid.dockBadge = unread ? '★' : ''; window.fluid.requestUserAttention(true); window.fluid.playSound("Tink") ; this.lastState = unread; } } // checks read count and updates favicon if necessary function updateRead(title) { var unread = title.indexOf("●") == 0; updateFavicon(unread); } // observes any changes in the title and checks for the unread mark function install() { var titleNode = document.querySelector('head > title'); this.observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { var newTitle = mutation.target.textContent; updateRead(newTitle); }); }); observer.observe(titleNode, { subtree: true, characterData: true, childList: true }); // options counter-intuitive to me, but are required, not too expensive updateRead(document.title); // make sure it's up to date before first event } install();})();
// For use with fluidapp.com (pro version)// For Google Chrome/Firefox/Safari: https://greasyfork.org/en/scripts/6118-asana-notifications-favicon
(function() { // changes the favicon. avoids setting the same favicon twice. function updateFavicon(unread) { if(this.lastState != unread) { // ensures we're not changing the icon all the time window.fluid.dockBadge = unread ? '★' : ''; window.fluid.requestUserAttention(true); window.fluid.playSound("Tink") ; window.fluid.showGrowlNotification({ title: "Title", description: "Description" }); this.lastState = unread; } } // checks read count and updates favicon if necessary function updateRead(title) { var unread = title.indexOf("●") == 0; updateFavicon(unread); } // observes any changes in the title and checks for the unread mark function install() { var titleNode = document.querySelector('head > title'); this.observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { var newTitle = mutation.target.textContent; updateRead(newTitle); }); }); observer.observe(titleNode, { subtree: true, characterData: true, childList: true }); // options counter-intuitive to me, but are required, not too expensive updateRead(document.title); // make sure it's up to date before first event } install();})();
--
You received this message because you are subscribed to the Google Groups "Growl Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growldiscuss...@googlegroups.com.
To post to this group, send email to growld...@googlegroups.com.
Visit this group at https://groups.google.com/group/growldiscuss.
For more options, visit https://groups.google.com/d/optout.
"I'd suggest trying to make a simple sample app which is like this to see if you can fire a notification, then trying to graft it onto what you're doing."