arXiv Clean Reader

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

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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);
})();