intro to algo

"intro to algo"

Versione datata 29/06/2021. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         intro to algo
// @namespace    http://tampermonkey.net/
// @version      0.3.2
// @description  "intro to algo"
// @author       You
// @match        http://staff.ustc.edu.cn/~csli/graduate/algorithms/*
// @icon         https://www.google.com/s2/favicons?domain=ustc.edu.cn
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var body = document.getElementsByTagName('body');
    body[0].style.cssText = 'max-width: 50%;    padding-left: 25%;    text-align: justify;    font-size: 20px;    background-color: #272822;    color: #e6db74;font-family: verdana; filter: brightness(0.80); text-indent: 40px; line-height: 30px';

    var h1_list = document.getElementsByTagName('h1');
    for(let i = 0; i<h1_list.length;i++){h1_list[i].style.color = '#48b22b'};

    var h2_list = document.getElementsByTagName('h2');
    for(let i = 0; i<h2_list.length;i++){h2_list[i].style.color = '#48b22b'};

    var h4_list = document.getElementsByTagName('h4');
    for(let i = 0; i<h4_list.length;i++){h4_list[i].style.color = '#bdbdbd'};

    var sub_list = document.getElementsByTagName('sub');
    for(let i = 0; i<sub_list.length;i++){sub_list[i].style.color = '#fd971f'};

    var sup_list = document.getElementsByTagName('sup');
    for(let i = 0; i<sup_list.length;i++){sup_list[i].style.color = '#fd971f'};

    var pre_list = document.getElementsByTagName('pre');
    for(let i = 0; i<pre_list.length;i++){
        var pre_list_italic = pre_list[i].getElementsByTagName('i');
        for(let j = 0; j<pre_list_italic.length;j++){
            pre_list_italic[j].style.color = '#fd971f'
        }

    }

    var a_list = document.getElementsByTagName('a');
    for(let i = 0; i<a_list.length;i++){
        var a_list_b = a_list[i].getElementsByTagName('b');
        for(let j = 0; j<a_list_b.length;j++){
            a_list_b[j].style.color = '#59d9ef'
        }
    }

    var p_list = document.getElementsByTagName('p');
    for(let i = 0; i<p_list.length;i++){
        var p_list_italic = p_list[i].getElementsByTagName('i');
        for(let j = 0; j<p_list_italic.length;j++){
            p_list_italic[j].style.color = '#fd971f'
            var p_list_italic_bold = p_list_italic[j].getElementsByTagName('b');
            for(let k = 0; k<p_list_italic_bold.length;k++){
                p_list_italic_bold[k].style.color = '#b042f5'
            }
        }
    }

    body[0].innerHTML = body[0].innerHTML.replaceAll('<img src="../images/lftwdchv.gif">','<a style="color:#48b22b">(');
    body[0].innerHTML = body[0].innerHTML.replaceAll('<img src="../images/wdrtchv.gif">',')</a>');
    body[0].innerHTML = body[0].innerHTML.replaceAll('<img src="../images/lteq12.gif">',' ≤ ');
    body[0].innerHTML = body[0].innerHTML.replaceAll('<img src="../images/gteq.gif">',' ≥ ');
//body[0].innerHTML = body[0].innerHTML.replaceAll('<img src="../images/hfbrdl12.gif">','[');
//body[0].innerHTML = body[0].innerHTML.replaceAll('<img src="../images/hfbrdr12.gif">',']');
    body[0].innerHTML = body[0].innerHTML.replaceAll('<img src="../images/arrlt12.gif">','←');
    body[0].innerHTML = body[0].innerHTML.replaceAll('<img src="../images/bound.gif">','O');
    body[0].innerHTML = body[0].innerHTML.replace(/\<[\w\s="]+>([a-zA-Z\s-]+)<\/font>/g,'<a style="color:#48b22b; font-weight: bold">$1</a>')

})();