// ==UserScript== // @name read arxiv paper with multiple viewers // @updateURL https://raw.githubusercontent.com/nanguoyu/read-arxiv-paper-with-HTML5/main/read-arxiv-paper-with-HTML5.user.js // @downloadURL https://raw.githubusercontent.com/nanguoyu/read-arxiv-paper-with-HTML5/main/read-arxiv-paper-with-HTML5.user.js // @version 0.2 // @description Read arXiv papers with HTML5 webviewers like ar5iv or AlphaXiv. // @author Dong Wang // @match *://arxiv.org/abs/* // @grant none // @license GPL-3.0 // @copyright 2024, Dong Wang, AKA nanguoyu, (https://wangdongdong.wang and https://www.nanguoyu.com) // ==/UserScript== (function() { 'use strict'; // --- 第一个按钮: Open in ar5iv (红色) --- var buttonAr5iv = document.createElement("button"); buttonAr5iv.textContent = "Open in ar5iv"; buttonAr5iv.style.position = "fixed"; buttonAr5iv.style.bottom = "20px"; buttonAr5iv.style.right = "20px"; buttonAr5iv.style.zIndex = "1000"; buttonAr5iv.style.padding = "10px"; buttonAr5iv.style.border = "none"; buttonAr5iv.style.borderRadius = "5px"; buttonAr5iv.style.backgroundColor = "red"; buttonAr5iv.style.color = "white"; buttonAr5iv.style.cursor = "pointer"; buttonAr5iv.onclick = function() { var currentUrl = window.location.href; var newUrl = currentUrl.replace("arxiv.org/abs", "ar5iv.org/abs"); window.open(newUrl, '_blank').focus(); }; document.body.appendChild(buttonAr5iv); // --- 新增的第二个按钮: Open in AlphaXiv (蓝色) --- var buttonAlphaXiv = document.createElement("button"); buttonAlphaXiv.textContent = "Open in AlphaXiv"; buttonAlphaXiv.style.position = "fixed"; buttonAlphaXiv.style.bottom = "70px"; buttonAlphaXiv.style.right = "20px"; buttonAlphaXiv.style.zIndex = "1000"; buttonAlphaXiv.style.padding = "10px"; buttonAlphaXiv.style.border = "none"; buttonAlphaXiv.style.borderRadius = "5px"; buttonAlphaXiv.style.backgroundColor = "#007BFF"; buttonAlphaXiv.style.color = "white"; buttonAlphaXiv.style.cursor = "pointer"; buttonAlphaXiv.onclick = function() { var currentUrl = window.location.href; // 请注意, alphaxiv 的网址包含 "www." var newUrl = currentUrl.replace("arxiv.org/abs", "www.alphaxiv.org/abs"); window.open(newUrl, '_blank').focus(); }; document.body.appendChild(buttonAlphaXiv); })();