]> git.wh0rd.org Git - tt-rss.git/commitdiff
add a simple JS-based hook host
authorAndrew Dolgov <fox@fakecake.org>
Wed, 24 Apr 2013 15:49:37 +0000 (19:49 +0400)
committerAndrew Dolgov <fox@fakecake.org>
Wed, 24 Apr 2013 15:49:37 +0000 (19:49 +0400)
index.php
js/feedlist.js
js/tt-rss.js
js/viewfeed.js

index bf78be1f3c1f7c0a8616f2ef10dbb54038d695d2..6a34be5e8022e7bfd9c0bd7d88277824d053dcce 100644 (file)
--- a/index.php
+++ b/index.php
                require 'lib/jshrink/Minifier.php';
 
                print get_minified_js(array("tt-rss",
-                       "functions", "feedlist", "viewfeed", "FeedTree"));
+                       "functions", "feedlist", "viewfeed", "FeedTree", "PluginHost"));
 
                foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
                        if (method_exists($p, "get_js")) {
index f4e07517e147964f9c1c219407ccbf930ced30da..2c1acc310be97cbca71c0d0df5dc739c4e24f8db 100644 (file)
@@ -139,6 +139,7 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) {
                        onComplete: function(transport) {
                                setFeedExpandoIcon(feed, is_cat, 'images/blank_icon.gif');
                                headlines_callback2(transport, offset, background, infscroll_req);
+                               PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]);
                        } });
 
        } catch (e) {
index 9e4cb63cec0512612807d5d425e25ceea7166526..3f8545149a11960928ec72866359afbbdfd3ebf0 100644 (file)
@@ -40,6 +40,8 @@ function setActiveFeedId(id, is_cat) {
                $("headlines-frame").setAttribute("is-cat", is_cat ? 1 : 0);
 
                selectFeed(id, is_cat);
+
+               PluginHost.run(PluginHost.HOOK_FEED_SET_ACTIVE, _active_article_id);
        } catch (e) {
                exception_error("setActiveFeedId", e);
        }
index ddee1e461c666107f569e17dc2dfd394a8132263..14ef2f8168826780aedcd80c4cdbd76372e16f71 100644 (file)
@@ -232,6 +232,8 @@ function render_article(article) {
                        c.domNode.scrollTop = 0;
                } catch (e) { };
 
+               PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, article);
+
                c.attr('content', article);
 
                correctHeadlinesOffset(getActiveArticleId());
@@ -1193,6 +1195,7 @@ function cdmScrollToArticleId(id, force) {
 
 function setActiveArticleId(id) {
        _active_article_id = id;
+       PluginHost.run(PluginHost.HOOK_ARTICLE_SET_ACTIVE, _active_article_id);
 }
 
 function getActiveArticleId() {
@@ -1219,6 +1222,8 @@ function unpackVisibleHeadlines() {
                                        var cencw = $("CENCW-" + child.id.replace("RROW-", ""));
 
                                        if (cencw) {
+                                               PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, child);
+
                                                cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML);
                                                cencw.setAttribute('id', '');
                                                Element.show(cencw);