DMHYReadFilter

加深点击后的条目

You will need to install an extension such as Tampermonkey, Greasemonkey 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 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.

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

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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==
// @name         DMHYReadFilter
// @namespace    https://github.com/lycloudqaq/ThreadViewed-Darker
// @version      1.1
// @description  加深点击后的条目
// @author       lycloud
// @match        *://share.dmhy.org/*
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==


(function () {
    var filterTr = document.querySelectorAll("table#topic_list>tbody>tr.even");
    for (var i = 0; i < 40; i++) {
        filterTr[i].setAttribute("class", "odd")
    }
    filterTr = document.querySelector("table#topic_list");
    filterTr.setAttribute("border", "1");
    filterTr.setAttribute("style", "border-collapse: collapse;border-color: #000;");
})();

(function () {
    var readArray = [];
    readArray = readArray.concat(GM_getValue('read'));

    var aFilter = document.querySelectorAll('tr>.title>a');
    for (var i = 0; i < aFilter.length; i++) {
        var id = parseInt(aFilter[i].href.slice(35, 41));
        if (readArray.includes(id) == true) {
            aFilter[i].parentNode.parentNode.setAttribute("style", "background-color:#ccc;");
        }

        aFilter[i].addEventListener('mousedown', function () {
            id = parseInt(this.href.slice(35, 41));
            if (readArray.includes(id) == false) {
                readArray.push(id);
                if (readArray.length > 320) { readArray.shift() };
                GM_setValue('read', readArray);
                this.parentNode.parentNode.setAttribute("style", "background-color:#ccc;");
            }
        })
    }
})();