Reddit Spoiler Hightlight

Hightlight the spoiler marked title with a much ugly color so you won't miss it.

当前为 2018-11-30 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Reddit Spoiler Hightlight
// @namespace    https://github.com/Elypha/Reddit-Spoiler-Hightlight
// @version      0.2
// @description  Hightlight the spoiler marked title with a much ugly color so you won't miss it.
// @author       u/Elypha
// @date         21/10/2018
// @modified     21/10/2018
// @supportURL   https://github.com/Elypha/Reddit-Spoiler-Hightlight/issues
// @match        https://www.reddit.com/*
// @grant        none
// @license      GUN 3.0
// ==/UserScript==

spoiler_mark()
var height_read = document.documentElement.scrollHeight;
window.addEventListener('scroll', async () => {
    clearTimeout()
    setTimeout(1000)
    var height_read_new = document.documentElement.scrollHeight;
    if(height_read_new - height_read > 0){
        spoiler_mark();
        height_read = height_read_new;
    }
})

function spoiler_mark(){
    var spoiler = document.querySelectorAll(".dcVpQZ");
    var length = spoiler.length;
    var i;
    for(i=0;i<length;i++){
        var spoiler_parents = document.querySelectorAll(".dcVpQZ")[i].parentNode.parentNode.parentNode;

        //Background Color of the spoiler marked titles:
        spoiler_parents.style.backgroundColor="#fd63635c";

        //Text Color of the spoiler mark:
        spoiler[i].style.color="#0062ff";

        //Border Color of the spoiler mark:
        spoiler[i].style.borderColor="#668c8f";
    }
}