I made a script that allows you to minimize pictures, gifs, youtube preview, tweets or wikipedia articles.
It's useful if you don't want the image to be always shown. For example at the office.
It searches with the selector '.ob-image, .ob-tweet, .ob-wikipedia, .ob-youtube '
and adds an arrow like this:
When clicked, the image toggles with slideToggle()
and the arrow rotates.
It uses a mutationObserver
so if new messages match this kind of content, it will add the arrow as well.
Installation
- Install the userscript.
Developed & tested with TamperMonkey on Chrome.
MutationObserver
for the first script I wrote which was monitoring for new chat messages. Instead of aMutationObserver
, it turns out that chat allows you to be notified when events happen, including messages being added or edited. Adding a listener can be done withCHAT.addEventHandlerHook()
. I was going to point you towards a couple chat messages I'd written that explain it's use a little bit, but realized that it would be helpful to have it documented a bit better. So, if you're interested, I wrote How do I get notified of events in SE chat?