I'll say I don't know javascript very well, however some examples I'm seeing have the syntax slightly different.
https://gist.github.com/tayles/283940/542f837422fde5873382beb6bda71dd1037049c1#file-platform-js-L20 https://gist.github.com/jboonstra/1051327#file-turntable-user-js-L27 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. Also your english is fine, don't worry about it. If you at some point need to explain in another language we do have people on this list who can help translate, and we can figure things out. Your english itself is great though, no apologies necessary. :) On Wed, Nov 21, 2018 at 10:35 AM Jorge Luis Genova < [email protected]> wrote: > Hello everyone, first, sorry for my english, and also I'm not a devolper > or anything, I just search info in google and try make it work. I'm trying > to have Asana (Fluid App) with notifications. > > I was able to have a badge, a sound, and a bouncing icon in the dock when > I have a new alert in the Asana Inbox (please se attachment 1). > But I can't make growl notifications to work. > > This is de userscript working (sound, badge and bouncing icon): > > // 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(); > })(); > > > > > > And then I try to add notification like this, what am I doing wrong? : > > // 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(); > })(); > > > > I do have latest growl installed on mac os high sierra. All enabled, I > tried the growl option "OS X notification" on and off. > > Any idea? Thank you very much! > > > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/growldiscuss. > For more options, visit https://groups.google.com/d/optout. > -- Chris Forsythe -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/growldiscuss. For more options, visit https://groups.google.com/d/optout.
