Getting rid of Prototype and Scriptaculous

This was a long time coming and it’s kinda happening. Apparently we used a rather minor subset of Prototype functionality which fit in a ~hundred line compatibility shim.

https://git.tt-rss.org/fox/tt-rss/src/branch/wip-no-prototype

Unless there are major problems expect this to happen soon-ish. If your plugin relies on Prototype, well, you know what to do.

e: this has been merged into master.

I was hesitant to bring this up after the “screw you if you’re not on docker” rant, (since I’m not, but, …)
I did a git pull today, after a couple(few?) weeks of not updating, and everything broke, :smiley:

After I built a new PHP, (and a new ICU) and added some extra plugins, I got (I thought) everything working again, and then I get this:

Unhandled Exception
 TypeError: row.select is not a function
@http://domain.net/ttrss/index.php#f=-3&c=0:228:9
run@http://domain.net/ttrs/js/PluginHost.js?1613892603:32:24
unpack@http://domain.net/ttrs/j/Article.js?1613892603:257:15
Headlines.unpack_observer</<@http://domain.net/ttrs/js/Headlines.js?1613892603:39:14
Headlines.unpack_observer<@http://domain.net/ttrss/js/Headlines.js?1613892603:37:12

alternating with:

 @http://domain.net/ttrss/index.php#f=-3&c=0:228:9
run@http://domain.net/ttrss/js/PluginHost.js?1613892603:32:24
unpack@http://domain.net/ttrss/js/Article.js?1613892603:257:15
setActive@http://domain.net/ttrss/js/Article.js?1613892603:410:13
move/<@http://domain.net/ttrss/js/Headlines.js?1613892603:923:15

I did some poking around and found that it started with 70fa42302… initial for RIP prototype/scriptaculous

If I roll back to the commit just before that, the problem goes away.

its likely an old out-of-tree plugin calling a prototype method, try in safe mode and check for stuff in plugins.local.

if safe mode or clearing plugins.local helps figure out which plugin is it and if its on tt-rss.org i’ll un-prototype it.

Roger, I have very few things in plugins.local,
af_img_phash
article_attachment
af_zz_vidcont
legacy_oldest_first
I’ll take 'em out and see what happens.

It seems to be af_zz_vidcont, I can do without it, thank you.

you can replace .select with .querySelectorAll and it’ll likely just work.

Unless I’m doing it wrong, changing

row.select("video").each(function (v) {

to

row.querySelectorAll("video").each(function (v) {

Doesn’t fix it, (and I’ll just say up front that I know nothing about .js, some C, a tiny bit of Rust, but no javascript.

I’m not familiar with that plugin, but .each is probably a Prototype call. Vanilla JavaScript would be something like:

row.querySelectorAll("video").forEach(function (v) {

.each is another prototype-ism yeah, see @JustAMacUser post.

e: what does this plugin even do? now im curious

Some strange guy named “fox” wrote it:
function about() {
return array(1.0,
“Controls in HTML5 videos”,
“fox”);
:smiley:
That fixed it, thanks.

You wrote it, sir. :slight_smile:

it says “Controls in HTML5 videos”,

Quite possibly no longer useful… cruft I’ve had in there for years.

hehe. don’t we have those without any specific plugins though? its probably obsolete.

Well, with “all due respect” and we know what THAT really means, I was about to delete it, and you started telling me how to fix it. :smiley:

yeah it’s a curse i have to :bear: , trying to fix things.

btw https://git.tt-rss.org/fox/ttrss-pause-bg here’s an actually useful video plugin

That does sound useful.

Again, thank you, my friend.