Skip to content

Commit

Permalink
Implemented Trek Detail button
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffyactive committed Apr 25, 2024
1 parent dba477d commit 3f5b3aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions common/js/trekungen.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const TREKS = [ 'denvegaser', 'via603', 'sierraround', 'phoever', 'amtrak8',
const offcanvasTitle = document.querySelector('#offcanvasTitle');
const trekTitle = document.querySelector('#trekTitle');
const trekYouTube = document.querySelector('#trekYouTube');
const trekWebPage = document.querySelector('#trekWebPage');
const trekGitHub = document.querySelector('#trekGitHub');
const offcanvas = new bootstrap.Offcanvas(document.querySelector('#offcanvas'));

// OpenLayers components
Expand Down Expand Up @@ -68,6 +70,8 @@ function updateOffcanvas(trek) {
.then((response) => response.json())
.then((json) => { trekTitle.textContent = json.title;
trekYouTube.src = json.youtube;
trekWebPage.href = document.location.href + trek,
trekWebPage.hidden = (json.hasWebPage !== true),
trekGitHub.href = TREKUNGEN_GITHUB + trek });
offcanvasTitle.textContent = trek;
offcanvas.show();
Expand Down
3 changes: 2 additions & 1 deletion denvegaser/overview.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"title": "Denver to Las Vegas roundtrip on scenic byways",
"youtube": "https://www.youtube.com/embed/videoseries?si=kqP-Vkp7r0FaX5Cy&list=PLuoY9uzz-lDHwVTLOTdI0hVyUgSXRSK1r"
"youtube": "https://www.youtube.com/embed/videoseries?si=kqP-Vkp7r0FaX5Cy&list=PLuoY9uzz-lDHwVTLOTdI0hVyUgSXRSK1r",
"hasWebPage": true
}
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ <h3 id="trekTitle" class="mb-3"></h3>
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen></iframe>
</div>
<p>
<a href="" id="trekWebPage" class="btn btn-primary"
hidden> Trek Page </a>
</p>
<p>
<i class="bi-github"></i>
<a href="" target="_blank" id="trekGitHub"> Source </a>
Expand Down

0 comments on commit 3f5b3aa

Please sign in to comment.