Skip to content

Instantly share code, notes, and snippets.

@zimmski
Created November 22, 2023 09:28
Show Gist options
  • Save zimmski/0b62bb40e965b689bc6141b3af3791b4 to your computer and use it in GitHub Desktop.
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")
// ==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