added current location button, click on marker adds infos, comments and clickable like button

This commit is contained in:
Marlon Portmann committed 2022-10-27 17:33:19 +02:00
1 parent 49ba7be5ee
commit a3a6cbe329
9 files changed
+129 -14

No files matched your search

+48 -6
View File
@@ -33,24 +33,66 @@ function ideeAnzeigen(data) {
let titelErstellen = document.createElement("h1");
let titelInhalt = document.createTextNode(data.titel);
titelErstellen.appendChild(titelInhalt);
titelErstellen.classList.add("loeschen")
titelErstellen.classList.add("loeschen");
document.getElementById('idee').appendChild(titelErstellen);
let inhaltErstellen = document.createElement("p");
let inhaltInhalt = document.createTextNode(data.inhalt);
inhaltErstellen.appendChild(inhaltInhalt);
inhaltErstellen.classList.add("loeschen")
inhaltErstellen.classList.add("loeschen");
document.getElementById('idee').appendChild(inhaltErstellen);
let likesErstellen = document.createElement("p");
let likes = document.createTextNode(data.likes + " Likes");
likesErstellen.appendChild(likes);
likesErstellen.classList.add("loeschen")
likesErstellen.classList.add("loeschen");
document.getElementById('idee').appendChild(likesErstellen);
let bild = document.createElement("img");
bild.src = "https://upload.wikimedia.org/wikipedia/commons/f/f9/Phoenicopterus_ruber_in_S%C3%A3o_Paulo_Zoo.jpg";
bild.classList.add("ideeBilder")
bild.classList.add("loeschen")
bild.src = data.bild;
bild.classList.add("ideeBilder");
bild.classList.add("loeschen");
document.getElementById('idee').appendChild(bild);
console.log(data);
let herz = document.createElement("img");
herz.src= "../images/herz-0.png";
herz.classList.add("herz");
herz.classList.add("loeschen");
document.getElementById('idee').appendChild(herz);
herz.addEventListener('click', function() {
herz.src= "../images/herz-1.png";
});
}
function kommentareAnzeigen(kommentarId){
let url = "system/alleKommentareHolen.php";
fetch(url)
.then((response) => {
return response.json();
})
.then((data) => {
let k = document.createElement("h3");
let k_text = document.createTextNode("Kommentare:");
k.appendChild(k_text);
k.classList.add("loeschen")
document.getElementById('idee').appendChild(k);
let kommentarErstellen = document.createElement("p");
let kommentar = document.createTextNode(data[kommentarId].k_text);
kommentarErstellen.appendChild(kommentar);
kommentarErstellen.classList.add("loeschen");
document.getElementById('idee').appendChild(kommentarErstellen);
})
.catch(function(error) {
console.log('Error!: ' + error.message);
});
}