ar5iv helper

避免翻译 ar5iv 页面上的公式

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         ar5iv helper
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  避免翻译 ar5iv 页面上的公式
// @author       superzero
// @license      MIT
// @match        https://ar5iv.labs.arxiv.org/html/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=arxiv.org
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    // 获取所有class为ltx_Math和ltx_equationgroup的元素
    var mathElems = document.querySelectorAll('.ltx_Math, .ltx_equationgroup, .ltx_equation, .ltx_figure, .ltx_table');

    // 遍历所有元素
    for (var i = 0; i < mathElems.length; i++) {
        // 给元素添加translate属性
        mathElems[i].setAttribute('translate', 'no');

        // 获取元素内部所有标签
        var tags = mathElems[i].getElementsByTagName('*');

        // 遍历所有标签
        for (var j = 0; j < tags.length; j++) {
            // 给标签添加translate属性
            tags[j].setAttribute('translate', 'no');
        }
    }


    // 获取所有class既是ltx_caption又是ltx_centering的元素
    var elems = document.querySelectorAll('.ltx_caption.ltx_centering');

    // 遍历所有元素
    for (var k = 0; k < elems.length; k++) {
        // 给元素添加属性,例如添加translate属性
        elems[k].setAttribute('translate', 'no');
    }
})();