Nikola auto commit.

Nikola version: 8.3.3
src
Patricio García 2025-08-24 22:29:27 +01:00
parent 9549297875
commit 723b4018c7
5 changed files with 34 additions and 13 deletions

Binary file not shown.

View File

@ -2,8 +2,8 @@
* Detect no next Gancio events and deactivate Next events * Detect no next Gancio events and deactivate Next events
*/ */
function GetNextEventsCount() { function GetNextEventsCount(ge_id) {
const entryComponent = document.querySelector('#nextevents'); const entryComponent = document.querySelector('#' + ge_id);
const shadowRoot = entryComponent.shadowRoot; const shadowRoot = entryComponent.shadowRoot;
const app = shadowRoot.querySelector('div'); const app = shadowRoot.querySelector('div');
if (app != null) { if (app != null) {
@ -13,11 +13,11 @@ function GetNextEventsCount() {
} }
} }
function ActivePastEvents() { function ActivePastEvents(tab_next, tab_past) {
const nexttab = document.getElementById("tab-0"); const nexttab = document.getElementById("tab-" + tab_next);
const next = document.getElementById("tab-pane-0"); const next = document.getElementById("tab-pane-" + tab_next);
const pasttab = document.getElementById("tab-1"); const pasttab = document.getElementById("tab-" + tab_past);
const past = document.getElementById("tab-pane-1"); const past = document.getElementById("tab-pane-" + tab_past);
if (nexttab != null && next !== null){ if (nexttab != null && next !== null){
next.classList.remove("active"); next.classList.remove("active");
nexttab.classList.remove("active"); nexttab.classList.remove("active");
@ -30,8 +30,8 @@ function ActivePastEvents() {
} }
} }
function ActivePastEventsIfNotNexts() { function ActivePastEventsIfNotNexts(ge_id, tab_next, tab_past) {
if (GetNextEventsCount() == 0) { if (GetNextEventsCount(ge_id) == 0) {
ActivePastEvents(); ActivePastEvents(tab_next, tab_past);
} }
} }

View File

@ -22,4 +22,4 @@
<script src='/assets/js/gancio-events.es.js'></script> <script src='/assets/js/gancio-events.es.js'></script>
{{% gancio-events-detect %}} {{% gancio-events-detect ge_id='nextevents' tab_next='0' tab_past='1' %}}

View File

@ -1,6 +1,28 @@
<%doc> <%doc>
Load gancio-events-detect.js and call ActivePastEventsIfNotNexts() when page is load Load gancio-events-detect.js and call ActivePastEventsIfNotNexts() when page is load
Template engine: Mako
Usage:
tab_next, tab_past
{{% gancio-events-detect ge_id=<ge_id> [tab_next=<tab_next>] [tab_past=<tab_past>] %}}
where <id_ge> is the ID of past gancio-events HTML tag, tab_next and tab_past are the number of tabs for next and past events
</%doc> </%doc>
% if tab_next is UNDEFINED:
<% tn = '0' %>
% else:
<% tn = tab_next %>
% endif
% if tab_past is UNDEFINED:
<% tp = '1' %>
% else:
<% tp = tab_past %>
% endif
<% site.template_hooks['body_end'].append('<script src="/assets/js/gancio-events-detect.js"></script>') %> <% site.template_hooks['body_end'].append('<script src="/assets/js/gancio-events-detect.js"></script>') %>
<% site.template_hooks['body_end'].append('<script> $(document).ready(function(){ ActivePastEventsIfNotNexts(); });</script>') %>
<% params = '\"' + ge_id + '\", \"' + tn + '\", \"' + tp + '\"' %>
<% site.template_hooks['body_end'].append('<script> $(document).ready(function(){ ActivePastEventsIfNotNexts(' + params + '); });</script>') %>

View File

@ -23,7 +23,6 @@ separate each tab from the next with two blank lines. Where <active> is the numb
</%doc> </%doc>
<% tabs = data.split('\n\n\n') %> <% tabs = data.split('\n\n\n') %>
## <% lines = [item for item in lines if item != ''] %>
<% ntabs = len(tabs) %> <% ntabs = len(tabs) %>
% if active is UNDEFINED: % if active is UNDEFINED:
<% act = None %> <% act = None %>