Hacker News Submitter Highlight

Makes the submitters name more apparent when scrolling through comments.

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @id          hn-submitter-highlight
// @name        Hacker News Submitter Highlight
// @author      Johannes Pfrang <[email protected]>
// @namespace   https://github.com/johnp
// @description Makes the submitters name more apparent when scrolling through comments.
// @domain      news.ycombinator.com
// @include     /^https?://news\.ycombinator\.com/item\?.*$/
// @version     2.0
// @grant       none
// @run-at      document-idle
// @homepage    https://github.com/johnp/userscripts
// @supportURL  https://github.com/johnp/userscripts/issues
// @license     MIT
// ==/UserScript==
"use strict";

// first commenter element is always the author
const commenters = document.getElementsByClassName('hnuser');
const author = commenters[0].text;

// the rest are elements in the comment headers
for (let i = 1; i < commenters.length; i++) {
    let commenter = commenters[i];
    if (commenter.text === author) {
        const css = commenter.style;
        css.backgroundColor = '#8000ff';
        css.color = '#ffffff';
        css.padding = '1px 2px';
        css.borderRadius = '3px';
    }
}