深耕EMC实践,严谨对标国际标准,构建中文电磁兼容与国际认证开放知识库 —— 让技术沉淀,让分享增值!

MediaWiki:Common.js:修订间差异

来自认证百科
Admin留言 | 贡献
清空全部内容
标签清空
Admin留言 | 贡献
无编辑摘要
标签已被回退
第1行: 第1行:
mw.loader.using('mediawiki.util', function () {
    var box = document.createElement('div');
    box.id = 'google_translate_box';
    box.style.position = 'fixed';
    box.style.top = '10px';
    box.style.right = '20px';
    box.style.zIndex = '9999';
    box.style.background = '#fff';
    box.style.padding = '6px 10px';
    box.style.border = '1px solid #ccc';
    box.style.borderRadius = '6px';
    box.style.boxShadow = '0 2px 6px rgba(0,0,0,0.15)';


    box.innerHTML = '<div id="google_translate_element"></div>';
    document.body.appendChild(box);
    window.googleTranslateElementInit = function () {
        new google.translate.TranslateElement({
            pageLanguage: 'zh-CN',
            includedLanguages: 'en,ja,ko,de,fr,ru,es,pt,it,vi,th,ar',
            layout: google.translate.TranslateElement.InlineLayout.SIMPLE
        }, 'google_translate_element');
    };
    var script = document.createElement('script');
    script.src = '//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit';
    document.body.appendChild(script);
});

2026年5月14日 (四) 17:49的版本

mw.loader.using('mediawiki.util', function () {
    var box = document.createElement('div');
    box.id = 'google_translate_box';
    box.style.position = 'fixed';
    box.style.top = '10px';
    box.style.right = '20px';
    box.style.zIndex = '9999';
    box.style.background = '#fff';
    box.style.padding = '6px 10px';
    box.style.border = '1px solid #ccc';
    box.style.borderRadius = '6px';
    box.style.boxShadow = '0 2px 6px rgba(0,0,0,0.15)';

    box.innerHTML = '<div id="google_translate_element"></div>';
    document.body.appendChild(box);

    window.googleTranslateElementInit = function () {
        new google.translate.TranslateElement({
            pageLanguage: 'zh-CN',
            includedLanguages: 'en,ja,ko,de,fr,ru,es,pt,it,vi,th,ar',
            layout: google.translate.TranslateElement.InlineLayout.SIMPLE
        }, 'google_translate_element');
    };

    var script = document.createElement('script');
    script.src = '//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit';
    document.body.appendChild(script);
});