Pluginhost hook to modify headlines

Hello fox,

As already discussed in https://git.tt-rss.org/fox/tt-rss/pulls/93 can you point me in the direction of the pluginhook that can be used for that? My requirement is to actually remove the feed div in combined mode from the headlines if it is empty.

i had to add one, there was a hook for article but not for headline entry:

https://git.tt-rss.org/fox/tt-rss/commit/a0d332326c8ff511b8dd05008a4c368fef623434

Thank you very much fox, with this hook it is quite easy to remove the feed object if it is empty.

feed = row.querySelector(“.feed”);
if (feed.firstElementChild.text == “”) {
feed.parentElement.removeChild(feed);
}

you have the right idea, although personally i would write it like this:

if (row.select(".feed")[0].innerText == "") {
...
}

I tried this. Interestingly enough while it worked in the console for testing, it did not trigger in the plugin itself. It should be completely the same though.

	PluginHost.register(PluginHost.HOOK_HEADLINE_RENDERED, (row) => {
		if (row.select(".feed")[0].innerText == "") {
			console.log("Trigger");
			row.select(".feed")[0].remove();
		}
		return true;
	});

Do you have an idea why this does not work, it should be something obvious but I am missing it right now.

yeah, looks like both innerText and textContent are undefined.

my uneducated guess would be this property being calculated lazily after DOM element is attached somewhere legit (or something else of this nature) and the hook triggering too early for that.

Naw it is different, apparently the string is blank string with a size of 19 at this point so comparing agains “” won’t work. I did the following instead.

if (row.select(".feed")[0].innerText.trim().length == 0

This works fine.

ah i guess that’s whitespace in the template then

i made a typo while testing so that’s why i thought it was undefined. d’oh.

Hmm, just noticed something completely different during testing. With the current version you can scroll the entries now off the screen. I think before you had this end of feed box at the bottom which was prohibiting this, or do I remember this wrong.