// ==UserScript==
// @name arXiv HTML to Abs Redirect
// @namespace dev
// @version 1.0
// @description 自动将arXiv的HTML页面重定向原版页面
// @author dev
// @match https://arxiv.org/html/*
// @grant none
// @license MIT
// @downloadURL none
// ==/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);
}
})();