nopperl / load-reddit-images-directly

Firefox web extension that loads reddit images directly instead of referring to the HTML page containing the image.
https://addons.mozilla.org/en-US/firefox/addon/load-reddit-images-directly/
Mozilla Public License 2.0
98 stars 5 forks source link

I wonder, is there a chance you could make an userscript out of this? #5

Open TsukiZero opened 8 months ago

TsukiZero commented 8 months ago

just for convenience for users that may need to patch it themselves if Reddit does something.

a-pav commented 6 months ago

I think it will most likely introduce an infinite loop. In a userscript, AFAIK, best option to use for this case is // @run-at document-start pragma, which is good for redirecting the HTML interface to the direct-image-url but upon loading that url — since the headers are set to NOT accept a direct image — it will get redirected back to the HTML interface once again; just like when you try to open the direct-image-url in a new tab.

Eidt: I don't think the more advanced GM_ options can give access to HTTP headers either. see this.

themojache commented 1 month ago

just for convenience for users that may need to patch it themselves if Reddit does something.

Here is my attempt: https://github.com/themojache/userscripts/blob/main/reddit-image-redirect.user.js.

Feel free to open an issue/PR for suggestions.