Skip to content

Instantly share code, notes, and snippets.

@hayleyxyz
Last active April 20, 2020 18:43
Show Gist options
  • Save hayleyxyz/48b70224c4c4f66af3bf238494cc92f5 to your computer and use it in GitHub Desktop.
Save hayleyxyz/48b70224c4c4f66af3bf238494cc92f5 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Twitch - Big emotes
// @version 1
// @grant none
// @match https://www.twitch.tv/*
// @run-at document-start
// ==/UserScript==
//
(() => {
const callback = (mutationsList, observer) => {
mutationsList.forEach((mut) => {
if(mut.addedNodes.length === 0) return;
mut.target.querySelectorAll('.chat-line__message--emote[srcset*="1.0"]').forEach((el) => {
el.srcset = el.srcset.replace(/1.0/g, '2.0');
el.src = el.src.replace(/1.0/g, '2.0');
});
});
};
const observer = new MutationObserver(callback);
observer.observe(document.body, { childList: true, subtree: true });
if(window.observer) window.observer.disconnect();
window.observer = observer;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment