aboutsummaryrefslogtreecommitdiff
blob: 00a2d0901ecd8026bc83516842c8777f815cba5a (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
window.onload = function() {
    document.body.onscroll = function(){
        updateNav();
    };
};

document.addEventListener("turbolinks:load", function() {

    updateNav();
})

function updateNav() {
    var elements = [];

    if(window.location.href.includes("/user/preferences/packages")){
        elements = ['overview', 'dependencies', 'qa-report', 'pull-requests', 'bugs', 'security', 'changelog', 'tabs'];
    }else if(window.location.href.includes("/user/preferences/arches")){
        elements = ['keywords', 'defaults'];
    }

    for(var i = 0; i < elements.length; i++){
        if (document.getElementById(elements[i]).getBoundingClientRect().y <= window.innerHeight) {
            document.getElementById(elements[i]+"-tab").classList.add("active");
        } else {
            document.getElementById(elements[i]+"-tab").classList.remove("active");
        }
    }
}

if(document.getElementById("myModal") != null) {
    var modal = document.getElementById("myModal");

    var img1 = document.getElementById("img1");
    var img2 = document.getElementById("img2");
    var modalImg = document.getElementById("img01");
    var captionText = document.getElementById("caption");
    img1.onclick = function () {
        modal.style.display = "block";
        modalImg.src = this.src;
        captionText.innerHTML = this.alt;
    }
    img2.onclick = function () {
        modal.style.display = "block";
        modalImg.src = this.src;
        captionText.innerHTML = this.alt;
    }

    var span = document.getElementsByClassName("close")[0];

    span.onclick = function () {
        modal.style.display = "none";
    }
}