summaryrefslogtreecommitdiff
blob: 3ec0494061c6c7f1fd97f43e0833f2a1d904f81d (plain)
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
var showingBurgerMenu = false;

function showMenu() {
    showingBurgerMenu = !showingBurgerMenu;

    var mobileMenu = document.getElementById("burger-menu");

    if (showingBurgerMenu) {
        mobileMenu.classList.add("show");
    } else {
        mobileMenu.classList.remove("show");
    }

}

function copyText(buttonDiv) {
    for (var i=0;i<buttonDiv.parentNode.childNodes.length;i++) {

        if (buttonDiv.parentNode.childNodes[i].tagName!=undefined) {
            if (buttonDiv.parentNode.childNodes[i].tagName.toLowerCase()=="code") {
                var codeBlock = buttonDiv.parentNode.childNodes[i];
                var copyText = codeBlock.innerHTML;
                const textArea = document.createElement('textarea');
                textArea.textContent = copyText;
                document.body.append(textArea);
                textArea.select();
                document.execCommand("copy");
            }
        }
    }
}

function showCopyButton(preDiv) {
    for (var i=0;i<preDiv.childNodes.length;i++) {

        if (preDiv.childNodes[i].tagName!=undefined) {
            if (preDiv.childNodes[i].tagName.toLowerCase()=="button") {
                preDiv.childNodes[i].classList.add("show");
            }
        }
    }
}

function hideCopyButton(preDiv) {
    for (var i=0;i<preDiv.childNodes.length;i++) {

        if (preDiv.childNodes[i].tagName!=undefined) {
            if (preDiv.childNodes[i].tagName.toLowerCase()=="button") {
                preDiv.childNodes[i].classList.remove("show");
            }
        }
    }
}