14392 10 1 1
// ==UserScript==
// @name 少数民族网页翻译
// @version 1
// @run-at document-end

// ==/UserScript==

(function () {
    'use strict';
    var userLang = document.documentElement.lang;
    
  {
        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: 'ug,en,uz,kk,zh-CN'" +
            "}, 'google_translate_element');}";
        document.getElementsByTagName('head')[0].appendChild(script);
    }
})();
最新回复 (10)
  • 0 引用
    怎么添加脚本啊,扩展右上角三个点添加口令导入失败。
    2022-8-9 取消查看 收起回复
    akaltun: 一键复制不管用了吗
    2022-8-9回复
    • 轻创社区 - 有源软件体验中心
      12
        登录 注册
返回