Präsentations Version
This commit is contained in:
1 parent
2a3c708291
commit
d7343e8cb7
35 files changed
+911
-161
No files matched your search
+162
-68
@@ -7,27 +7,53 @@
|
||||
let localLikes = {}
|
||||
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
// We execute the same script as before
|
||||
let vh = window.innerHeight * 0.01;
|
||||
document.documentElement.style.setProperty('--vh', `${vh}px`);
|
||||
});
|
||||
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("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')){
|
||||
@@ -61,13 +87,41 @@ $(document).ready(function(){
|
||||
})
|
||||
|
||||
|
||||
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() {
|
||||
document.getElementById("overlay_container").innerHTML = "";
|
||||
$("#overlay").removeClass("show").addClass("hidden")
|
||||
$("#currentLocation").removeClass("hideButton")
|
||||
setTimeout(() => {
|
||||
document.getElementById("overlay_container").innerHTML = "";
|
||||
|
||||
}, 300);
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
@@ -119,36 +173,44 @@ function chageLocalStorrage(typ, id, addRemove){
|
||||
function ideeAnzeigen(data) {
|
||||
|
||||
document.getElementById("overlay_container").innerHTML = "";
|
||||
document.querySelectorAll('.loeschen').forEach(e => e.remove());
|
||||
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 titelErstellen = document.createElement("h1");
|
||||
let titelInhalt = document.createTextNode(data.titel);
|
||||
titelErstellen.appendChild(titelInhalt);
|
||||
titelErstellen.classList.add("loeschen");
|
||||
document.getElementById('overlay_container').appendChild(titelErstellen);
|
||||
titelErstellen.classList.add("ideeTitel");
|
||||
|
||||
|
||||
let inhaltErstellen = document.createElement("p");
|
||||
let inhaltInhalt = document.createTextNode(data.inhalt);
|
||||
inhaltErstellen.appendChild(inhaltInhalt);
|
||||
inhaltErstellen.classList.add("loeschen");
|
||||
document.getElementById('overlay_container').appendChild(inhaltErstellen);
|
||||
inhaltErstellen.classList.add("ideeInhalt");
|
||||
|
||||
|
||||
let likesErstellen = document.createElement("p");
|
||||
let likes = document.createTextNode(data.likes + " Likes");
|
||||
likesErstellen.appendChild(likes);
|
||||
likesErstellen.classList.add("likeDisplay");
|
||||
document.getElementById('overlay_container').appendChild(likesErstellen);
|
||||
|
||||
if(data.bild != null && data.bild != undefined){
|
||||
|
||||
if(data.bild != null && data.bild != ""){
|
||||
let bildContainer = $("<div>").addClass("ImgContainer");
|
||||
let imgUrlArr = JSON.parse(data.bild);
|
||||
for (let i = 0; i < imgUrlArr.length; i++) {
|
||||
let img = $("<img>").addClass("previewImage");
|
||||
img.attr("src", imgUrlArr[i]);
|
||||
img.appendTo(bildContainer);
|
||||
//let img = $("<img>").addClass("previewImage");
|
||||
//img.attr("src", imgUrlArr[i]);
|
||||
//img.appendTo(bildContainer);
|
||||
bildContainer.css("background-image","url(" + imgUrlArr[i] + ")")
|
||||
|
||||
}
|
||||
|
||||
bildContainer.prependTo($("#overlay_container"))
|
||||
} else {
|
||||
inhaltContainer.classList.add("class","topMargin")
|
||||
}
|
||||
|
||||
|
||||
@@ -171,27 +233,33 @@ function ideeAnzeigen(data) {
|
||||
//check if user has liked Idea before,load proper image and set class
|
||||
|
||||
if(localLikes.ideen.includes(data.id)){
|
||||
ideeLike.src= "../images/herz-1.png";
|
||||
ideeLike.src= "../images/herz-1.svg";
|
||||
ideeLike.classList.add("liked");
|
||||
}else{
|
||||
ideeLike.src= "../images/herz-0.png";
|
||||
ideeLike.src= "../images/herz-0.svg";
|
||||
ideeLike.classList.add("unliked");
|
||||
}
|
||||
|
||||
document.getElementById('overlay_container').appendChild(ideeLike);
|
||||
document.getElementById('overlay_container').appendChild(inhaltContainer);
|
||||
document.getElementById('inhaltContainer').appendChild(likesErstellen);
|
||||
document.getElementById('inhaltContainer').appendChild(ideeLike);
|
||||
document.getElementById('inhaltContainer').appendChild(titelErstellen);
|
||||
document.getElementById('inhaltContainer').appendChild(inhaltErstellen);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ideeLike.addEventListener('click', function() {
|
||||
|
||||
if(localLikes.ideen.includes(data.id)){
|
||||
ideeLike.src= "../images/herz-0.png";
|
||||
ideeLike.src= "../images/herz-0.svg";
|
||||
ideeLike.classList.add("unliked");
|
||||
ideeLike.classList.remove("liked");
|
||||
removeLike("idee", data.id)
|
||||
}else{
|
||||
|
||||
ideeLike.src= "../images/herz-1.png";
|
||||
ideeLike.src= "../images/herz-1.svg";
|
||||
ideeLike.classList.add("liked");
|
||||
ideeLike.classList.remove("unliked");
|
||||
addLike("idee", data.id)
|
||||
@@ -204,7 +272,7 @@ function ideeAnzeigen(data) {
|
||||
|
||||
let kommentare_container = document.createElement("div")
|
||||
kommentare_container.setAttribute("id", "kommentare_container");
|
||||
document.getElementById('overlay_container').appendChild(kommentare_container);
|
||||
document.getElementById('inhaltContainer').appendChild(kommentare_container);
|
||||
|
||||
|
||||
|
||||
@@ -230,7 +298,7 @@ function addLike(typ, id, element){
|
||||
|
||||
//neue Likes anzeigen
|
||||
|
||||
$("p.likeDisplay").html(response + " Likes")
|
||||
$("p.likeDisplay").html("Gefällt " + response + " Mal")
|
||||
|
||||
});
|
||||
|
||||
@@ -244,7 +312,7 @@ function addLike(typ, id, element){
|
||||
$.post('system/addLike.php/?typ=kommentar&id=' + id, {}).done(function(response){
|
||||
|
||||
|
||||
element.prev().html(response + " Likes")
|
||||
element.parent().prev().children().first().html("Gefällt " + response + " Mal")
|
||||
|
||||
|
||||
});
|
||||
@@ -263,7 +331,7 @@ function removeLike(typ, id, element){
|
||||
$.post('system/removeLike.php/?typ=idee&id=' + id, {}).done(function(response){
|
||||
|
||||
|
||||
$("p.likeDisplay").html(response + " Likes")
|
||||
$("p.likeDisplay").html("Gefällt " + response + " Mal")
|
||||
|
||||
|
||||
});
|
||||
@@ -274,7 +342,7 @@ function removeLike(typ, id, element){
|
||||
$.post('system/removeLike.php/?typ=kommentar&id=' + id, {}).done(function(response){
|
||||
|
||||
|
||||
element.prev().html(response + " Likes")
|
||||
element.parent().prev().children().first().html("Gefällt " + response + " Mal")
|
||||
|
||||
|
||||
});
|
||||
@@ -297,35 +365,37 @@ function kommentarErstellen(idee_id) {
|
||||
|
||||
|
||||
let formular = document.createElement("form");
|
||||
formular.classList.add("formular");
|
||||
formular.classList.add("kommentarFormular");
|
||||
formular.setAttribute("action", "../system/kommentarSpeichern.php");
|
||||
formular.setAttribute("method", "post");
|
||||
formular.setAttribute("id", "kommentarform");
|
||||
document.getElementById("overlay_container").appendChild(formular);
|
||||
document.getElementById("inhaltContainer").appendChild(formular);
|
||||
|
||||
let text_label = document.createElement("label");
|
||||
text_label.setAttribute("for", "text");
|
||||
|
||||
let text_input = document.createElement("input");
|
||||
|
||||
let text_input = document.createElement("textarea");
|
||||
text_input.classList.add("kommentarText");
|
||||
text_input.setAttribute("rows", "3");
|
||||
text_input.setAttribute("type", "text");
|
||||
text_input.setAttribute("name", "text")
|
||||
text_input.setAttribute("placeholder", "Schreibe einen Kommentar...");
|
||||
text_input.setAttribute("name", "text");
|
||||
|
||||
let submit_input = document.createElement("input");
|
||||
submit_input.classList.add("kommentarSubmit");
|
||||
submit_input.setAttribute("type", "submit");
|
||||
submit_input.setAttribute("value", "Kommentar posten");
|
||||
submit_input.setAttribute("value", "");
|
||||
|
||||
let id = document.createElement("input");
|
||||
id.setAttribute("type", "hidden");
|
||||
id.setAttribute("name", "idee_id")
|
||||
id.value = idee_id;
|
||||
|
||||
document.getElementById("kommentarform").appendChild(text_label);
|
||||
|
||||
document.getElementById("kommentarform").appendChild(text_input);
|
||||
document.getElementById("kommentarform").appendChild(submit_input);
|
||||
document.getElementById("kommentarform").appendChild(id);
|
||||
|
||||
$("#kommentarform").submit(function(e){
|
||||
|
||||
|
||||
let form = $(this);
|
||||
|
||||
$.ajax({
|
||||
@@ -333,7 +403,10 @@ function kommentarErstellen(idee_id) {
|
||||
url: "/system/kommentarSpeichern.php",
|
||||
data: form.serialize(),
|
||||
})
|
||||
|
||||
|
||||
e.preventDefault();
|
||||
$("textarea.kommentarText").val("")
|
||||
document.getElementById("kommentare_container").innerHTML = "";
|
||||
|
||||
kommentareAnzeigen(idee_id);
|
||||
@@ -369,36 +442,43 @@ function formularErstellen(koordianten) {
|
||||
|
||||
let titel_input = document.createElement("input");
|
||||
titel_input.setAttribute("type", "text");
|
||||
titel_input.setAttribute("id", "deineIdee");
|
||||
titel_input.classList.add("titel");
|
||||
titel_input.setAttribute("name", "titel");
|
||||
titel_input.setAttribute("placeholder", "titel");
|
||||
titel_input.setAttribute("placeholder", "TITEL");
|
||||
|
||||
|
||||
|
||||
|
||||
let text_input = document.createElement("input");
|
||||
text_input.setAttribute("type", "textarea");
|
||||
text_input.setAttribute("name", "text");
|
||||
text_input.setAttribute("placeholder", "Deine Idee...");
|
||||
let text_input = $("<textarea>");
|
||||
text_input.attr("rows", "10");
|
||||
text_input.attr("name", "text");
|
||||
text_input.attr("placeholder", "Deine Idee...");
|
||||
|
||||
let image_links = document.createElement("input");
|
||||
image_links.setAttribute("type", "hidden");
|
||||
image_links.setAttribute("name", "bilder");
|
||||
|
||||
let submit_input = document.createElement("input");
|
||||
let submit_input = document.createElement("button");
|
||||
submit_input.setAttribute("type", "submit");
|
||||
submit_input.setAttribute("value", "Formular Absenden");
|
||||
submit_input.classList.add("submit");
|
||||
|
||||
let textAndImage = $("<div>").addClass("textAndImage")
|
||||
|
||||
|
||||
|
||||
document.getElementById("form").appendChild(titel_input);
|
||||
document.getElementById("form").appendChild(text_input);
|
||||
textAndImage.appendTo("#form");
|
||||
text_input.appendTo(textAndImage);
|
||||
|
||||
|
||||
document.getElementById("form").appendChild(submit_input);
|
||||
document.getElementById("form").appendChild(koordinaten_lat);
|
||||
document.getElementById("form").appendChild(koordinaten_lng);
|
||||
document.getElementById("form").appendChild(image_links);
|
||||
|
||||
let imageUpload = $('<div class="image-preview" id="image-upload">')
|
||||
imageUpload.html('<input type="hidden" role="uploadcare-uploader" data-public-key="3a3c37e85850c6cfe077" data-multiple="false" data-images-only data-public- data-clearable data-tabs="file camera" data-image-shrink: "1024x1024" data-system-dialog="true"/>')
|
||||
imageUpload.appendTo("#overlay_container");
|
||||
imageUpload.html('<input type="hidden" role="uploadcare-uploader" data-public-key="3a3c37e85850c6cfe077" data-multiple="false" data-images-only data-public- data-clearable data-tabs="file camera" data-image-shrink: "1024x1024" data-system-dialog="true"/>')
|
||||
|
||||
imageUpload.appendTo(textAndImage);
|
||||
|
||||
|
||||
|
||||
@@ -429,17 +509,27 @@ function formularErstellen(koordianten) {
|
||||
image_links.value = linkArrString;
|
||||
console.log(image_links.value);
|
||||
|
||||
$(".uploadcare--widget__button_type_remove").click(() => {
|
||||
console.log("delete");
|
||||
$("div.ImgPrevContainer").remove()
|
||||
image_links.value = "";
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
console.log($(".uploadcare--widget__button_type_open needsclick"));
|
||||
$(".uploadcare--widget__button_type_open needsclick").addClass("test")
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
function createImgPrev(imgURL){
|
||||
|
||||
let prevImg = $("<img>").addClass("prevIMG");
|
||||
prevImg.attr('src', imgURL);
|
||||
prevImg.appendTo($("div.ImgPrevContainer"));
|
||||
//let prevImg = $("<img>").addClass("prevIMG");
|
||||
//prevImg.attr('src', imgURL);
|
||||
//prevImg.appendTo($("div.ImgPrevContainer"));
|
||||
$("div.ImgPrevContainer").css('background-image', 'url(' + imgURL + ')');
|
||||
}
|
||||
|
||||
|
||||
@@ -449,10 +539,7 @@ function kommentareAnzeigen(idee_id){
|
||||
|
||||
$.post("./system/alleKommentareHolen.php/?id=" + idee_id, {}).done(function(comments){
|
||||
|
||||
let k = document.createElement("h3");
|
||||
let k_text = document.createTextNode("Kommentare:");
|
||||
k.appendChild(k_text);
|
||||
document.getElementById('kommentare_container').appendChild(k);
|
||||
|
||||
|
||||
|
||||
let commentArray = JSON.parse(comments);
|
||||
@@ -465,27 +552,34 @@ function kommentareAnzeigen(idee_id){
|
||||
|
||||
|
||||
let kommentarContainer = $("<div>").addClass("comment");
|
||||
let kommentarLinks = $("<div>").addClass("commentLeft")
|
||||
let kommentarRechts = $("<div>").addClass("commentRight")
|
||||
|
||||
|
||||
|
||||
|
||||
let kommentarLikeNumber = $("<p>").text("Gefällt " + thisComment.k_likes + " Mal").addClass("commentLikeNumber");
|
||||
kommentarLikeNumber.appendTo(kommentarLinks);
|
||||
|
||||
let kommentarText = $("<p>").addClass("commentText");
|
||||
kommentarText.text(thisComment.k_text);
|
||||
kommentarText.appendTo(kommentarContainer);
|
||||
|
||||
let kommentarLikeNumber = $("<p>").text(thisComment.k_likes + " Likes").addClass("commentLikeNumber");
|
||||
kommentarLikeNumber.appendTo(kommentarContainer);
|
||||
kommentarText.appendTo(kommentarLinks);
|
||||
|
||||
let kommentarLikeButton = $("<img>").addClass("unliked commentLike")
|
||||
|
||||
|
||||
if(localLikes.kommentare.includes(thisComment.k_id)){
|
||||
kommentarLikeButton.attr("src", "../images/herz-1.png");
|
||||
kommentarLikeButton.attr("src", "../images/herz-1.svg");
|
||||
kommentarLikeButton.addClass("liked");
|
||||
}else{
|
||||
kommentarLikeButton.attr("src", "../images/herz-0.png");
|
||||
kommentarLikeButton.attr("src", "../images/herz-0.svg");
|
||||
kommentarLikeButton.addClass("unliked");
|
||||
}
|
||||
|
||||
kommentarLikeButton.appendTo(kommentarContainer);
|
||||
kommentarLikeButton.appendTo(kommentarRechts);
|
||||
|
||||
kommentarLinks.appendTo(kommentarContainer)
|
||||
kommentarRechts.appendTo(kommentarContainer)
|
||||
|
||||
kommentarContainer.appendTo($("#kommentare_container"));
|
||||
|
||||
@@ -495,13 +589,13 @@ function kommentareAnzeigen(idee_id){
|
||||
kommentarLikeButton.click( function() {
|
||||
|
||||
if(localLikes.kommentare.includes(thisComment.k_id)){
|
||||
kommentarLikeButton.attr("src", "../images/herz-0.png");
|
||||
kommentarLikeButton.attr("src", "../images/herz-0.svg");
|
||||
kommentarLikeButton.addClass("unliked");
|
||||
kommentarLikeButton.removeClass("liked");
|
||||
removeLike("kommentar", thisComment.k_id, $(this))
|
||||
}else{
|
||||
|
||||
kommentarLikeButton.attr("src", "../images/herz-1.png");
|
||||
kommentarLikeButton.attr("src", "../images/herz-1.svg");
|
||||
kommentarLikeButton.addClass("liked");
|
||||
kommentarLikeButton.removeClass("unliked");
|
||||
addLike("kommentar", thisComment.k_id, $(this))
|
||||
|
||||
Reference in new issue
Block a user