1. JavaScript / Говнокод #26442

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    // sorry, I don't want to use any JS templater
    // so I'll concatenate html as strings, which is the worst practice
    // but my IntelliJ IDEA highlights html in strings well :)
    // and I write this code just4fun
    //
    // but to respect production I'll leave here something that will never be fixed
    // TODO: rewrite in Angular.js
    //
    // done!
    
    // ...
    
    // u still read this spaghetti?
    
    let evaluate = (s) => {
        completion = [];
        hist = [];
    
        let tokens = s.split(' ').filter((s) => s !== '');
    
        if (!tokens[0]) return;
        histfile.push(s);
    
        if (tokens[0] === 'clear') clear();
        else if (tokens[0] === 'aplay') aplay();
        else if (tokens[0] === 'man') try {
            template(tokens.slice(0, 2).join('_'))();
        } catch {
            stdout('No manual entry for <span class="red">' + tokens[1] + '</span>')
        }

    Сайт-визитка на plain js для подкаста в виде эмулятора терминала с пасхалками
    https://deveeps.prost.host/

    Запостил: vistefan, 19 Февраля 2020

    Комментарии (67) RSS

    Добавить комментарий