//LocalLike Objekt erstellen let localLikes = {} UPLOADCARE_LOCALE_TRANSLATIONS = { buttons: { cancel: '', remove: '', choose: { files: { one: '', other: '' }, images: { one: '', other: '' } } } }; $(document).ready(function(){ window.scrollTo(0,1) // submit kommentar nicht seite neu laden $("#kommentarform").submit(function(e) { console.log("Comment Submitted") e.preventDefault(); // avoid to execute the actual submit of the form. }); if(!localStorage.getItem('firstVisit')){ console.log("loadStartscreen"); localStorage.setItem('firstVisit', 'false'); loadStartScreen(); } else { console.log("not load Startscreen "); $(".mapControls").removeClass("hideElement") $("#logo").removeClass("hideElement") } //LocalStorage erstellen oder auslesen if(localStorage.getItem('localLikes')){ //likes auslesen localLikes = JSON.parse(localStorage.getItem('localLikes')) console.log("Stored local Likes:") console.log(localLikes) }else{ //LocalLikes leer localLikes = { ideen: [], kommentare: [] } console.log("New Local Likes created") console.log(localLikes) localStorage.setItem('localLikes',JSON.stringify(localLikes)); } }) function loadStartScreen(){ $("#startScreen").removeClass("hideElement") $('#startScreen').click(() => { $(".mapControls").removeClass("hideElement") $("#logo").removeClass("hideElement") $("#startScreen").addClass("hideElement") }) setTimeout(() => { $(".mapControls").removeClass("hideElement") $("#logo").removeClass("hideElement") $("#startScreen").addClass("hideElement") }, 10000); //onclick //$(".mapControls").removeClass("hideElement") //$("#logo").removeClass("hideElement") } function openOverlay(){ $("#overlay").removeClass("hidden").addClass("show") $("#currentLocation").addClass("hideButton") $("#cancel").click(function() { $("#overlay").removeClass("show").addClass("hidden") $("#currentLocation").removeClass("hideButton") setTimeout(() => { document.getElementById("overlay_container").innerHTML = ""; }, 300); }) } //LocalStorage Anpassen (Likes hinzufügen oder entfernen) function chageLocalStorrage(typ, id, addRemove){ if(typ =="idee"){ if(addRemove == "add" && !localLikes.ideen.includes(id)){ localLikes.ideen.push(id); console.log("like added"); console.log(localLikes); }else if(addRemove == "remove" && localLikes.ideen.includes(id)){ let index = localLikes.ideen.indexOf(id); localLikes.ideen.splice(index, 1); console.log("like removed"); console.log(localLikes); } }else if(typ == "kommentar"){ if(addRemove == "add"){ localLikes.kommentare.push(id); }else if(addRemove == "remove"){ let index = localLikes.kommentare.indexOf(id); localLikes.kommentare.splice(index, 1); } } localStorage.setItem('localLikes',JSON.stringify(localLikes)); } // IDEE ANZEIGEN function ideeAnzeigen(data) { document.getElementById("overlay_container").innerHTML = ""; let inhaltContainer = document.createElement("div"); inhaltContainer.setAttribute("id","inhaltContainer") let likesErstellen = document.createElement("p"); let likes = document.createTextNode("Gefällt " + data.likes + " Mal"); likesErstellen.appendChild(likes); likesErstellen.classList.add("likeDisplay"); let titleLocationContainer = document.createElement("div"); titleLocationContainer.classList.add("titleLocationContainer"); let titelErstellen = document.createElement("h1"); let titelInhalt = document.createTextNode(data.titel); titelErstellen.appendChild(titelInhalt); titelErstellen.classList.add("ideeTitel"); let adresseErstellen = document.createElement("p"); let adresseInhalt = document.createTextNode(data.adresse); adresseErstellen.appendChild(adresseInhalt); adresseErstellen.classList.add("ideeAdresse"); let inhaltErstellen = document.createElement("p"); let inhaltInhalt = document.createTextNode(data.inhalt); inhaltErstellen.appendChild(inhaltInhalt); inhaltErstellen.classList.add("ideeInhalt"); if(data.bild != null && data.bild != ""){ let bildContainer = $("