/
template.go
58 lines (52 loc) · 2.19 KB
/
template.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
const indexTemplate = `
{{ define "index" }}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RPi IR Remote</title>
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous">
</head>
<body>
<div class="container mt-1">
<div class="col-sm text-center">
<p><b>Fun fact!</b> {{ .FunFact }}</p>
{{ range $remoteName, $remote := .Remotes }}
<p><b>{{ $remoteName }}</b></p>
{{ range $i, $code := $remote.Code }}
<button type="button" class="btn btn-primary" name="{{ $remoteName }}/{{ $code.Name }}" id="button-{{ $remoteName }}-{{ $code.Name }}">{{ $code.Name }}</button>
<br>
<br>
{{ end }}
<br>
<br>
<br>
{{ end }}
</div>
</div>
</body>
<script type="text/javascript">
var buttons = document.getElementsByClassName('btn');
for (var i = 0; i < buttons.length; i++) {
buttons[i].addEventListener('click', event => {
fetch('/' + event.srcElement.getAttribute('name'), {method: 'POST'});
});
}
</script>
</html>
{{ end }}
`
var funFacts = []string{
"The wavelength of infrared radiation ranges from about 700 nm to 1 mm.",
"Infrared cleaning is a technique used by some film scanners and flatbed scanners to reduce or remove the effect of dust and scratches upon the finished scan.",
"The ability to sense infrared thermal radiation evolved independently in two different groups of snakes, Boidae (boas and pythons) and Crotalinae (pit vipers).",
"The discovery of infrared radiation is ascribed to William Herschel in the early 19th century. He called infrared radiation \"calorific rays\".",
"Humans at normal body temperature radiate chiefly at wavelengths around 10 μm.",
"Sunlight is composed of near-thermal-spectrum radiation that is slightly more than half infrared.",
"Infrared reflectography can be applied to paintings to reveal underlying layers in a non-destructive manner, in particular the underdrawing or outline drawn by the artist as a guide.",
}