38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
/*
|
|
* Detect no next Gancio events and deactivate Next events
|
|
*/
|
|
|
|
function GetNextEventsCount(ge_id) {
|
|
const entryComponent = document.querySelector('#' + ge_id);
|
|
const shadowRoot = entryComponent.shadowRoot;
|
|
const app = shadowRoot.querySelector('div');
|
|
if (app != null) {
|
|
return app.children.length;
|
|
} else {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
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");
|
|
next.classList.add("fade");
|
|
}
|
|
if (pasttab != null && past !== null){
|
|
past.classList.remove("fade");
|
|
past.classList.add("active");
|
|
pasttab.classList.add("active");
|
|
}
|
|
}
|
|
|
|
function ActivePastEventsIfNotNexts(ge_id, tab_next, tab_past) {
|
|
if (GetNextEventsCount(ge_id) == 0) {
|
|
ActivePastEvents(tab_next, tab_past);
|
|
}
|
|
}
|