arXiv论文一键翻译

arXiv论文一键翻译,很方便,祝你学术步步高升!

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         arXiv论文一键翻译
// @namespace    http://tampermonkey.net/
// @version      0.1.2
// @description  arXiv论文一键翻译,很方便,祝你学术步步高升!
// @author       xx025,trotsky1997
// @license MIT
// @homepage     https://github.com/xx025/strawberry
// @match        https://arxiv.org/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=arxiv.org
// @grant           GM_registerMenuCommand
// @grant           GM_openInTab
// @grant           GM_setValue
// @grant           GM_getValue
// @run-at       document-idle
// ==/UserScript==

(function () {
    'use strict';
if(location.href.startsWith("https://arxiv.org/abs/")){

    // 获取要在其后添加新元素的元素
    const list = document.querySelector(".full-text ul");


    // 点击下载按钮,在新标签中打开
    list.querySelector('.abs-button.download-pdf').target = '_blank'


    // 创建新的 li 元素
    const newLi = document.createElement("li");
    newLi.style.color = "black";

    // 创建 a 元素,并设置其 href 和 class 属性
    const newLink = document.createElement("a");
    newLink.href = `https://fanyi.youdao.com/trans/#/home?keyfrom=fanyiweb&url=${location.href}&type=undefined`
    newLink.className = "abs-button download-format";
    newLink.target = "_blank";// 在新标签中打开链接
    newLink.style.color = "#8cbd18";

    // 设置 a 元素的文本内容
    const linkText = document.createTextNode("🐉一键翻译");
    newLink.appendChild(linkText);

    // 将 a 元素添加到新的 li 元素中
    newLi.appendChild(newLink);

    // 将新的 li 元素添加到列表中
    list.appendChild(newLi);
}

            GM_registerMenuCommand("立即翻译",()=>{
                let targetUrl=`https://fanyi.youdao.com/trans/#/home?keyfrom=fanyiweb&url=${location.href}&type=undefined`;
                GM_openInTab(targetUrl, {active:true});
            });

})();