How To Block Gifs On Messenger
Intro
I'1000 using mainly messenger.com to chat with my friends, I like sending gifs, it'south fun, merely when those gifs keep playing over and over again it'due south very distracting and abrasive. Ofcourse, one solution to that is to close whole tab or merely remove the gif, but these solutions were non ideal for me. I decided to write simple script that will catechumen all gifs on messenger.com into playable gifs.
Solution
Considering I don't want to write whole extension(for chrome in my case), I decided to utilise tampermonkey. Tampermonkey is browser extension(or greasemonkey for FF) that allows you to write js script that will be injected every time yous load page. Like that, you tin easily change page behaviour or design. There are many scripts bachelor on greasyfork.org, none of them unfortunately is disabling gifs on messenger.com, but that's no problem, I tin can build it :].
Here is the script:
// ==UserScript== // @name Messenger Stop GIFs // @namespace http://tampermonkey.net/ // @version 0.1 // @clarification Stop annoying gifs. Adds button to messenger.com, when clicked converts all gifs into playable gifs. // @author Tomas Bouda // @friction match https://www.messenger.com/* // @grant GM_getResourceText // @grant GM_addStyle // @crave https://ajax.googleapis.com/ajax/libs/jquery/three.4.i/jquery.min.js // @crave https://gist.githubusercontent.com/TomasBouda/f091e3a7839cf561d5f007d2b0326c8b/raw/4d3e161c5ca3b98a2cc52b030982c36fc763c97e/gifffer.js // @resource buttonCSS https://gist.githubusercontent.com/TomasBouda/ce7f6e86015c271acdb32ff71c1ec474/raw/00dc5e2029cff090f8023bbae7feb26e9edfb236/btn.css // ==/UserScript== (function() { 'utilise strict'; var newCSS = GM_getResourceText ("buttonCSS"); GM_addStyle (newCSS); $('body').append('<button grade="btn btn-outline-principal btn-sm" id="playableGifs">Stop GIF</button>'); $("#playableGifs").css({"position":"fixed", "top":20, "left":140, "z-index":thousand}); $('#playableGifs').click(function(){ $('.k4urcfbm.bixrwtb6.datstx6m.q9uorilb').each(function(){ var src = $(this).attr('src'); $(this).removeAttr('src'); $(this).attr('data-gifffer', src); }); Gifffer(); }); })(); I took cracking library gifffer, that allows me simply what I want – forestall autoplaying of blithe gifs. You can run across in the script that I require that library from my gist, also slice of bootstrap and so I can use btn classes. This is lilliputian chip ugly just it works for now. If you lot are gonna utilize this script, alter these gist links to your own!
The way I stop the gifs is that I add push to messenger.com page and I hook function to it'due south click issue. That function loops trough each gif, changes information technology's attributes(src to data-gifffer, run across usage for more than info) and then calls Gifffer() office, that'southward it.
Installation
To install Tampermonkey, just go to http://www.tampermonkey.net/ and click Download, it will automatically redirect your browser extension store, then click Add to Chrome, + Add to Firefox, … and tampermonkey is successfully installed. Once installed you will see lilliputian blackness icon in top correct corner(in chrome and firefox), click it and select Create new script...
New tab volition open. Now, copy my script above and paste it into tampermonkey editor y'all just opened, replacing all previous text. Press CTRL+S to save script. You\'re done!
Now whenever you open messenger.com, you should see litle number 1 1 under tampermonkey icon, indicating that our script is running.
And ofcourse you should see Stop GIF button. Whenever you desire to stop all annoying gifs just click that button and they volition be converted into playable and stopped.
Ofcourse, even better would be if information technology worked without button, but that would require more work, because nosotros would need to somehow detect, that user changed bulletin thread and ensure DOM is loaded. If you know how to practice that or yous have other improovements, please get out a comment downwards bellow. Happy coding 😉
Source: https://blog.tomasbouda.cz/disable-gifs-on-messenger-com/

0 Response to "How To Block Gifs On Messenger"
Post a Comment