let you know if the link is clicked before
当前为
// ==UserScript==
// @name Visited Links Highlighter
// @namespace https://jirehlov.com
// @version 0.1
// @description let you know if the link is clicked before
// @author Jirehlov
// @match https://bgm.tv/*
// @match https://chii.in/*
// @match https://bangumi.tv/*
// @license MIT
// ==/UserScript==
(() => {
"use strict";
const visitedLinks = JSON.parse(localStorage.getItem("JvCSS")) || {};
const links = document.getElementsByTagName("a");
for (let link of links) {
const href = link.href;
if (visitedLinks[href]) {
link.style.color = "#c58af9";
} else {
link.addEventListener("click", function (event) {
visitedLinks[this.href] = true;
localStorage.setItem("JvCSS", JSON.stringify(visitedLinks));
});
}
}
})();