From a400a8ffc1a5c8a5c4ecb2c0d153881f5b55d232 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 8 Dec 2018 20:06:07 +0300 Subject: [PATCH] add PluginHost.HOOK_INIT_COMPLETE (and make no_title_counters use it) --- js/PluginHost.js | 1 + js/tt-rss.js | 5 +++-- plugins/no_title_counters/init.js | 8 +++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/js/PluginHost.js b/js/PluginHost.js index 8e5ff32ec..c188531f8 100644 --- a/js/PluginHost.js +++ b/js/PluginHost.js @@ -11,6 +11,7 @@ PluginHost = { HOOK_PARAMS_LOADED: 8, HOOK_RUNTIME_INFO_LOADED: 9, HOOK_FLOATING_TITLE: 10, + HOOK_INIT_COMPLETE: 11, hooks: [], register: function (name, callback) { if (typeof(this.hooks[name]) == 'undefined') diff --git a/js/tt-rss.js b/js/tt-rss.js index 402160e02..ed194c702 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -117,8 +117,6 @@ require(["dojo/_base/kernel", } }); - Cookie.delete("ttrss_test"); - const toolbar = document.forms["toolbar-main"]; dijit.getEnclosingWidget(toolbar.view_mode).attr('value', @@ -147,6 +145,9 @@ require(["dojo/_base/kernel", } console.log("second stage ok"); + + PluginHost.run(PluginHost.HOOK_INIT_COMPLETE, null); + }, updateTitle: function() { let tmp = "Tiny Tiny RSS"; diff --git a/plugins/no_title_counters/init.js b/plugins/no_title_counters/init.js index 1170bf3ef..6c0cb38e2 100644 --- a/plugins/no_title_counters/init.js +++ b/plugins/no_title_counters/init.js @@ -1,7 +1,9 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { ready(function () { - App.updateTitle = function () { - document.title = "Tiny Tiny RSS"; - }; + PluginHost.register(PluginHost.HOOK_INIT_COMPLETE, () => { + App.updateTitle = function () { + document.title = "Tiny Tiny RSS"; + }; + }); }); });