parent
9549297875
commit
723b4018c7
BIN
.doit.db.db
BIN
.doit.db.db
Binary file not shown.
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,4 @@
|
|||
|
||||
<script src='/assets/js/gancio-events.es.js'></script>
|
||||
|
||||
{{% gancio-events-detect %}}
|
||||
{{% gancio-events-detect ge_id='nextevents' tab_next='0' tab_past='1' %}}
|
||||
|
|
|
@ -1,6 +1,28 @@
|
|||
<%doc>
|
||||
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>
|
||||
|
||||
% 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> $(document).ready(function(){ ActivePastEventsIfNotNexts(); });</script>') %>
|
||||
|
||||
<% params = '\"' + ge_id + '\", \"' + tn + '\", \"' + tp + '\"' %>
|
||||
|
||||
<% site.template_hooks['body_end'].append('<script> $(document).ready(function(){ ActivePastEventsIfNotNexts(' + params + '); });</script>') %>
|
||||
|
|
|
@ -23,7 +23,6 @@ separate each tab from the next with two blank lines. Where <active> is the numb
|
|||
</%doc>
|
||||
|
||||
<% tabs = data.split('\n\n\n') %>
|
||||
## <% lines = [item for item in lines if item != ''] %>
|
||||
<% ntabs = len(tabs) %>
|
||||
% if active is UNDEFINED:
|
||||
<% act = None %>
|
||||
|
|
Loading…
Reference in New Issue