<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans">
	<id>https://wiki.fangc.top/index.php?action=history&amp;feed=atom&amp;title=Chrome%E6%B5%8F%E8%A7%88%E5%99%A8%E7%BF%BB%E8%AF%91%E8%A7%84%E9%81%BF%E4%BB%A3%E7%A0%81</id>
	<title>Chrome浏览器翻译规避代码 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.fangc.top/index.php?action=history&amp;feed=atom&amp;title=Chrome%E6%B5%8F%E8%A7%88%E5%99%A8%E7%BF%BB%E8%AF%91%E8%A7%84%E9%81%BF%E4%BB%A3%E7%A0%81"/>
	<link rel="alternate" type="text/html" href="https://wiki.fangc.top/index.php?title=Chrome%E6%B5%8F%E8%A7%88%E5%99%A8%E7%BF%BB%E8%AF%91%E8%A7%84%E9%81%BF%E4%BB%A3%E7%A0%81&amp;action=history"/>
	<updated>2026-04-19T16:25:39Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.fangc.top/index.php?title=Chrome%E6%B5%8F%E8%A7%88%E5%99%A8%E7%BF%BB%E8%AF%91%E8%A7%84%E9%81%BF%E4%BB%A3%E7%A0%81&amp;diff=1515&amp;oldid=prev</id>
		<title>FC：​创建页面，内容为“使用油猴新建一个脚本输入以下内容保存&lt;syntaxhighlight lang=&quot;js&quot;&gt; // ==UserScript== // @name         谷歌翻译绕过代码块 // @namespace    http://tampermonkey.net/ // @version      0.4 // @description  让谷歌翻译插件翻译网页的时候，绕过代码块和一些无需翻译的元素 // @author       xiandan // @homeurl      https://github.com/xiandanin/LardMonkeyScripts // @match        https://github.com/* // @match        https…”</title>
		<link rel="alternate" type="text/html" href="https://wiki.fangc.top/index.php?title=Chrome%E6%B5%8F%E8%A7%88%E5%99%A8%E7%BF%BB%E8%AF%91%E8%A7%84%E9%81%BF%E4%BB%A3%E7%A0%81&amp;diff=1515&amp;oldid=prev"/>
		<updated>2023-10-26T03:56:29Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“使用油猴新建一个脚本输入以下内容保存&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt; // ==UserScript== // @name         谷歌翻译绕过代码块 // @namespace    http://tampermonkey.net/ // @version      0.4 // @description  让谷歌翻译插件翻译网页的时候，绕过代码块和一些无需翻译的元素 // @author       xiandan // @homeurl      https://github.com/xiandanin/LardMonkeyScripts // @match        https://github.com/* // @match        https…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;使用油猴新建一个脚本输入以下内容保存&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt;&lt;br /&gt;
// ==UserScript==&lt;br /&gt;
// @name         谷歌翻译绕过代码块&lt;br /&gt;
// @namespace    http://tampermonkey.net/&lt;br /&gt;
// @version      0.4&lt;br /&gt;
// @description  让谷歌翻译插件翻译网页的时候，绕过代码块和一些无需翻译的元素&lt;br /&gt;
// @author       xiandan&lt;br /&gt;
// @homeurl      https://github.com/xiandanin/LardMonkeyScripts&lt;br /&gt;
// @match        https://github.com/*&lt;br /&gt;
// @match        https://npmjs.com/*&lt;br /&gt;
// @match        https://stackoverflow.com/*&lt;br /&gt;
// @match        https://*.google.com/*&lt;br /&gt;
// @match        https://jmespath.org/*&lt;br /&gt;
// @license      MIT&lt;br /&gt;
// @grant        none&lt;br /&gt;
// ==/UserScript==&lt;br /&gt;
/*jshint esversion: 6 */&lt;br /&gt;
(function () {&lt;br /&gt;
    &amp;#039;use strict&amp;#039;&lt;br /&gt;
&lt;br /&gt;
    function noTranslate (array) {&lt;br /&gt;
        array.forEach((name) =&amp;gt; {&lt;br /&gt;
            [...document.querySelectorAll(name)].forEach(node =&amp;gt; {&lt;br /&gt;
                if (node.className.indexOf(&amp;#039;notranslate&amp;#039;) === -1) {&lt;br /&gt;
                    node.classList.add(&amp;#039;notranslate&amp;#039;)&lt;br /&gt;
                }&lt;br /&gt;
            })&lt;br /&gt;
        })&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    const bypassSelectorArray = [&lt;br /&gt;
        &amp;#039;pre&amp;#039;&lt;br /&gt;
    ]&lt;br /&gt;
    if (window.location.hostname.indexOf(&amp;quot;github&amp;quot;) !== -1) {&lt;br /&gt;
        // 如果是github 还需要处理一些别的元素&lt;br /&gt;
        const githubSelector = [&lt;br /&gt;
            &amp;#039;#repository-container-header &amp;gt; div:nth-child(1)&amp;#039;,&lt;br /&gt;
            &amp;#039;summary.btn.css-truncate&amp;#039;,&lt;br /&gt;
            &amp;#039;.commit-author&amp;#039;,&lt;br /&gt;
            &amp;#039;.js-navigation-open.link-gray-dark&amp;#039;,&lt;br /&gt;
            &amp;#039;.Box-title&amp;#039;,&lt;br /&gt;
            &amp;#039;.BorderGrid-cell &amp;gt; div.mt-3 &amp;gt; a.Link--muted&amp;#039;,&lt;br /&gt;
            &amp;#039;.BorderGrid-cell &amp;gt; a[data-pjax=&amp;quot;#repo-content-pjax-container&amp;quot;] &amp;gt; div &amp;gt; div:first-child&amp;#039;,&lt;br /&gt;
            &amp;#039;.BorderGrid-cell &amp;gt; ul.list-style-none&amp;#039;,&lt;br /&gt;
            &amp;#039;div[role=&amp;quot;rowheader&amp;quot;]&amp;#039;&lt;br /&gt;
        ]&lt;br /&gt;
        bypassSelectorArray.push.apply(bypassSelectorArray, githubSelector)&lt;br /&gt;
&lt;br /&gt;
        //如果还有github的插件 还需要延迟追加一些&lt;br /&gt;
        setTimeout(function () {&lt;br /&gt;
            const githubPluginSelector = [&lt;br /&gt;
                &amp;#039;.github-repo-size-div&amp;#039;,&lt;br /&gt;
                &amp;#039;.octotree-tree-view&amp;#039;&lt;br /&gt;
            ]&lt;br /&gt;
            noTranslate(githubPluginSelector)&lt;br /&gt;
        }, 3000)&lt;br /&gt;
    }&lt;br /&gt;
    noTranslate(bypassSelectorArray)&lt;br /&gt;
})()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;脚本 match 内添加需要生效的网站，然后点击文件，保存。&lt;br /&gt;
&lt;br /&gt;
刷新网页，即可体验。&lt;br /&gt;
[[分类:Chrome]]&lt;/div&gt;</summary>
		<author><name>FC</name></author>
	</entry>
</feed>