aboutsummaryrefslogtreecommitdiff
path: root/index.sh
blob: a85581c2d38251154fef9ed87548fb9d73c77620 (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
# Generate index.md file

echo '# Julian Noter'
echo

echo 'Or just use your [browser build in file explorer](.)'
echo

cat << EOF
<input type="text" id="search" onkeyup="filter(event)" placeholder="Search">

EOF

# Make toc
HTML_FILES=$@

for url in $HTML_FILES; do
	echo "- [$url]($url)"
done

cat << EOF

<script>
function filter(e) {
	var li = document.getElementsByTagName('li');


	var input = document.getElementById('search');
	var filter = input.value.toUpperCase();

	for (i = 0; i < li.length; i++) {
		var a = li[i].getElementsByTagName("a")[0];
		txtValue = a.textContent || a.innerText;
		if (txtValue.toUpperCase().indexOf(filter) > -1) {
			li[i].style.display = "";
			if( e.key == "Enter") {
				window.location.href = a.href;
				return;
			}
		} else {
			li[i].style.display = "none";
		}
	}
}

</script>
EOF