Greasy Fork

Greasy Fork is available in English.

自动将arXiv的HTML页面重定向原版页面

自动将arXiv的HTML页面重定向原版页面arXiv HTML to Abs Redirect

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         自动将arXiv的HTML页面重定向原版页面
// @namespace    dev
// @version      1.1
// @description  自动将arXiv的HTML页面重定向原版页面arXiv HTML to Abs Redirect
// @author       dev
// @match        https://arxiv.org/html/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // 获取当前路径中的论文ID(包含可能的版本号)
    const pathSegments = window.location.pathname.split('/');
    const paperId = pathSegments[2];  // 路径格式为 /html/xxxxx

    // 只有当路径有效时才执行跳转
    if (paperId) {
        // 保留所有查询参数
        const queryString = window.location.search;
        // 构建新的abs链接
        const absUrl = `https://arxiv.org/abs/${paperId}${queryString}`;
        // 立即跳转(替换当前历史记录)
        window.location.replace(absUrl);
    }
})();