Show annotations in the frontend
This commit is contained in:
@ -15,16 +15,14 @@ document.querySelectorAll("#lyrics a").forEach(item => {
|
||||
function getAnnotation(e) {
|
||||
e.preventDefault()
|
||||
const uri = e.target.parentElement.getAttribute("href")
|
||||
console.log("Annotations are not yet implemented!", uri)
|
||||
|
||||
xhr = new XMLHttpRequest()
|
||||
xhr.open("GET", uri + "/annotations")
|
||||
xhr.send()
|
||||
xhr.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
json = JSON.parse(this.responseText)
|
||||
alert(json.html)
|
||||
// TODO: display annotations properly
|
||||
const parsedReponse = JSON.parse(this.responseText)
|
||||
document.getElementById("annotations").innerHTML = parsedReponse.html
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user