sixcious / infy-scroll

Add customized infinite scrolling to websites and auto load the next page.
Other
155 stars 18 forks source link

[Feature Request] Events/hooks or custom code #9

Closed Kenifornication closed 2 years ago

Kenifornication commented 3 years ago

Describe the feature request you'd like First of all thank you very much for making this extension, it's by far the most featured of the bunch in this category. While the options your provide in the extension are exhaustive and fulfill most use cases, sometimes I need to do something extra. Rather than cater to each individual case, maybe an option could be added for the user to execute some Javascript (could be purely cosmetic or functional) after Infy appends the next page?

Alternatively, if the above doesn't appeal to you, you can maybe add events/hooks to the script that the end user can hook into and do things with? I would appreciate that very much. Thank you.

Screenshots N/A

sixcious commented 3 years ago

Hi Redouane,

Thank you for opening this issue and for using Infy!

OK, this is opening up a can of worms for me! I touch on it in the Mini FAQ, but not thoroughly.

I really wanted to add support for custom scripts inside Infy, but I couldn't due to Chrome being extremely restrictive about allowing it in their new Manifest V3 (MV3). It's also already pretty much written into their new Developer Docs that they don't want extensions doing this.

There has been some discussion in the Chromium Extensions Group and other channels about this new policy and making exceptions for extensions, notably the super popular user script managers like Tampermonkey and Violentmonkey. So I am currently taking a wait-and-see approach on what they'll end up doing. Perhaps wishful thinking, but it could be something as simple as an optional permission/toggle you have to enable. You could then just paste the custom script inside Infy's Scripts and Styles dialog and be done.

RE: Hooks/Events: Yes, that's certainly doable. AutoPagerize extensions create and dispatch several custom events like AutoPagerize_DOMNodeInserted whenever a new node is inserted. I guess the idea is that you could then use an (or write your own) external extension/userscript that listens for the event and then execute some custom code.

Unfortunately, Infy doesn't currently trigger such custom events (I honestly didn't even know about them!). I could certainly try adding support for custom events in the next major update. I suppose if you need a solution in the mean time you could try using an AP extension instead and blacklist those sites in Infy. (Sorry for the inconvenience.)

Thanks again!

Kenifornication commented 3 years ago

Thank you for your thoughtful reply. I did read the FAQ and I was maybe hoping that it was in reference to something else as -- like you said -- TM and VM exist in the wild. Silly me, thinking that tech companies apply their policies logically and whatnot.

Much appreciated for the AutoPagerize_DOMNodeInserted hint as I didn't know it existed. I came to Infy from Autopagerize actually, as I grew frustrated with having to add sites to WeData before I could use them. What I've ended up doing for the time being is re-adding AutoPagerize and limiting it to the target sites while I keep Infy on for the other sites.

Looking forward for the update, and thank you for taking my suggestion into consideration. I appreciate it.

Cheers!

sixcious commented 2 years ago

Hi again,

I know this is way too late and may not be of relevance anymore, but Custom Events have now finally been implemented in Version 0.7, which is now live on all the web stores.

I've added some documention here if needed: https://github.com/sixcious/infy-scroll/wiki/Help#custom-scripts

I'll continue to wait on adding support for built-in custom scripts until/if we get the green light from Chrome and Manifest V3.

Thanks again for reporting this issue and for making Infy better!

Kenifornication commented 2 years ago

Thank you very much for adding it, I tested it and it works as expected. I actually wanted to check in with you about this for the longest time thinking it might have slipped your mind or something like that, but kept forgetting to do so.

Anyway I'm grateful for the additions you made in this latest version, the "open in new tab" is particularly helpful. Keep up the good work!