Code Highlight!!!

Post #89 written by Khodok in Blog Updates

Content

Code Highlight!

Now code can be highlighted like this:

JavaScript
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/// Head
let url = new URL(window.location.href);

var eee = url.searchParams.get('e');
var loop = url.searchParams.get('LL') || false;

var isTrueSet = loop == 'true';

if (!eee) {
    isTrueSet = false;
}


/// Body
let e = document.querySelector('[e]');

let str = 'R';
let strRepeat = 'E';

let bgColor = 'red';
let color = 'yellow';

let title = 'Kheee';

text();

function text() {
    switch (eee) {
        case 'e':
            strRepeat = 'e';

            strChange(str, strRepeat, false, false, true);
            break;

        case 'voilà':
            str = 'VOIL';
            strRepeat = 'À';

            bgColor = 'purple';
            color = 'gold';

            strChange(str, strRepeat, false, false, false);
            break;

        default:
            if (isTrueSet) {
                str = eee;
                strRepeat = eee;

                strChange(str, strRepeat, false, true, false);
            } else {
                strChange(str, strRepeat, true, false, false);
            }
    }
}

function strChange(str, strRepeat, isREEE, isLL, isE) {
    if (!isREEE) {
        title = str + strRepeat;
    }

    if (isLL) {
        title = str;
    }

    if (!isE) {
        document.title = title;
        e.innerHTML = e.innerHTML.replace('e', str);
        changeColor(bgColor, color);
    }

    clock(strRepeat);
}

function clock(strRepeat) {
    setInterval(() => {
        e.innerHTML += strRepeat;
    }, 1);
}

function changeColor(bgColor, color) {
    e.style.backgroundColor = bgColor;
    e.style.color = color;
}

This is the code from Kheee, only the Javascript, I know it’s not the best way to do it but it’s because when I first made it I was learning stuff and decided to do it a this way, and then I kept it and just updated it with new things later, and to be honest I kinda like it 😂

And I have 500 different languages I can highlight.

It took months, why?

Well… Idk why I never checked the Network after adding the extension doing this… but they actually don’t provide a CSS by default… and I just never read THE EXACT LINE saying it 😂

So now I added this CSS and it uses Palenight Dark, but I’d want it to be Shades of Purple… sadly I need to make it myself since nobody did at the moment and I know how… it’s just a long work since I have to make it look good, so I’ll do it at some point… or never

Comments

Please Log in to leave a comment.

No comments yet.