Created
December 16, 2020 07:11
-
-
Save capnmidnight/b61dcecf587949d6adf1dc4130572625 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 HN Prominent User Names | |
// @namespace Violentmonkey Scripts | |
// @grant none | |
// @version 1.0 | |
// @author Sean T. McBeth - [email protected] | |
// @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