2022-01-19 09:55:30 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Annotations</title>
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
background: darkgray;
|
|
|
|
}
|
|
|
|
|
|
|
|
ul {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
li {
|
|
|
|
display: inline-block;
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
img {
|
|
|
|
/* width: 400px; */
|
|
|
|
background: white;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
{% for tag in index.tags %}
|
|
|
|
<h2>{{tag}}</h2>
|
|
|
|
<ul>
|
|
|
|
{% for annotation in index.tags[tag] %}
|
|
|
|
<li><img src="/annotation/{{ annotation.id }}.svg" data-audio="/annotation/{{ annotation.id }}.mp3"></li>
|
|
|
|
{% end %}
|
|
|
|
</ul>
|
|
|
|
{% end %}
|
|
|
|
<!-- <ul>
|
|
|
|
{% for annotation in index.annotations %}
|
|
|
|
<li>{{ annotation }}</li>
|
|
|
|
{% end %}
|
|
|
|
</ul> -->
|
2022-01-19 10:15:55 +00:00
|
|
|
|
|
|
|
<hr>
|
|
|
|
<a href="?refresh">Reload index</a>
|
2022-01-19 09:55:30 +00:00
|
|
|
</body>
|
|
|
|
<script>
|
|
|
|
let images = document.querySelectorAll('[data-audio]');
|
|
|
|
for (const image of images) {
|
|
|
|
const audio = new Audio(image.dataset.audio);
|
|
|
|
console.log(image, audio);
|
|
|
|
image.addEventListener('mouseover', (e) => {
|
|
|
|
audio.play();
|
|
|
|
});
|
|
|
|
image.addEventListener('mouseout', (e) => {
|
|
|
|
audio.pause();
|
|
|
|
audio.currentTime = 0;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</html>
|