Greasy Fork

让谷歌浏览器不翻译代码和公式

针对谷歌翻译,可以自定义指定标签、关键词不翻译

目前为 2025-01-25 提交的版本。查看 最新版本

// ==UserScript==
// @name         Make Chrome not Translate Code
// @name:zh-CN   让谷歌浏览器不翻译代码和公式
// @name:en      Make Chrome not Translate Code
// @description  For Google Translate, you can customize and specify tags and keywords without translating
// @author       @amormaid
// @run-at       document-end
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description:zh-cn 针对谷歌翻译,可以自定义指定标签、关键词不翻译
// @description:en  For Google Translate, you can customize and specify tags and keywords without translating
// @match        *://*/*
// @license      GPL
// @grant        none
// ==/UserScript==




(function () {
    'use strict'

    console.log('not translate ready!');
    (() => {
        const list = document.getElementsByTagName("math")
        list && list.length && Array.from(list).forEach(e => e.classList.add('notranslate'));
        list && list.length && Array.from(list).forEach(e => e.setAttribute('translate', 'no'));
    })();
    (() => {
        const list = document.getElementsByTagName("svg")
        list && list.length && Array.from(list).forEach(e => e.classList.add('notranslate'));
        list && list.length && Array.from(list).forEach(e => e.setAttribute('translate', 'no'));
    })();
})();