Skip to content

Instantly share code, notes, and snippets.

@asonas
Created December 19, 2023 03:12
Show Gist options
  • Save asonas/5cc8d1ac32cfa72670ff9af45a86e8b5 to your computer and use it in GitHub Desktop.
Save asonas/5cc8d1ac32cfa72670ff9af45a86e8b5 to your computer and use it in GitHub Desktop.
// ==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