Greasy Fork

Greasy Fork is available in English.

arXiv论文一键有道翻译

arXiv论文一键直达有道翻译,免去来回复制

当前为 2023-04-08 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         arXiv论文一键有道翻译
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  arXiv论文一键直达有道翻译,免去来回复制
// @author       xx025
// @homepage     https://github.com/xx025/strawberry
// @match        https://arxiv.org/abs/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=arxiv.org
// @run-at       document-idle
// @grant        none
// ==/UserScript==

(function () {
    'use strict';


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

    // 创建新的 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);


})();