Inoreader Article Highlighter

Change the background colour of article headers if they are popularity red or orange, or if the score is >100.

当前为 2024-05-24 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Inoreader Article Highlighter
// @version      20240524
// @description  Change the background colour of article headers if they are popularity red or orange, or if the score is >100.
// @author       jamesdeluk
// @match        https://www.inoreader.com/*
// @grant        none
// @namespace https://greasyfork.org/users/242246
// ==/UserScript==

(function() {
    'use strict';

    function changeHeaderBackground() {
        var articleHeaders = document.querySelectorAll('.article_header');
        articleHeaders.forEach(header => {
            if (header.querySelector('.popularity_icon_red')) {
                header.style.backgroundColor = '#F08080';
            }
            if (header.querySelector('.popularity_icon_orange')) {
                header.style.backgroundColor = '#FFDAB9';
            }
            var scoreSpan = header.querySelector('.popularity_score_span');
            if (scoreSpan && parseInt(scoreSpan.innerText) > 100) {
                header.style.backgroundColor = 'lightblue';
            }
        });
    }

    window.addEventListener('load', changeHeaderBackground);

    setInterval(changeHeaderBackground, 5000); // Checks every 5 seconds for newly-loaded articles
})();