JGY Front-end Dev Engineer
「创建博客」 「编辑」 「本文源码」

谷歌翻译

2019-05-17

!function(){/*《谷歌网页翻译js注入版v1.2》【说明】按钮开关“F”是上滑隐藏下滑显示的。只有点击开关后才会联网加载谷歌网页翻译的js脚本,当前窗口初次使用需要选择翻译目标语言(简繁英)*/if(!document.getElementById("ggfy")){var gfyan=document.createElement("span");gfyan.id="ggfy";gfyan.innerHTML="F";gfyan.style.cssText="display:none;text-align:center !important;font-size:20px;width:28px;height:28px;line-height:28px;text-align:center;float:right;position:fixed;right:10px;top:60%;color:#000;opacity:0.8;background:#e3edcd;cursor:pointer;position:fixed !important;z-index:9999999999 !important;box-shadow:0px 1px 1px #000;border-radius:50%";gfyan.addEventListener("click",function(){gfy()});document.body.appendChild(gfyan);}var gfyhdy1,gfyhdy2;document.addEventListener("touchstart",function(e){gfyhdy1=e.changedTouches[0].clientY});document.addEventListener("touchmove",function(e){gfyhdy2=e.changedTouches[0].clientY;document.getElementById("ggfy").style.display=gfyhdy2-gfyhdy1>0?"block":"none"});function gfy(){var fyfy=document.getElementById("ggfy");fyfy.parentNode.removeChild(fyfy);if(!document.getElementById("google_translate_element")){var script=document.createElement('script');script.src='//translate.google.cn/translate_a/element.js?cb=googleTranslateElementInit';document.getElementsByTagName('head')[0].appendChild(script);var google_translate_element=document.createElement('div');google_translate_element.id='google_translate_element';google_translate_element.style='position:fixed; bottom:10px; right:10px; cursor:pointer;';document.documentElement.appendChild(google_translate_element);script=document.createElement('script');script.innerHTML="function googleTranslateElementInit() {new google.translate.TranslateElement({layout: google.translate.TranslateElement.InlineLayout.SIMPLE,multilanguagePage: true,pageLanguage: 'auto',includedLanguages: 'zh-CN,zh-TW,en'}, 'google_translate_element');}";document.getElementsByTagName('head')[0].appendChild(script)}}}();

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

¥ 打赏博主

上一篇 彩云小译

下一篇 书法

发布评论

Content