blob: e4f5104ed10fcea1b662318b706f3ff0e3864eff (
plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
<html>
<head>
<title>Noteman</title>
<style>
.box {
padding: 10px;
border: 1px solid black;
}
#name {
width: 300px;
}
td {
padding: 0 15px
}
.help {
display: none;
}
:checked + .help {
display: block;
}
#search-box {
display: none;
}
:checked + #search-box {
display: block;
}
:checked ~ * .filtered {
display: none;
}
:checked + #upload-box {
display: block;
}
#upload-box {
display: none;
}
</style>
</head>
<body>
<div class="box">
<label for="doupload">Vis upload</label>
<input type="checkbox" id="doupload">
<div id="upload-box">
<form method="POST" action="/upload" enctype="multipart/form-data">
<input type="input" name="h">
<input type="file" name="f" accept="image/*,.pdf,.txt,.md" capture>
<input type="submit" value="go">
</form>
</div>
<label for="dohelp">Vis hjælp</label>
<input type="checkbox" id="dohelp">
<div class="help">
<h4>Navn format</h4>
<pre>$DATE:$PATH/$PART</pre>
<table>
<tr>
<td>$DATE:</td>
<td>ISO Dato</td>
</tr>
<tr>
<td>$PATH:</td>
<td>Sti til note</td>
</tr>
<tr>
<td>$PART:</td>
<td>En note kan have flere sider</td>
</tr>
</table><br>
<p>Eksempler:</p>
<pre>2020-09-09:sig/mm1/noter/1
2020-09-09:s5/sig/mm1/noter/2
2020-09-09:s5/sig/mm1/opg/1</pre>
<table>
<tr>
<th>Lokations format</th>
</tr>
<tr>
<td>Papir</td>
<td>P</td>
</tr>
<tr>
<td>Bog</td>
<td>B[id]S[page]</td>
</tr>
<tr>
<td>Noter git repository</td>
<td>G</td>
</tr>
</table><br><br>
</div>
<form method="POST">
<label for="name">Name</label>
<input id="name" name="name" type="text">
<label for="location">Location</label>
<input id="location" name="location" type="text">
<input type="submit" value="go">
</form>
</div><br>
<label for="dosearch">Vis søg</label>
<input type="checkbox" id="dosearch">
<div id="search-box">
<label for="search">Filter: </label>
<input type="input" id="search">
<span id="search-status"></span>
</div><br>
<div class="box">
<table id="notetable">
<tr>
<th>Ref</th>
<th>Navn</th>
</tr>
{{ range .Notes }}
<tr>
<td style="font-family: monospace;">#{{ .Hash }}/{{ .Location }}</td>
<td>{{ .Name }}</td>
</tr>
{{ end }}
</table>
</div>
<script>
function inputchange() {
let value = this.value;
let table = document.getElementById("notetable");
let rows = table.getElementsByTagName("tr");
let status = document.getElementById("search-status");
status.textContent = "søger";
// Filter table
for (var i = 1; i < rows.length; i++) {
let row = rows[i]
if (!row) {
continue;
}
if (row.textContent.indexOf(value) > -1) {
row.classList.remove("filtered");
} else {
row.classList.add("filtered");
}
}
status.textContent = "done";
}
var e = document.getElementById("search");
e.addEventListener("change", inputchange);
e.addEventListener("keyup", inputchange);
</script>
</body>
</html>
|