mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 18:55:55 +00:00
add a simple JS-based hook host
This commit is contained in:
@@ -100,7 +100,7 @@
|
|||||||
require 'lib/jshrink/Minifier.php';
|
require 'lib/jshrink/Minifier.php';
|
||||||
|
|
||||||
print get_minified_js(array("tt-rss",
|
print get_minified_js(array("tt-rss",
|
||||||
"functions", "feedlist", "viewfeed", "FeedTree"));
|
"functions", "feedlist", "viewfeed", "FeedTree", "PluginHost"));
|
||||||
|
|
||||||
foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
|
foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
|
||||||
if (method_exists($p, "get_js")) {
|
if (method_exists($p, "get_js")) {
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) {
|
|||||||
onComplete: function(transport) {
|
onComplete: function(transport) {
|
||||||
setFeedExpandoIcon(feed, is_cat, 'images/blank_icon.gif');
|
setFeedExpandoIcon(feed, is_cat, 'images/blank_icon.gif');
|
||||||
headlines_callback2(transport, offset, background, infscroll_req);
|
headlines_callback2(transport, offset, background, infscroll_req);
|
||||||
|
PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]);
|
||||||
} });
|
} });
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ function setActiveFeedId(id, is_cat) {
|
|||||||
$("headlines-frame").setAttribute("is-cat", is_cat ? 1 : 0);
|
$("headlines-frame").setAttribute("is-cat", is_cat ? 1 : 0);
|
||||||
|
|
||||||
selectFeed(id, is_cat);
|
selectFeed(id, is_cat);
|
||||||
|
|
||||||
|
PluginHost.run(PluginHost.HOOK_FEED_SET_ACTIVE, _active_article_id);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("setActiveFeedId", e);
|
exception_error("setActiveFeedId", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,6 +232,8 @@ function render_article(article) {
|
|||||||
c.domNode.scrollTop = 0;
|
c.domNode.scrollTop = 0;
|
||||||
} catch (e) { };
|
} catch (e) { };
|
||||||
|
|
||||||
|
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, article);
|
||||||
|
|
||||||
c.attr('content', article);
|
c.attr('content', article);
|
||||||
|
|
||||||
correctHeadlinesOffset(getActiveArticleId());
|
correctHeadlinesOffset(getActiveArticleId());
|
||||||
@@ -1193,6 +1195,7 @@ function cdmScrollToArticleId(id, force) {
|
|||||||
|
|
||||||
function setActiveArticleId(id) {
|
function setActiveArticleId(id) {
|
||||||
_active_article_id = id;
|
_active_article_id = id;
|
||||||
|
PluginHost.run(PluginHost.HOOK_ARTICLE_SET_ACTIVE, _active_article_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getActiveArticleId() {
|
function getActiveArticleId() {
|
||||||
@@ -1219,6 +1222,8 @@ function unpackVisibleHeadlines() {
|
|||||||
var cencw = $("CENCW-" + child.id.replace("RROW-", ""));
|
var cencw = $("CENCW-" + child.id.replace("RROW-", ""));
|
||||||
|
|
||||||
if (cencw) {
|
if (cencw) {
|
||||||
|
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, child);
|
||||||
|
|
||||||
cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML);
|
cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML);
|
||||||
cencw.setAttribute('id', '');
|
cencw.setAttribute('id', '');
|
||||||
Element.show(cencw);
|
Element.show(cencw);
|
||||||
|
|||||||
Reference in New Issue
Block a user