simonlindholm/toggle-gifs

Request - add an option to always display the animation controls.

LL25255252 opened this issue · 25 comments

Can you please add an option to display the animation control buttons on all the page's gifs (even if an image is not hovered).

This feature can be useful to indicate which images in the page is an animated one especially if the "Pause Gif's by default" is enabled.

Many thanks in advance.

I agree that this would be useful, but it's (surprisingly) also Hard™. See #10 (comment).

I'll keep this issue open and see if I get around to adding some experimental option for it at some point, though.

Thanks for the link to #10 (comment)

Gifs now have a nice dashed border but unfortunately Using img[src_='.gif']:not([src_=icon]) { border: 4px dashed #090; } doesn't exclude borders from small gifs like in Gmail.
Seems that the :not([src*=icon]) part doesn't work. ('icon' doesn't work either).

Yeah, :not([src*=icon]) is not optimal, but it's better than nothing. You might be able to right-click -> view image on the relevant gifs to see if their URLs are identifiable enough to add as exclude patterns. (:not([src*=icon]) excludes images with "src" attributes that include the word "icon", in case you don't parse CSS fluently. You can combine several :nots by putting them after each other.)

Or use a @-moz-document rule: https://developer.mozilla.org/en-US/docs/Web/CSS/@document

Is there a way in CSS to apply the border only to images with min-width and min-height ?

Pretty sure there isn't, no.

Just noticed -- and I have no idea how I've missed this before -- that non-bubbling events still participate fully in the capture phase. In particular, the "load" event for images. That might actually make this more or less solvable!

I wonder what UI to expose. Maybe a single play/pause button, that goes away after unhovering the image so that you're able to see it without overlay.

(Edit: also TODO: check that getting getIc(image).animated doesn't destroy performance, or else come up with some fancy scroll tracking scheme.)

Seems like getIc(image).animated throws if the image is not yet decoded, i.e., is far out of view. And throwing takes about 5us, which is low enough that we can run this on every loaded image. Fancy scroll tracking schemes it is...

Seems like very good news...looking forward for a new beta.
As of now I use http://simonsoftware.se/temp/toggle-gifs-hover-play-options.xpi

Can you try this: http://simonsoftware.se/temp/toggle-gifs-indicator.xpi ? It adds a new option "Show an indicator for animated GIFs". Reports about bugs, UI or whatever is highly appreciated.

Any thoughts? (I made a few more changes to the code, including a change of pref name, but nothing that should have changed the UI. Same URL.) I'm thinking of pushing out a new release now soon, with this and all the other changes that have built up (and ahead of the extension signing requirements).

It will have to do. Newest version: http://simonsoftware.se/temp/toggle-gifs.xpi. This one only ever shows the indicator for paused gifs, because it's about equally sensible, and I noticed terrible performance with SVG filters + playing gifs/videos.

I'm not sure where I'm supposed to see the indicator. I have it set to auto-pause gifs on a certain site, and I enabled the iindicator and refreshed (and found a paused gif) but I see no indicator anyway. FF39 on Linux.

That I would expect to work... Can you give a URL? Does it work for images opened in their own tabs? (The indicator is the same as the play button you can see on hover.)

http://imgur.com/gallery/6IvLb this imgur album of gifs doesn't do it, even if you view the gif separately.
I'll try in a browser with only this addon.

Doesn't work if I disable literally every other extension, either. But I figured out part of the problem. It seems to display it only once (the play button only), and then when you hover it displays both play and rewind, and then when you remove hover, it won't display anything again except when hovering. For this reason, it won't work on the imgur one because I don't have it set to auto-pause them.

Ah, so it's working, it's just that I'm a terrible UI designer. Wouldn't be the first time. :)

The idea is something like, if you've enabled animation (esp. if you've hovered an image) then you already know which images are animated gifs, so there's no need to overlay them in the future. But I suppose that might just be terribly confusing. I can change it.

Do you think the play button works as an indicator, or is there something better?

Ah I see; the only change I think is necessary is to make the button not disappear on mouseover if it was paused automatically. Because there's a surprisingly high chance of me doing that by accident (why I didn't notice the first time, or on subsequent refreshes while testing.) I don't think it's necessary when done manually (not including the pause-all hotkey)

Though changing the button colour from grey to red for auto-paused gifs might also be nice; it's not that immediately noticable right now.

I have also discovered that it doesn't work at all on tumblr archives, for instance http://gifak-net.tumblr.com/archive all of these are gifs and can be played by hovering over them (added tumblr to my auto-pause to test,) but they don't display the playbutton on page load. I thought maybe it was becaues of how the page dynamically loads them, but, then, so does the tumblr dashboard, and it works fine there.

Right, I'll experiment more tomorrow.

I have also discovered that it doesn't work at all on tumblr archives, for instance http://gifak-net.tumblr.com/archive

Ugh, I'd forgotten about tumblr. :( My code only works for <img> tags, but tumblr's archive sites use CSS background-image. The only reason the gifs there have functioning pause/reset buttons is because I put in a terrible hack for it a while ago. I'm not sure how to fix this, and I'm somewhat inclined not to, at least for now...

Ahh okay, no biggie.

So, this version (on the "indicator" branch): http://simonsoftware.se/temp/toggle-gifs-indicator.xpi shows an indicator for all paused gifs, regardless of hoverings, etc. Not sure if I personally like this better (I'll need to try it a bit longer), but it's definitely less surprising.

I tried the "red indicator" idea for a bit, but ... I don't know. It looks weird, and I kindof like having the indicator be discrete.

Looks good o/

Let's go with it, then!

https://addons.mozilla.org/en-US/firefox/addon/toggle-animated-gifs/versions/
Position in queue: 126 of 128. Could take up to a month, but we'll see. Maybe the e10s fixes gives it higher priority.

And released! No complaints yet. :)