Skip to content
Snippets Groups Projects
Select Git revision
  • 6b1390403efdb482905482931c66684d02bd4ef1
  • main default protected
  • HaoyuSun
  • C23096663
  • C24007548
  • rogerxu
6 results

profil.html

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    allTrails.html 1.56 KiB
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>All Trails</title>
        <link rel="stylesheet" th:href="@{css/allTrails.css}">
        <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    </head>
    <body>
    
    <header>
        <ul class="flexList">
            <!--TODO trail image instead of title-->
            <li class="listButton" th:each="trail : ${trails}">
                <a class="listA" th:onclick="'updateOutputTrail('+ ${trail.id} +');'" th:id="'li' + ${trail.id}">
                    <img th:src="@{${trail.getImgPath()}}" class="trailsImages" th:id="'img' + ${trail.getId()}" alt="IMG">
                </a>
    
            </li>
        </ul>
    </header>
    
    <main>
        <section id="trailInfoBox"></section>
    </main>
    
    
    <script type="text/javascript" th:src="@{scripts/allTrails.js}"></script>
    <script th:inline="javascript">
        function updateOutputTrail(id) {
            /* Updates the trail being shown on screen to the one requested by ID */
            $.get("/allTrails/" + id).done(function (fragment) {
                $("#trailInfoBox").html(fragment)
            });
            updateSelectedTrail(id);
        }
        function updateSelectedTrail(id) {
            /* Updates the trail bar, so that it highlights the selected trail */
            let list = document.getElementsByClassName('trailsImages')
            for (let i = 0; i < list.length; i++) {
                if (list[i].classList.contains('selected')) {
                    list[i].classList.remove('selected')
                    break
                }
            }
            document.getElementById("img" + id).classList.add("selected")
        }
    </script>
    </body>
    </html>