Compare commits
1 Commits
aef2a1ae60
...
1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
e7b8993446
|
@ -12,7 +12,7 @@
|
|||||||
'arrival': 'I have read and will adhere to the <a href="/guidelines" target="_blank">protection guidelines</a>',
|
'arrival': 'I have read and will adhere to the <a href="/guidelines" target="_blank">protection guidelines</a>',
|
||||||
'departure': 'I have cleaned my workspace'
|
'departure': 'I have cleaned my workspace'
|
||||||
}
|
}
|
||||||
var testCheckBox = '<label class="checkbox"><input type="checkbox" name="tested" id="tested"><span>I fullfill one of the <a href="https://www.bundesregierung.de/breg-de/aktuelles/bund-laender-beratung-corona-1949606">3G requirements</a></span></label>'
|
var testCheckBox = '<label class="checkbox"><input type="checkbox" name="tested" id="tested"><span>I have been tested negative for COVID in the last 24 hours</span></label>'
|
||||||
var editTimeBox = '<label>Departure Date/Time:<input type="datetime-local" name="datetime" id="datetime" required></label>'
|
var editTimeBox = '<label>Departure Date/Time:<input type="datetime-local" name="datetime" id="datetime" required></label>'
|
||||||
function getParams() {
|
function getParams() {
|
||||||
var qparams = document.location.search.substr(1)
|
var qparams = document.location.search.substr(1)
|
||||||
@ -33,13 +33,15 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1><script>
|
<h1><script>
|
||||||
document.write(qp.action ? (qp.action + "<br>Room " + qp.room) : 'FTracker<br>V1.1')
|
document.write(qp.action ? (qp.action + "<br>Room " + qp.room) : 'FTracker<br>V1')
|
||||||
</script></h1>
|
</script></h1>
|
||||||
<div id="startpage">
|
<div id="startpage">
|
||||||
This is a web app to track which people were in the same rooms at
|
This is a web app to track which people
|
||||||
which times in order to backtrace potential viral infections.<br><br>
|
were in the same rooms at which times in order to backtrace
|
||||||
If you've reached this page that either means your're testing
|
potential viral infections.<br><br>
|
||||||
things or something has gone quite wrong with the URL.<br>
|
If you've reached this page that either means your're
|
||||||
|
testing things or something has gone quite wrong with the\
|
||||||
|
URL.<br>
|
||||||
In the former case: Yay it works! In the latter you should
|
In the former case: Yay it works! In the latter you should
|
||||||
probably contact an admin or a dev nearby :(<br><br>
|
probably contact an admin or a dev nearby :(<br><br>
|
||||||
Here are a few links for testing:<br>
|
Here are a few links for testing:<br>
|
||||||
|
|||||||
17
web/main.js
17
web/main.js
@ -6,17 +6,10 @@ if (qp.action) {
|
|||||||
mform.style.display = 'block'
|
mform.style.display = 'block'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the name field if it was successfully entered before
|
// Prefill the name field if it was successfully entered before
|
||||||
var savedName = localStorage.getItem('name')
|
var savedName = localStorage.getItem('name')
|
||||||
if (qp && qp.name) {
|
if (savedName && qp)
|
||||||
// Forced Admin checkout - prefill qp name and auto-agree
|
|
||||||
document.getElementById('name').value = qp.name.replace(/-/g, ' ').toUpperCase();
|
|
||||||
document.getElementById('agree').checked = true
|
|
||||||
document.getElementById('agree').parentElement.style.display = 'none'
|
|
||||||
} else if (savedName && qp) {
|
|
||||||
// Prefill the client's locally saved name
|
|
||||||
document.getElementById('name').value = savedName
|
document.getElementById('name').value = savedName
|
||||||
}
|
|
||||||
|
|
||||||
// 2nd script, server API communication
|
// 2nd script, server API communication
|
||||||
var name, datetime, agreed, tested
|
var name, datetime, agreed, tested
|
||||||
@ -50,7 +43,7 @@ function sendMainData() {
|
|||||||
'name': name,
|
'name': name,
|
||||||
'arrival': datetime,
|
'arrival': datetime,
|
||||||
'agreetoguidelines': agreed,
|
'agreetoguidelines': agreed,
|
||||||
'tested': tested // = 3G
|
'tested': tested
|
||||||
} :
|
} :
|
||||||
{
|
{
|
||||||
'name': name,
|
'name': name,
|
||||||
@ -111,7 +104,7 @@ function handleRequestSubmit(e, json) {
|
|||||||
var iso = new Date(input).toISOString()
|
var iso = new Date(input).toISOString()
|
||||||
|
|
||||||
if (e.srcElement.length > 1)
|
if (e.srcElement.length > 1)
|
||||||
tested = e.srcElement[1].checked // = 3G
|
tested = e.srcElement[1].checked
|
||||||
|
|
||||||
// POST JSON. See docs/API.md
|
// POST JSON. See docs/API.md
|
||||||
var payload = (json.request == 'arrival') ?
|
var payload = (json.request == 'arrival') ?
|
||||||
@ -120,7 +113,7 @@ function handleRequestSubmit(e, json) {
|
|||||||
'name': name,
|
'name': name,
|
||||||
'arrival': iso,
|
'arrival': iso,
|
||||||
'agreetoguidelines': agreed,
|
'agreetoguidelines': agreed,
|
||||||
'tested': tested // = 3G
|
'tested': tested
|
||||||
} :
|
} :
|
||||||
{
|
{
|
||||||
'name': name,
|
'name': name,
|
||||||
|
|||||||
@ -67,15 +67,9 @@ main > section.times, #timeheader {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
-webkit-text-stroke: .4px #c50e1f;
|
-webkit-text-stroke: .4px #c50e1f;
|
||||||
}
|
}
|
||||||
.times span.tested { /* = 3G */
|
|
||||||
background: rgb(0,136,0);
|
|
||||||
}
|
|
||||||
.times span.implausible {
|
.times span.implausible {
|
||||||
background: linear-gradient(to right, #c50e1f, rgba(197,14,31,0.2) 1000px);
|
background: linear-gradient(to right, #c50e1f, rgba(197,14,31,0.2) 1000px);
|
||||||
}
|
}
|
||||||
.times span.implausible.tested { /* = 3G */
|
|
||||||
background: linear-gradient(to right, rgb(0,136,0), rgba(0,136,0,0.2) 1000px);
|
|
||||||
}
|
|
||||||
.viewheader.row {
|
.viewheader.row {
|
||||||
height: 30px;
|
height: 30px;
|
||||||
background: #ddd !important;
|
background: #ddd !important;
|
||||||
|
|||||||
15
web/view.js
15
web/view.js
@ -88,14 +88,6 @@ function exportCSV() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function offerUserCheckout(event) {
|
|
||||||
|
|
||||||
var name = event.target.getAttribute('data-name')
|
|
||||||
var room = event.target.textContent
|
|
||||||
window.open(`/?departure=${room}&edittime=1&name=${name}`, '_blank').focus();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderData() {
|
function renderData() {
|
||||||
|
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
@ -171,13 +163,10 @@ function renderData() {
|
|||||||
block.style.left = arr + 'px' // 1px/min
|
block.style.left = arr + 'px' // 1px/min
|
||||||
block.style.width = Math.max(0,(dur-14)) + 'px' // 1px/min
|
block.style.width = Math.max(0,(dur-14)) + 'px' // 1px/min
|
||||||
if (entry.tested)
|
if (entry.tested)
|
||||||
block.classList.add('tested') // = 3G
|
block.style.background = '#080'
|
||||||
|
|
||||||
if (dur > 60 * 24) {
|
if (dur > 60 * 24)
|
||||||
block.classList.add('implausible')
|
block.classList.add('implausible')
|
||||||
block.setAttribute('data-name', name)
|
|
||||||
block.addEventListener('click', offerUserCheckout);
|
|
||||||
}
|
|
||||||
|
|
||||||
row.appendChild(block)
|
row.appendChild(block)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user