diff --git a/assets/js/gancio-events-detect.js b/assets/js/gancio-events-detect.js index 6837ce8..ed6d533 100644 --- a/assets/js/gancio-events-detect.js +++ b/assets/js/gancio-events-detect.js @@ -2,8 +2,8 @@ * Detect no next Gancio events and deactivate Next events */ -function GetNextEventsCount() { - const entryComponent = document.querySelector('#nextevents'); +function GetNextEventsCount(ge_id) { + const entryComponent = document.querySelector('#' + ge_id); const shadowRoot = entryComponent.shadowRoot; const app = shadowRoot.querySelector('div'); if (app != null) { @@ -13,11 +13,11 @@ function GetNextEventsCount() { } } -function ActivePastEvents() { - const nexttab = document.getElementById("tab-0"); - const next = document.getElementById("tab-pane-0"); - const pasttab = document.getElementById("tab-1"); - const past = document.getElementById("tab-pane-1"); +function ActivePastEvents(tab_next, tab_past) { + const nexttab = document.getElementById("tab-" + tab_next); + const next = document.getElementById("tab-pane-" + tab_next); + const pasttab = document.getElementById("tab-" + tab_past); + const past = document.getElementById("tab-pane-" + tab_past); if (nexttab != null && next !== null){ next.classList.remove("active"); nexttab.classList.remove("active"); @@ -30,8 +30,8 @@ function ActivePastEvents() { } } -function ActivePastEventsIfNotNexts() { - if (GetNextEventsCount() == 0) { - ActivePastEvents(); +function ActivePastEventsIfNotNexts(ge_id, tab_next, tab_past) { + if (GetNextEventsCount(ge_id) == 0) { + ActivePastEvents(tab_next, tab_past); } } diff --git a/events/index.html b/events/index.html index 0f4b0e2..d63fcbf 100644 --- a/events/index.html +++ b/events/index.html @@ -118,6 +118,12 @@ bg-dark

+ + + + + +

@@ -221,6 +227,6 @@ bg-dark for (let i = 0; i < document.forms.length; i++) document.forms[i].onsubmit = submit; })(); - + diff --git a/events/index.md b/events/index.md index f2f9cb1..d34cdc1 100644 --- a/events/index.md +++ b/events/index.md @@ -22,4 +22,4 @@ -{{% gancio-events-detect %}} +{{% gancio-events-detect ge_id='nextevents' tab_next='0' tab_past='1' %}}