Skip to content

Instantly share code, notes, and snippets.

@scpedicini
Created July 8, 2026 00:19
Show Gist options
  • Select an option

  • Save scpedicini/43f95d5e00af49110c41754ea3b5b326 to your computer and use it in GitHub Desktop.

Select an option

Save scpedicini/43f95d5e00af49110c41754ea3b5b326 to your computer and use it in GitHub Desktop.
Tampermonkey Script to Hide Your Username + Score
// ==UserScript==
// @name HN Hide Karma Score
// @namespace http://tampermonkey.net/
// @author Shaun Pedicini
// @version 1.3
// @description Hides your karma score (username and surrounding parentheses) on Hacker News.
// @match https://news.ycombinator.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
// Inject a style rule immediately so karma is hidden before first paint
const style = document.createElement('style');
style.textContent = '#karma, #me { display: none !important; }';
//style.textContent = '#karma { display: none !important; }';
document.documentElement.appendChild(style);
function removeKarma() {
const karmaSpan = document.getElementById('karma');
if (!karmaSpan) return;
// removing user (optional
const me = document.getElementById('me');
if (me) me.remove();
const parent = karmaSpan.parentNode;
karmaSpan.remove();
// The ( and ) live in separate text nodes flanking the now-removed span.
// Walk the parent's text nodes and strip any stray parens.
for (const node of Array.from(parent.childNodes)) {
if (node.nodeType === Node.TEXT_NODE) {
node.textContent = node.textContent.replace(/\s*\(\s*$/, '').replace(/^\s*\)\s*/, '');
}
}
}
document.addEventListener('DOMContentLoaded', function () {
removeKarma();
// Second pass after a short delay to catch late renders
setTimeout(removeKarma, 500);
});
// Catch cases where DOMContentLoaded already fired
if (document.readyState !== 'loading') {
removeKarma();
setTimeout(removeKarma, 500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment