simonlindholm / toggle-gifs

Toggle animated GIFs (Firefox extension)
https://addons.mozilla.org/en-US/firefox/addon/toggle-animated-gifs/
51 stars 2 forks source link

Detect if gif is animated or static #20

Closed BarbieBarb closed 9 years ago

BarbieBarb commented 9 years ago

I don't want to waste my time sliding the mouse up to a smiley to activate the animation... but discover that it is a static gif.

Animated gifs always have more than one frame. Non-animated gifs do not. Is there a way to detect if the gif has more than one frame... therefore allowing to alert those specific gifs ? Thankyou

LL25255252 commented 9 years ago

Try my style: https://userstyles.org/styles/106194/gif-images-add-dashed-border-to-these-sites

The credit goes to Simonlindhoim idea ["Yeah, :not([src*=icon]) is not optimal, but it's better than nothing. "]

BarbieBarb commented 9 years ago

Thanks LL25255252 but... Not precise enough for me in the way I intend. Example: Post#6 https://greasyfork.org/forum/discussion/1799/pause-gifs-till-hover

The first image is animated gif (eyes blink) and the second image is static gif. I need to mark the first image as animated. And the point of this thread is... I thought that detecting multiple frames in an image may be possible somehow. Thankyou

simonlindholm commented 9 years ago

Mmm, this is hard. See #16 (which I'll count this as a dup of) and the linked comment in #10. Post 6 there also hits #3, FWIW.

If you want to code up hack for it (with all the caveats mentioned in that comment), the best way would be modify this extension (all the code is in bootstrap.js) and check if (getIc(imageElement).animated) at opportune times.