Show annotations in the frontend
This commit is contained in:
parent
acb2695db0
commit
e40ca5dca9
@ -15,16 +15,14 @@ document.querySelectorAll("#lyrics a").forEach(item => {
|
|||||||
function getAnnotation(e) {
|
function getAnnotation(e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const uri = e.target.parentElement.getAttribute("href")
|
const uri = e.target.parentElement.getAttribute("href")
|
||||||
console.log("Annotations are not yet implemented!", uri)
|
|
||||||
|
|
||||||
xhr = new XMLHttpRequest()
|
xhr = new XMLHttpRequest()
|
||||||
xhr.open("GET", uri + "/annotations")
|
xhr.open("GET", uri + "/annotations")
|
||||||
xhr.send()
|
xhr.send()
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
json = JSON.parse(this.responseText)
|
const parsedReponse = JSON.parse(this.responseText)
|
||||||
alert(json.html)
|
document.getElementById("annotations").innerHTML = parsedReponse.html
|
||||||
// TODO: display annotations properly
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,13 +147,17 @@ a {
|
|||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#about p {
|
#about p, #annotations p, #annotations h2 {
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
color: #171717;
|
color: #171717;
|
||||||
line-height: 1.8rem;
|
line-height: 1.8rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#annotations blockquote {
|
||||||
|
background-color: #272d44;
|
||||||
|
}
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -348,10 +352,16 @@ footer a:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#about p,
|
#about p,
|
||||||
|
#annotations p,
|
||||||
|
#annotations h2,
|
||||||
#credits summary {
|
#credits summary {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#annotations blockquote {
|
||||||
|
background-color: #272d44;
|
||||||
|
}
|
||||||
|
|
||||||
#home h1, #error h1 {
|
#home h1, #error h1 {
|
||||||
color: #eee;
|
color: #eee;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="lyrics">{{.Lyrics}}</div>
|
<div id="lyrics">{{.Lyrics}}</div>
|
||||||
<div id="info">
|
<div id="info">
|
||||||
|
<div id="annotations">
|
||||||
|
</div>
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<h1 id="title">About</h1>
|
<h1 id="title">About</h1>
|
||||||
<p class="hidden" id="full_about">{{index .About 0}}</p>
|
<p class="hidden" id="full_about">{{index .About 0}}</p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user