Created
July 28, 2018 01:46
-
-
Save xiaoxiaoflood/491ae274b9298414eac4723c47b8f0d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Auto Page Translate | |
// @namespace http://www.orkut.com | |
// @include *://*.mozest.com/* | |
// @include *://bbs.kafan.cn/* | |
// @include *://www.camp-firefox.de/* | |
// @include *://www.firefox.net.cn/* | |
// @include *://egg.5ch.net/* | |
// @include *://mozilla.com.cn/* | |
// @noframes | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
d = document; | |
b = d.body; | |
e = d.createElement('script'); | |
e.text = 'Element.prototype.addEventListener=(function(){var cached_function=Element.prototype.addEventListener;return function(){if((arguments[0]=="mouseover" || arguments[0]=="mousemove" || arguments[0]=="mouseout" || arguments[0]=="focus" || arguments[0]=="blur") && arguments[1] == "function(c){return a.call(b.src,b.listener,c)}"){return;};var result=cached_function.apply(this,arguments);return result;};})();'; | |
e.setAttribute('type', 'text/javascript'); | |
b.appendChild(e); | |
o = d.createElement('script'); | |
o.setAttribute('src', 'https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit'); | |
o.setAttribute('type', 'text/javascript'); | |
b.appendChild(o); | |
v = b.insertBefore(d.createElement('div'), b.firstChild); | |
v.id = 'google_translate_element'; | |
v.style.display = 'none'; | |
p = d.createElement('script'); | |
p.text = 'function googleTranslateElementInit(){new google.translate.TranslateElement({pageLanguage:\"\", includedLanguages: \"en,pt\", layout: google.translate.TranslateElement.InlineLayout.SIMPLE},\"google_translate_element\");}'; | |
p.setAttribute('type', 'text/javascript'); | |
b.appendChild(p); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment