ShitJournal PDF Tools

Add read and download buttons for ShitJournal PDFs

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         ShitJournal PDF Tools
// @match        https://shitjournal.org/preprints/*
// @grant        GM_download
// @license MIT
// @description  Add read and download buttons for ShitJournal PDFs
// @description:zh-CN  在 ShitJournal 预印本页面添加 PDF 阅读和下载按钮
// @version 0.0.1.20260308164434
// @namespace https://greasyfork.org/users/789884
// ==/UserScript==

(function() {
    'use strict';

    const match = location.pathname.match(/\/preprints\/([0-9a-f-]+)/);
    if (!match) return;

    const uuid = match[1];
    const pdfUrl = `https://files.shitjournal.org/${uuid}.pdf`;

    // 按钮容器
    const box = document.createElement("div");

    Object.assign(box.style, {
        position: "fixed",
        bottom: "20px",
        right: "20px",
        display: "flex",
        gap: "8px",
        zIndex: 999999
    });

    // 阅读按钮
    const readBtn = document.createElement("a");
    readBtn.textContent = "📖 阅读 PDF";
    readBtn.href = pdfUrl;
    readBtn.target = "_blank";

    Object.assign(readBtn.style, {
        padding: "10px 16px",
        background: "#4caf50",
        color: "white",
        textDecoration: "none",
        borderRadius: "6px",
        fontSize: "14px"
    });

    // 下载按钮
    const downloadBtn = document.createElement("button");
    downloadBtn.textContent = "⬇ 下载 PDF";

    Object.assign(downloadBtn.style, {
        padding: "10px 16px",
        background: "#1976d2",
        color: "white",
        border: "none",
        borderRadius: "6px",
        cursor: "pointer",
        fontSize: "14px"
    });

    downloadBtn.onclick = () => {
        GM_download({
            url: pdfUrl,
            name: uuid + ".pdf"
        });
    };

    box.appendChild(readBtn);
    box.appendChild(downloadBtn);
    document.body.appendChild(box);

})();