[Return]

Report a post

Preview
yeah!


// ==UserScript==

// @name Heyuri Yeah Highlighter

// @namespace heyuri-yeah-highlight

// @version 1.0

// @description Highlights reply posts based on Yeah count (like a Futaba★Channel userscript)

// @author Heyuri Applicable Research & Development

// @match https://img.heyuri.net/*

// @grant none

// ==/UserScript==


(function () {
"use strict";

function applyHighlighting() {
document.querySelectorAll(".post.reply").forEach(post => {
post.removeAttribute("style");

const sod = post.querySelector(".sod");
if (!sod) return;

const match = sod.textContent.match(/\d+/);
if (!match) return;

const count = parseInt(match[0], 10);

const blue = Math.round(10 * count + 180);
const color = "rgb(180, 240, " + blue + ")";

post.style.backgroundColor = color;
});
}

const observer = new MutationObserver(() => {
applyHighlighting();
});

observer.observe(document.body, {
childList: true,
subtree: true,
characterData: true
});

applyHighlighting();

})();
Post number No.172046
Board Off-Topic@Heyuri
Optional. Describe what's wrong with it.