*** WIP WIP *** woks now for live and havg
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
|
||||
import * as map from './map.js'
|
||||
import * as dt from './datetime.js'
|
||||
import {logit} from './logit.js'
|
||||
import {logerror, logit} from './logit.js'
|
||||
import * as chart_live from './chart_live.js'
|
||||
import * as chart_houravg from './chart_houravg.js'
|
||||
import * as chart_dayavg from './chart_dayavg.js'
|
||||
import * as chart_daynight from './chart_daynight.js'
|
||||
import * as chart_lden from './chart_lden.js'
|
||||
import * as utils from "./chart_utilities.js";
|
||||
import {showChart} from './showcharts.js'
|
||||
|
||||
(async () => {
|
||||
|
||||
@@ -32,22 +34,30 @@ import * as chart_lden from './chart_lden.js'
|
||||
}
|
||||
// END global variables
|
||||
|
||||
// table to distribute the different charts
|
||||
const tabtable = [
|
||||
{id: 'kartentab', func: map.showMap},
|
||||
{id: 'livetab', func: chart_live.showLive},
|
||||
{id: 'houravgtab', func: chart_houravg.showHouravg},
|
||||
{id: 'dayavgtab', func: chart_dayavg.showDayavg},
|
||||
{id: 'daynighttab', func: chart_daynight.showDaynight},
|
||||
{id: 'ldentab', func: chart_lden.showLden},
|
||||
{id: 'kartentab', type: 'map', container: 'map', func: map.showMap},
|
||||
{id: 'livetab', type: 'live', container: 'dlive', func: showChart},
|
||||
{id: 'houravgtab', type: 'havg', container: 'dhour', func: showChart},
|
||||
{id: 'dayavgtab', type: 'davg', container: 'dday', func: showChart},
|
||||
{id: 'daynighttab', type: 'daynight', container: 'ddaynight', func: showChart},
|
||||
{id: 'ldentab', type: 'lden', container: 'dlden', func: showChart},
|
||||
]
|
||||
|
||||
|
||||
// remove the taps (if shownig the map)
|
||||
const removeTabs = () => {
|
||||
document.querySelector('#navi').style.display = 'none'
|
||||
}
|
||||
|
||||
// show thw tabs again
|
||||
const showTabs = () => {
|
||||
document.querySelector('#navi').style.display = 'block'
|
||||
}
|
||||
|
||||
// main function:
|
||||
// show the map if calle w/o any parameter
|
||||
// if called with a sensor-ID, show the live chart for this sensor
|
||||
async function main() {
|
||||
// initialise tabs
|
||||
let triggerTabList = [].slice.call(document.querySelectorAll('.nav-link'))
|
||||
@@ -59,29 +69,13 @@ import * as chart_lden from './chart_lden.js'
|
||||
tabTrigger.show()
|
||||
for(let x of tabtable) {
|
||||
if (x.id === event.currentTarget.id) {
|
||||
x.func(params)
|
||||
x.func(params, x.type, x.container)
|
||||
}
|
||||
}
|
||||
logit(`tab chaned to ${event.currentTarget.id}`)
|
||||
})
|
||||
})
|
||||
|
||||
// var triggerEl = document.querySelector('#tablist a[href="#profile"]')
|
||||
// bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name
|
||||
//
|
||||
// var triggerFirstTabEl = document.querySelector('#tablist li:first-child a')
|
||||
// bootstrap.Tab.getInstance(triggerFirstTabEl).show() // Select first tab
|
||||
|
||||
|
||||
// let nl = document.querySelectorAll('.nav-link')
|
||||
// for (let x of nl) {
|
||||
// x.addEventListener('click', (event) => {
|
||||
// event.preventDefault()
|
||||
// console.log(event)
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
dt.showDate(true)
|
||||
// and show date/time every minute
|
||||
setInterval(() => dt.showDate(false), 1000)
|
||||
|
||||
Reference in New Issue
Block a user