Codeforces Better!

Uno script Tampermonkey per Codeforces che migliora la funzionalità e l'interfaccia.

< Valutazione su Codeforces Better!

Domanda/commento

§
Pubblicato: 21/11/2023

点击翻译之后就是第一个图片,然后允许一次就是第二个图片,这是什么问题啊。

北极小狐Autore
§
Pubblicato: 21/11/2023

Google 翻译中脚本不应该会去请求 www.google.com ,而是请求 translate.google.com,请确认你是否修改了代码

相关代码:

//--谷歌翻译--start
async function translate_gg(raw) {
    return new Promise((resolve, reject) => {
        const url = 'https://translate.google.com/m';
        const params = `tl=zh-CN&q=${encodeURIComponent(raw)}`;

        GM_xmlhttpRequest({
            method: 'GET',
            url: `${url}?${params}`,
            onload: function (response) {
                const html = response.responseText;
                const translatedText = $(html).find('.result-container').text();
                resolve(translatedText);
            },
            onerror: function (response) {
                // ...
            }
        });
    });
}

Pubblica risposta

Accedi per pubblicare una risposta.