Created
November 22, 2023 09:28
-
-
Save zimmski/0b62bb40e965b689bc6141b3af3791b4 to your computer and use it in GitHub Desktop.
Tampermonkey script - Google Chat Always Allow Animated Emojis (in case you have "prefers-reduced-motion" set to "reduce")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Google Chat Always Allow Animated Emojis | |
// @match https://chat.google.com/* | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function main() { | |
const pictureSources = document.querySelectorAll('picture > source'); | |
pictureSources.forEach((pictureSource) => { | |
if (pictureSource.getAttribute('media') == '(prefers-reduced-motion: reduce)') { | |
pictureSource.remove(); | |
} | |
}) | |
} | |
function debounce(fn, delay) { | |
var timeout = null; | |
return function() { | |
if(timeout) { | |
return; | |
} else { | |
timeout = setTimeout(function() { | |
fn(); | |
timeout = null; | |
}, delay); | |
} | |
} | |
} | |
main(); | |
var el = document.documentElement; | |
el.addEventListener('DOMSubtreeModified', debounce(main, 2000)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment