simonlindholm / toggle-gifs

Toggle animated GIFs (Firefox extension)

Home Page:https://addons.mozilla.org/en-US/firefox/addon/toggle-animated-gifs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request: Option to darken/change contrast of gifs

islisis opened this issue · comments

It would be inline with the use of this extension to allow 'darkening' of gif images, as a feature to further reduce their distraction from page content. The contrast/hue/saturation etc could additionally be modifable to ease impact on the eye.

Isn't it enough to be able to pause gifs by default? I don't quite understand why you would want to darken gifs, but not other images. (And do you mainly want to darken them while running, or...?)

I'll elaborate a little about the origin of this request.

I find this add-on to be useful for a number of reasons, but most of
them fall into one of two categories: for the ease of focusing on useful
gif content on a page, and for the ability to partially hide
distracting gif content.

It works nicely for the former reason, but for the latter it doesn't quite
complete the role as well. Recent widespread meme gifs, taking over the
support role of emoticons, are impossible to filter due to being loaded
from generic addresses and by nature distracting even as a static image.
If there was any other way to mark these images this dimming feature
wouldn't be necessary, but the popularity of gif/animated images makes
them a reasonable first target for action.

As such I understand this feature request seems to come out of the left
field, but I would like to be able to combine these functions for
filtering purposes. Dimming/adusting the saturation of paused gifs would
be a better compromise than replacing them with placeholders. They
should then revert to normal colour on playback.

Anyhow, thanks for your feedback and your great work :)

ps. just an aside, but the playback controls are invisible when FF page colour accessibility controls are enabled. I think it would be another good feature to allow clicking anywhere on the image to stop playback

On 17/06/2015 12:52 AM, Simon Lindholm wrote:

Isn't it enough to be able to pause gifs by default? I don't quite
understand why you would want to darken gifs, but not other images. (And
do you mainly want to darken them while running, or...?)


Reply to this email directly or view it on GitHub
#27 (comment).

Ah, I see. I do get a bit of a feeling of feature bloat, and I wonder how generally useful this will be... It does so happen, though, that changes I've made very recently in #16 would make this very simple to implement, so you can at least experiment with this yourself. If you grab the XPI from that issue, or use the "indicator" branch, the only change you need to make to the source code to try this out is on line 550 of content/content.js:

el.style.filter = "url(#toggleGifsIndicatorFilter" + (playing ? "Pause" : "Play") + ")";

can be made into e.g.

el.style.filter = "opacity(0.2)";

if you want to make GIFs 80% transparent. Or you can use any other predefined SVG filter. (You'll need to set the option mentioned in that issue, too.) To make this change to the raw XPI, open it as a ZIP archive, and edit the relevant file.

It could be that the el.style.filter = ""; block in applyHoverEffect need to be moved into CurrentHover.toggleImageAnimation to make this nice enough to use (otherwise it will remove the filter on hover), or that the filter being applied only on image load is annoying (this I don't know what to do about). Either way, I'm interested in hearing if you come up with some behavior that works well.

just an aside, but the playback controls are invisible when FF page colour accessibility controls are enabled. I think it would be another good feature to allow clicking anywhere on the image to stop playback.

Entirely or just hard to see? The latter happens also with some images, but it's hard to detect from an addon, and I don't have another image. There is already an option to "Toggle GIFs on click", funnily enough.

Thanks very much for linking that issue!

I tried substituting various instances of el.style.filter but wasn't able to see any change to the gif. Sorry if my knowledge of FF scripting is too limited to be of help right now. But your implentation of SVG filters looks very promising and was extremely enlightening!

Entirely or just hard to see? The latter happens also with some images,
but it's hard to detect from an addon, and I don't have another image.

Entirely, as if it were treated as a watermark (the accessibility option removes all background watermark images when turned on). You can see it for yourself it you go to options->content->font color and unclick "Allow page to choose colors". That said, the "Show an indicator for animated gifs" in the new branch does show up on first load. It disappears after being replaced with the hover controls.

There is already an option to "Toggle GIFs on click", funnily enough.

Right! I use playback on hover so never saw this function work (behaviour seems to be overidden if both options are checked).
But, I like the new feature "clicking outside" to stop much better, so thanks!

Ok, too bad... Here's one XPI which might work: http://simonsoftware.se/temp/toggle-gifs-faded.xpi
I (unfortunately?) had to replace SVG filters with CSS opacity because the transition between "normal picture, because the addon doesn't know yet that it's a GIF" and "grayed out picture" was too jarring, and I wanted to add a CSS transition. Set the "Show an indicator for animated GIFs" pref and it should work.

Entirely, as if it were treated as a watermark

Ah, because I'm using <span style="background-image"> instead of <img> for those. Ah well, not really worth the effort to change, but I'll remember it for the future.

I use playback on hover so never saw this function work (behaviour seems to be overidden if both options are checked).

Weird, it works for me. Could be some other JS click listener on the page that it interferes with, perhaps.

But, I like the new feature "clicking outside" to stop much better, so thanks!

You're welcome! It's funny how everyone seems to have their own opinion about what behavior works best.

I added a hidden pref for this behavior: set extensions.togglegifs.indicatorStyle to 2 in about:config and the latest version of the addon (currently http://simonsoftware.se/temp/toggle-gifs.xpi, will upload to AMO soon) ought to work. I may add UI for the option if anyone else shows interest.