原创 - 插画世界 - 添加「返回 Pixiv」按钮

在行为栏添加前往 Pixiv 对应作品页的按钮。

目前为 2024-03-21 提交的版本。查看 最新版本

// ==UserScript==
// @name         原创 - 插画世界 - 添加「返回 Pixiv」按钮
// @name:en_US   Original - vilipix - Add a 'Return to Pixiv Site' button
// @description  在行为栏添加前往 Pixiv 对应作品页的按钮。
// @version      1.0.1
// @author       CPlayer
// @license      MulanPSL-2.0
// @namespace    https://www.gitlink.org.cn/CPlayerCHN
// @match        https://vilipix.com/illust/*
// @match        https://www.vilipix.com/illust/*
// @icon         https://vilipix.oss-cn-beijing.aliyuncs.com/web/logo/ico.png
// @run-at       document-end
// @noframes
// ==/UserScript==

(function() {
    'use strict';

    // 定义「作品编号」变量
    const artworkid = location.href.split('/')[4]

    // 判断「作品编号」是否为 Pixiv 的,如果是就在行为栏添加「返回 Pixiv」按钮。
    if(!/[a-z]+/.test(artworkid)) {
        document.querySelector('.illust-content .actions').insertAdjacentHTML("afterbegin", `<div><a href="https://www.pixiv.net/artworks/${artworkid}" target="_blank" rel="nofollow noopener noreferrer"><i class="icon iconfont wx-icon-faxian"></i></a></div>`);
    }
})();