Created
December 19, 2023 03:12
-
-
Save asonas/5cc8d1ac32cfa72670ff9af45a86e8b5 to your computer and use it in GitHub Desktop.
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 GitHub Negative Emoji Blocker | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Block negative emojis on GitHub | |
// @author You | |
// @match *://github.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const blockedEmojis = ['-1', 'thinking_face']; | |
const disableEmojis = () => { | |
document.querySelectorAll("button[data-targets='reactions-menu.menuItems']") .forEach(item => { | |
const emoji = item.querySelector('g-emoji').getAttribute('alias'); | |
if (blockedEmojis.includes(emoji)) { | |
item.style.opacity = '0.2'; | |
item.style.pointerEvents = 'none'; | |
} | |
}); | |
}; | |
const observer = new MutationObserver(disableEmojis); | |
observer.observe(document.body, { childList: true, subtree: true }); | |
disableEmojis(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment