readimage

已经看过的图片显示红框

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        readimage
// @namespace   taoww
// @include	http://*
// @include	https://*
// @include	ftp://*
// @exclude     *://tieba.baidu.com/*
// @exclude     *://hi.baidu.com/*
// @exclude     *://blog.sina.com.cn/*
// @exclude     *://*.blog.sina.com.cn/*
// @exclude     *://www.51.la/*
// @exclude     *://bbs.aicbbs.com/*
// @version     1.1
// @description  已经看过的图片显示红框
// @grant       GM_addStyle
// ==/UserScript==

GM_addStyle("a img { border: 7px solid white; }");
GM_addStyle("a:visited img { border-color: red !important; }");

document.body.addEventListener("click", function(event) {
        var t = event.target;
        if (t.tagName === "IMG") {
                var link = null;
                if (t.parentNode.tagName === "A") {
                        link = t.parentNode;
 
               } else if (t.parentNode.tagName != "A" && 
t.parentNode.children.length === 1 && 
t.parentNode.parentNode.tagName === "A") {
                        link = t.parentNode.parentNode;
                }
                if (link && link.target !== "_blank" && link.href) {
                        var f = document.createElement("iframe");
                        f.style.display = "none";
                        f.src = link.href;
                        document.body.appendChild(f);
                }
        }
}, false);