Edge、Chrome网页论文的公式翻译保留脚本
网页论文的公式翻译保留脚本,Edge、Chrome可用
在IEEE、WoS等网页在线阅读外文论文时,可以使用网页翻译功能,可直接将英文翻译成中文,但论文中的一些公式也被翻译,导致阅读困难,而Edge、Chrome等部分浏览器的公式保留脚本不通用。
1、翻译时如何保留公式?
1.1、translate="no"
属性
//全站禁止翻译
<html translate="no">//指定元素禁止翻译
<p translate="no">请勿翻译本段。</p>
<p>本段可被译为任意语言。</p>
1.2、class="notranslate"
属性
然而,如Edge、Chrome等浏览器不支持translate
属性,因此需要用到class="notranslate"
属性。
//给元素加上 class="notranslate",该段就不会被翻译了。
<tex-math notation="LaTeX" class="notranslate">
2、公式保留脚本
外文文献网页打开后,先定位到生成公式元素,然后增加translate="no"
或class="notranslate"
属性,最后再进行网页翻译。
2.1、借助 JQuery 来简单实现:
打开要翻译的网站,等网页加载完毕后,按 F12 调出控制台,然后输入下面的代码,再翻译
// 网页中带有公式的元素 math\.math\.MathJax
$('math, .math, .MathJax').attr('translate','no');
部分不支持translate
的浏览器,需要在公式元素<tex-math>
中添加notranslate
:
$("tex-math").addClass("notranslate");
2.2、油猴脚本
脚本一:translate="no"
属性
脚本来源:https://zhuanlan.zhihu.com/p/369874591
脚本二:如果浏览器不支持translate
属性(如:Edge、Chrome),则可以使用class="notranslate"
属性控制网页的公式不被翻译
// ==UserScript==
// @name 公式翻译保留
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 网页翻译时,保留公式
// @author Yuan
// @require http://cdn.staticfile.org/jquery/1.8.3/jquery.min.js// @grant GM_getResourceURL
// @grant unsafeWindow
// @grant GM_setClipboard
// @include https://www.sciencedirect.com/*
// @include https://ieeexplore.ieee.org/document/*
// @include https://www.mdpi.com/*
// @include https://ieeexplore-ieee-org-s.vpn.gxu.edu.cn:8118/document/*
// @grant GM_getResourceURL
// @grant GM_xmlhttpRequest
// @grant GM_getResourceText
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_download
// @grant GM_addStyle
// @grant GM_openInTab
// @noframes Chrome
// @compatible Chrome
// @compatible Firefox
// @compatible Edge
// @compatible Safari
// @compatible Opera
// @compatible UC
// @license GPL3 license
// ==/UserScript==(function() {'use strict';// 带有公式的元素const mathElement ='tex-math';// 添加按钮var mathBtn = '<button id="math-btn">公式翻译保留</button>';$('body').append(mathBtn);// 添加样式GM_addStyle('#math-btn {background:#ff3500;padding:10px 20px;color:#fff;border-radius:40px 0 0 40px;position:fixed;right:0px;top:50vh;z-index:99999999999999;border:none;height:fit-content;outline:none;cursor:grab}');// 点击按钮,添加翻译保留属性$('#math-btn').click(function(){if($(mathElement).length > 0){// console.log('该页面存在公式!');// alert('该页面存在公式!');$(mathElement).addClass("notranslate");alert('公式已被保留!');}else{console.log('未发现公式!');alert('未发现公式!');}})})();
Edge公式保留后的翻译结果,清晰流畅,奈斯!
Edge、Chrome网页论文的公式翻译保留脚本相关推荐
- Paper:《A Unified Approach to Interpreting Model Predictions—解释模型预测的统一方法》论文解读与翻译
Paper:<A Unified Approach to Interpreting Model Predictions-解释模型预测的统一方法>论文解读与翻译 导读:2017年11月25 ...
- 【Chrome 浏览器自带谷歌翻译用不了】
[Chrome 浏览器自带谷歌翻译用不了] 1. 前言 1.1 问题模拟 1.2 分析底层逻辑 2. 解决办法 2.1 实操 2.2 验证效果 3. 总结 1. 前言 最近发现 自己的Chrome 浏 ...
- edge 禁止网页自动刷新_如何在Microsoft Edge中自动翻译网页
edge 禁止网页自动刷新 Microsoft 微软 The new version of Microsoft's Edge browser features automatic translatio ...
- 玩转代码|解决Chrome浏览器内置谷歌翻译功能无法使用问题!
最近这几天在使用Chrome浏览器的内置谷歌翻译功能时,总是一直停留在不翻译的状态,一开始我还以为是网络波动过几天就好了,过了好几天依旧是这样.去看了新闻才知道谷歌翻译已经退出了中国市场. 根据Tec ...
- 标记meta http-equiv = X-UA-Compatible content = IE=edge,chrome=1
为什么80%的码农都做不了架构师?>>> 陌生标记标记一: < meta http-equiv = "X-UA-Compatible" content ...
- HTML Meta中添加X-UA-Compatible和IE=Edge,chrome=1有什么作用?
X-UA-Compatible是自从IE8新加的一个设置,对于IE8以下的浏览器是不识别的. 通过在meta中设置X-UA-Compatible的值,可以指定网页的兼容性模式设置. 在网页中指定的模式 ...
- chrome 网页重新加载_在Chrome中为各个网页设置自定义重新加载时间
chrome 网页重新加载 Do you have a webpage that needs to be reloaded every so often or perhaps you have mul ...
- meta http-equiv=X-UA-Compatible content=IE=edge,chrome=1 /
X-UA-Compatible是针对IE8新加的一个设置,对于IE8之外的浏览器是不识别的,这个区别与content="IE=7"在无论页面是否包含<!DOCTYPE> ...
- 详解 meta http-equiv = X-UA-Compatible content = IE=edge,chrome=1 /
< meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" /> 这是个是 ...
最新文章
- 我们为什么要分库分表?
- 第十五届智能车竞赛东北赛区普通四轮组冠军车-哈尔滨工业大学-紫丁香
- react-native-webview禁止缩放
- php 格式化html,HTML代码如何格式化
- RocketMQ核心架构和概
- Lambda表达式的使用
- php试题及答案 博客,转php面试题及我的答案(一)
- centos6.5远程桌面连接(VNC\SPice)
- C# 注册Dll文件
- JAVA版的IntHashMap的多个源码
- 雪莹软件将word转图片产生空白区域的问题解决方法
- 基于Bootstrap模板创建门户网站vue项目02
- HashMap底层原理(图文并茂,简单易懂)
- 编程之法-C语言应用开发与工程实践-C语言概述
- 怀化学院计算机不过能毕业吗,面对困境,你会如何选择?
- 全球与中国市场聚乙烯醇缩丁醛(PVB)树脂发展规模分析与前景战略研究报告2022年版
- Zigbee efr32 有线网关接入HASS中的ZHA,实现设备控制
- Disql、Dexp、Dimp使用
- 一个牛逼的Bug!一张“壁纸”让三星手机秒变砖!
- 国外人工智能研究:一种可以通过文本描述直接生成视频的AI模型