pixiv历史记录

p站历史记录白色部分改为跳转链接

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         pixiv历史记录
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  p站历史记录白色部分改为跳转链接
// @author       2222234
// @match        https://www.pixiv.net/history.php
// @icon         https://www.google.com/s2/favicons?sz=64&domain=pixiv.net
// @grant        none
// @license      114514
// ==/UserScript==

(function() {
    function waitElement(callback) {
        var s = document.getElementsByClassName("_history-items")[0];
        if (s.children.length != 0) {
            callback(s);
        } else {
            setTimeout(() => {
                waitElement(callback);
            }, 100);
        }
    }

    waitElement((s) => {
        var length = s.children.length;
        for(var i = 0;i < length ;i++){
            if(s.children[i].nodeName != "SPAN"){
                continue;
            }
            var a = document.createElement('a');
            var url = getComputedStyle(s.children[i], null)['background-image'];
            var param1 = url.split('/')[13];
            var param2 = param1.split('_')[0];
            a.setAttribute('href', '/artworks/'+param2);
            a.setAttribute('target', '_blank');
            a.setAttribute('class', '_history-item show-detail list-item');
            a.setAttribute('rel','noreferrer');
            a.setAttribute('style', 'background-image:'+url);
            var d = document.createElement('div');
            a.appendChild(d);
            d.setAttribute('class', 'status');
            s.replaceChild(a,s.children[i]);
        }
    });
})();