This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
web/js/index.js

27 lines
697 B
JavaScript
Raw Normal View History

2023-02-09 20:29:07 +00:00
// Init:
2023-05-01 21:04:19 +01:00
pageInit()
versionDisplay()
2023-02-09 20:29:07 +00:00
2023-05-01 21:04:19 +01:00
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js')
2023-02-09 20:29:07 +00:00
}
async function pageInit() {
2023-05-01 21:04:19 +01:00
await loadQuickLinks()
hideLoading() // From lib.main
2023-02-09 20:29:07 +00:00
}
async function gotoBoard(station){
2023-05-01 21:04:19 +01:00
vibe('ok')
window.location.assign(`${window.location.origin}/board.html?stn=${station}`)
2023-02-09 20:29:07 +00:00
}
async function loadQuickLinks(){
2023-05-01 21:04:19 +01:00
var data = await getQuickLinks() // From lib.main
var buttons = ''
for(var i = 0; i < data.length; i++) {
buttons += `
2023-02-09 20:29:07 +00:00
<button class="actionbutton" onclick="gotoBoard('${data[i]}')">${data[i].toUpperCase()}</button>`
2023-05-01 21:04:19 +01:00
}
document.getElementById('quick_links').insertAdjacentHTML('beforeend', buttons)
2023-02-09 20:29:07 +00:00
}