De-emphasize Some Washington Post Bylines

Adjust headline colors authors on washingtonpost.com

// ==UserScript==
// @name         De-emphasize Some Washington Post Bylines
// @namespace    http://tampermonkey.net/
// @version      2024-11-25
// @description  Adjust headline colors authors on washingtonpost.com
// @author       Leon Barrett
// @match        https://www.washingtonpost.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

const authorsToAdjust = ["george-f-will", "megan-mcardle", "marc-a-thiessen"];

function bylineAuthor(byline) {
    const link = byline.querySelector("a");
    const match = new RegExp("https://www\.washingtonpost\.com/people/([^/]*)/").exec(link);
    if (!match) {
        return "unknown";
    }
    return match[1];
}

function getHeadline(byline) {
    return byline.parentElement.querySelector("div.headline");
}

function adjustBylineColor(byline) {
    const headline = getHeadline(byline);
    const color = '#ddcccc'
    headline.style.color = color;
    byline.style.color = color;
}

(function() {
    'use strict';

    const bylines = document.querySelectorAll("div.byline");
    bylines.values().filter(byline => authorsToAdjust.includes(bylineAuthor(byline))).forEach(byline => adjustBylineColor(byline));
})();