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:

enter image description here

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.


Developed & tested with TamperMonkey on Chrome.

  • 2
    FYI: I, also, used a MutationObserver for the first script I wrote which was monitoring for new chat messages. Instead of a MutationObserver, 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 with CHAT.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?
    – Makyen
    Mar 13, 2019 at 16:20


You must log in to answer this question.

Browse other questions tagged .