Skip to content

Instantly share code, notes, and snippets.

@capnmidnight
Created December 16, 2020 07:11
Show Gist options
  • Save capnmidnight/b61dcecf587949d6adf1dc4130572625 to your computer and use it in GitHub Desktop.
Save capnmidnight/b61dcecf587949d6adf1dc4130572625 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name HN Prominent User Names
// @namespace Violentmonkey Scripts
// @grant none
// @version 1.0
// @author Sean T. McBeth - sean.mcbeth@gmail.com
// @description Make user names on Hacker News more prominent, so we can start to remember people.
// @match https://news.ycombinator.com/*
// ==/UserScript==
'use strict';
function setFont(user) {
user.style.fontSize = "150%";
user.style.color = "black";
}
[...document.querySelectorAll("#hnmain > tbody > tr:nth-child(3) > td > table > tbody > tr")]
.filter(e=>e.className == "athing")
.map(e => [e, e.nextSibling])
.forEach((post) => {
var [title, meta] = post;
if(meta && meta.querySelector){
var user = meta.querySelector(".hnuser");
if(user){
user.parentElement.removeChild(user);
var cell = title.children[0];
cell.innerHTML = "";
cell.appendChild(user);
setFont(user);
}
}
});
[...document.querySelectorAll(".comment-tree a.hnuser")]
.forEach(setFont);
[...document.querySelectorAll(".comhead a.hnuser")]
.forEach(setFont);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment