Pixiv歷史記錄稍微增强

單純讓非會員瀏覽歷史記錄

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Pixiv enhance history a little
// @name:zh-CN   Pixiv历史记录稍微增强
// @name:zh-TW   Pixiv歷史記錄稍微增强
// @name:ja      pixivの履歴の機能をわずかに強化
// @namespace    http://tampermonkey.net/
// @icon         https://i.pximg.net/user-profile/img/2019/05/02/16/56/10/15718030_ded90a676c52836d9f739f7aa6d4faf6_170.jpg
// @version      0.3
// @description        Just let non-members browse history
// @description:zh-CN  单纯让非会员浏览历史记录
// @description:zh-TW  單純讓非會員瀏覽歷史記錄
// @description:ja     非会員が履歴を閲覧できるようにする
// @author       Quantum-Electrodynamics
// @include      http*://www.pixiv.net/history.php
// @grant        none
// ==/UserScript==

(function() {
    // 'use strict';
    var count=60
    var temp=setInterval(function(){
        var historys = $("span._history-item")
        if (historys.length) {
            var pids=[]
            historys.each(function () {
                var url=/http.*?\.jpg/.exec($(this).attr("style"))[0]
                var pid=/\/\d*?_/.exec(url)[0].slice(1, -1)
                pids.push(pid)
                var newelement = "<a href=\"/artworks/" + pid + "\" target=\"_blank\" class=\"_history-item show-detail list-item\" style=\"background-image: url(&quot;" + url + "&quot;);\"><div class=\"status\">" + "</div></a>"
                $(this).replaceWith(newelement)
            })
            var pidsText = pids.reduce((s, e) => { return s + "," + e })
            $.getJSON("https://www.pixiv.net/rpc/index.php?mode=get_illust_detail_by_ids&illust_ids="+pidsText, (data) => {
                $("a._history-item").each(function(){
                    var url=/http.*?\.jpg/.exec($(this).attr("style"))
                    var pid = /\/\d*?_/.exec(url)[0].slice(1, -1)
                    if (pids.includes(pid)) {
                        var newelement = "<a href=\"/artworks/" + pid + "\" target=\"_blank\" class=\"_history-item show-detail list-item\" style=\"background-image: url(&quot;" + url + "&quot;);\"><div class=\"status\">" + (data.body[pid].is_bookmarked ? "<span class=\"_bookmark-icon-like-icon-font white\"></span>" : "") + "</div></a>"
                        $(this).replaceWith(newelement)
                    } else {
                        return
                    }
                })
            })
            clearInterval(temp)
        } else {
            if (!--count) {
                console.log("Pixiv历史记录稍微增强: 超时")
                clearInterval(temp)
            }
        }
    }, 500)
})();