Tiny Tiny RSS: Community

Favicon Badge Plugin

If you are interested, I have rewritten the plugin to use the new HOOK_COUNTERS_PROCESSED PluginHost and getting the number from App.global_unread instead of parsing the article and relying on a MutationObserver. Works for me™

I forgot, fox doesn’t smile. =P

Pull requests welcome, kinda? Or put it up as a plugin named similarly but not exactly the same.

I’ve noticed this plugin frequently misses single-article notifications and the like, it could certainly use a better hook to run from.

that’s interesting, does the hook actually run? in my experience dealing with favicon at runtime has always been a really finicky business, i remember having to add bullshit setTimeout()s to make it work, maybe.

As I do not use GitHub and the rewritten version is rather small (everything else is unchanged):

require(['dojo/_base/kernel', 'dojo/ready', '/plugins.local/favicon_badge/favico.min.js'], function (dojo,  ready, Favico) {
  let favicon = new Favico({
    animation : 'none'
  });

  PluginHost.register(PluginHost.HOOK_COUNTERS_PROCESSED, () => {
    parseInt(App.global_unread) > 0 ? favicon.badge(App.global_unread) : favicon.reset();
  });
});

Feel free the make any additions/corrections. I am not familiar with Dojo so hopefully I used require correctly.

parseInt(…) > 0 ?

/20char

Thanks, makes the script even shorter. Original post edited accordingly.

OK, I’ve git pull’ed the latest tt-rss, and fox must have been smiling down on me because I didn’t lose all my articles.

The badge plugin still seems to work though.
Can you get me some more information? This plugin was working for you previously, and you upgraded recently and it stopped? Please double check for me that the plugin is turned on in the preferences window.

I have the plugin activated. but it just doesn’t seem to work, and I’m not sure why either. As I said all I did was upgrade TinyTinyRss

Sorry it took me a while to get back to you, as my life has been hectic as of late.

Did you copy the code from my post to the init.js file? (as always: backup first)

Also check that the last part of the require command ('/plugins.local/favicon_badge/favico.min.js') matches the location of your plugin path.

Do I just copy over top of everything in the original file?

Yes, the other two files are left unchanged.

YAY it Worked!!! Thank you so much!!!

I’ve been using @aeritir’s method for the past while, and it works well and I like it a lot better! I updated the plugin to use it.

Thank you for the update and the credits. :+1: