arXiv Clean Reader

Remove the top navigation bar, beta tag, and bottom right feedback prompt from the arXiv HTML article.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         arXiv Clean Reader
// @namespace    http://tampermonkey.net/
// @version      1.0
// @license MIT
// @description  Remove the top navigation bar, beta tag, and bottom right feedback prompt from the arXiv HTML article.
// @author       Naive
// @match        https://arxiv.org/html/*
// @match        https://arxiv.org/abs/*
// @icon         https://arxiv.org/favicon.ico
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function cleanPage() {
        // header
        const header = document.querySelector('header');
        if (header) header.remove();

        // beta
        const observer = new MutationObserver(() => {
            const existingStyle = document.querySelector('style#custom-remove-after');
            if (!existingStyle) {
                const style = document.createElement('style');
                style.id = 'custom-remove-after';
                style.textContent = 'body::after { content: none !important; }';
                document.head.appendChild(style);
            }
        });
        observer.observe(document, {
            childList: true,
            subtree: true
        });

        // feedback
        const feedbackDiv = document.querySelector('#openForm');
        if (feedbackDiv) feedbackDiv.remove();

        //const footer = document.querySelector('footer');
        //if (footer) footer.remove();

        const mainContent = document.querySelector('.ltx_page_main');
        if (mainContent) {
            mainContent.style.marginTop = '0';
            mainContent.style.paddingTop = '20px';
        }
    }

    const observer = new MutationObserver((mutations) => {
        cleanPage();
    });

    observer.observe(document, {
        childList: true,
        subtree: true
    });

    // initial
    cleanPage();

    // resize
    window.addEventListener('resize', cleanPage);
})();