Tiny Tiny RSS: Community

How to retrieve App from js in plugins?



[sorry I’m a javascript noob]

I’ve written a small plugin to add a new hotkey which toggle feeds sorting by title. It was working fine until the recents changes. I’ve pushed it here for reference:

I’ve tried to update init.js using no_title_counter plugin as an example without any luck:

require(['dojo/_base/kernel', 'dojo/ready', 'fox/AppBase'], function (dojo, ready) {
	ready(function() {
		console.log("> plugin toggle_sort_titles init.js");
		App.hotkey_actions["feed_toggle_title"] = function() {
			console.log("trigger feed_toggle_title");

console log:

> plugin toggle_sort_titles init.js
TypeError: App is undefined
Stack trace:

By the way the no_title_counter plugin is failing to for the very same reason too :wink:

I really should start learning javascript…


Scriptaliculous/controls.js failing to load after recent updates: breaking plugins?

see here:


Waoo that was fast :slight_smile:

It works perfectly except that it looks like that only one callback could be registered for HOOK_INIT_COMPLETE. My function stops to be called as soon as I enable no_title_counter plugin at the same time.

That’s better with this:

--- a/js/PluginHost.js
+++ b/js/PluginHost.js
@@ -24,8 +24,9 @@ PluginHost = {
                //console.warn('PluginHost::run ' + name);
                if (typeof(this.hooks[name]) != 'undefined')
-                       for (let i = 0; i < this.hooks[name].length; i++)
-                               if (!this.hooks[name][i](args)) break;
+                       for (let i = 0; i < this.hooks[name].length; i++) {
+                               this.hooks[name][i](args);
+                       }


I’ve made a pull request for the PluginHost fix: https://git.tt-rss.org/fox/tt-rss/pulls/94


And for reference, I’ve updated my branch with the working hotkey plugin: https://git.tt-rss.org/ggrandou/tt-rss/commit/f9d6ac88527444770b7bcaba2c35f62acf9d65da