1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-06-05 21:59:25 +02:00

add 2 min request cache, remove a few unneeded semicolons

This commit is contained in:
Daniel Waxweiler
2021-04-04 18:03:05 +02:00
parent 214fc50d6d
commit 28245574d8
11 changed files with 106 additions and 40 deletions

View File

@ -1,8 +1,8 @@
import { DateTimeWrapper } from './date-time-wrapper';
import { DateTimeWrapper } from './date-time-wrapper'
import * as GraphqlWrapper from './graphql-wrapper'
import * as HtmlCreator from './html-creator'
const NAME = '<wordpress-name>';
const NAME = '<wordpress-name>'
function displayEvents(data, list) {
const maxEventsCount = list.getAttribute('data-maximum')
@ -11,7 +11,7 @@ function displayEvents(data, list) {
for (let i = 0; i < eventsCount; i++) {
const li = document.createElement('li')
const a = HtmlCreator.createAnchorElement({ text: events[i].title, url: events[i].url });
const a = HtmlCreator.createAnchorElement({ text: events[i].title, url: events[i].url })
li.appendChild(a)
const br = document.createElement('br')
@ -26,7 +26,7 @@ function displayEvents(data, list) {
dateText += endsOn.getShortDate() + ' '
}
dateText += endsOn.get24Time()
const textnode = document.createTextNode(dateText);
const textnode = document.createTextNode(dateText)
li.appendChild(textnode)
list.appendChild(li)
@ -44,7 +44,7 @@ document.addEventListener('DOMContentLoaded', () => {
const eventLists = document.getElementsByClassName(NAME + '_events-list')
for (let list of eventLists) {
const url = list.getAttribute('data-url') + '/api'
const limit = list.getAttribute('data-maximum')
const limit = parseInt(list.getAttribute('data-maximum'))
const groupName = list.getAttribute('data-group-name')
if (groupName) {
GraphqlWrapper.getUpcomingEventsByGroupName({ url, limit, groupName })