Skip to content

Instantly share code, notes, and snippets.

@vhxubo
Created August 16, 2021 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vhxubo/a5ce83f3634d4073eaef52e6e0ce6822 to your computer and use it in GitHub Desktop.
Save vhxubo/a5ce83f3634d4073eaef52e6e0ce6822 to your computer and use it in GitHub Desktop.
Don't translate <pre> by Google Translate
// ==UserScript==
// @name Don't translate <pre>
// @namespace https://gist.github.com/vhxubo/a5ce83f3634d4073eaef52e6e0ce6822
// @version 0.1
// @description Don't translate <pre> by Google Translate
// @author vhxubo
// @match *://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
// https://html.spec.whatwg.org/multipage/dom.html#the-translate-attribute
var allPre = document.getElementsByTagName("pre");
for(var i = 0; i < allPre.length; i++){
allPre[i].setAttribute("translate","no");
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment