Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Reddit chat icon hide
- // @version 1
- // @grant none
- // @match https://www.reddit.com/*
- // ==/UserScript==
- // initial 'display: none' of chat icon and separator following it
- document.getElementById('chat').style.display = 'none'; // chat icon
- document.getElementById('chat').nextSibling.style.display = 'none'; // separator which follows chat section of navbar
- // Mutation Observer to cancel out the dynamic change in the DOM and keep the chat section of navbar hidden *for good*
- const observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation) {
- mutation.addedNodes[0].style.display = 'none'; // number of messages
- mutation.previousSibling.style.display = 'none'; // chat icon
- mutation.nextSibling.style.display = 'none'; // separator which follows chat section of navbar
- });
- });
- const config = {
- childList: true
- };
- const targetNode = document.getElementById('header-bottom-right');
- observer.observe(targetNode, config);
Add Comment
Please, Sign In to add comment