Last active
April 20, 2020 18:43
-
-
Save hayleyxyz/48b70224c4c4f66af3bf238494cc92f5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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