diff --git a/css/style.css b/css/style.css index 1a93781..5900ea4 100644 --- a/css/style.css +++ b/css/style.css @@ -48,6 +48,7 @@ h1 { height: 60px; } +<<<<<<< HEAD p.commentText{ display: inline-block; padding-right: 20px; @@ -61,4 +62,25 @@ p.commentLikeNumber{ img.commentLike{ width: 15px; display: inline-block; -} \ No newline at end of file +} +======= +.image-preview ._list { + padding-top: 20px; +} +.image-preview ._item { + padding: 0 0 10px; + display: inline-block; + text-align: center; + vertical-align: top; + width: 100px; + word-break: break-word; + font-size: 12px; + line-height: normal; +} +.image-preview ._item img { + display: block; + width: 80px; + height: 80px; + padding: 0 10px 6px; +} +>>>>>>> 0e5f580c74883f876fdcee5c7870c58168ae8893 diff --git a/index.php b/index.php index 26161eb..3926fab 100644 --- a/index.php +++ b/index.php @@ -12,6 +12,19 @@ dbVerbindungErzeugen() SPINN MIT! + + + +

spinn mit!!

@@ -26,14 +39,20 @@ dbVerbindungErzeugen()
- +
+ +
+
+ + + diff --git a/js/functions.js b/js/functions.js index 23c58b4..e9a48c3 100644 --- a/js/functions.js +++ b/js/functions.js @@ -51,15 +51,15 @@ $(document).ready(function(){ if(localStorage.getItem('localLikes')){ //likes auslesen - + localLikes = JSON.parse(localStorage.getItem('localLikes')) console.log("Stored local Likes:") console.log(localLikes) - + }else{ - - //LocalLikes leer + + //LocalLikes leer localLikes = { ideen: [], @@ -68,7 +68,7 @@ $(document).ready(function(){ console.log("New Local Likes created") console.log(localLikes) - + localStorage.setItem('localLikes',JSON.stringify(localLikes)); } @@ -80,7 +80,7 @@ $(document).ready(function(){ function chageLocalStorrage(typ, id, addRemove){ - + if(typ =="idee"){ if(addRemove == "add" && !localLikes.ideen.includes(id)){ @@ -107,13 +107,15 @@ function chageLocalStorrage(typ, id, addRemove){ } localStorage.setItem('localLikes',JSON.stringify(localLikes)); - + } // IDEE ANZEIGEN + + function ideeAnzeigen(data) { document.getElementById("idee").innerHTML = ""; @@ -149,7 +151,7 @@ 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.classList.add("liked"); @@ -170,13 +172,13 @@ function ideeAnzeigen(data) { ideeLike.classList.remove("liked"); removeLike("idee", data.id) }else{ - + ideeLike.src= "../images/herz-1.png"; ideeLike.classList.add("liked"); ideeLike.classList.remove("unliked"); addLike("idee", data.id) } - + }); @@ -206,32 +208,32 @@ function addLike(typ, id, element){ //increment likes in DB $.post('system/addLike.php/?typ=idee&id=' + id, {}).done(function(response){ - + //neue Likes anzeigen - - $("p.likeDisplay").html(response + " Likes") - + + $("p.likeDisplay").html(response + " Likes") + }); //add like in LocalStorage chageLocalStorrage("idee", id, "add") - + }else if(typ == "kommentar"){ $.post('system/addLike.php/?typ=kommentar&id=' + id, {}).done(function(response){ - - element.prev().html(response + " Likes") - - + + element.prev().html(response + " Likes") + + }); //add like in LocalStorage chageLocalStorrage("kommentar", id, "add") - } + } } @@ -242,28 +244,28 @@ function removeLike(typ, id, element){ if(typ == "idee"){ $.post('system/removeLike.php/?typ=idee&id=' + id, {}).done(function(response){ - - $("p.likeDisplay").html(response + " Likes") - + $("p.likeDisplay").html(response + " Likes") + + }); chageLocalStorrage("idee", id, "remove") }else if(typ == "kommentar"){ $.post('system/removeLike.php/?typ=kommentar&id=' + id, {}).done(function(response){ - - element.prev().html(response + " Likes") - - + + element.prev().html(response + " Likes") + + }); chageLocalStorrage("kommentar", id, "remove") - } + } + - } @@ -373,6 +375,21 @@ function formularErstellen(koordianten) { document.getElementById("form").appendChild(submit_input); document.getElementById("form").appendChild(koordinaten_lat); document.getElementById("form").appendChild(koordinaten_lng); + + document.getElementById("image-upload").innerHTML = ''; + + // get a widget reference + const widget = uploadcare.Widget("[role=uploadcare-uploader]", { multiple: true}); + + // listen to the "upload completed" event + widget.onUploadComplete(fileGroupInfo => { + // get a information about uploaded group + // check https://uploadcare.com/docs/file-uploader-api/file-groups/#file-group-info + + for (var i = 0; i < fileGroupInfo.count; i++) { + console.log("https://ucarecdn.com/" + fileGroupInfo.uuid + "/nth/" + i + "/-/preview/-/quality/smart/-/format/auto/"); + } + }); }; @@ -381,15 +398,15 @@ 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); - + for (var i = 0; i < commentArray.length; i++) { @@ -408,7 +425,7 @@ function kommentareAnzeigen(idee_id){ kommentarLikeNumber.appendTo(kommentarContainer); let kommentarLikeButton = $("").addClass("unliked commentLike") - + if(localLikes.kommentare.includes(thisComment.k_id)){ kommentarLikeButton.attr("src", "../images/herz-1.png"); @@ -433,19 +450,19 @@ function kommentareAnzeigen(idee_id){ kommentarLikeButton.removeClass("liked"); removeLike("kommentar", thisComment.k_id, $(this)) }else{ - + kommentarLikeButton.attr("src", "../images/herz-1.png"); kommentarLikeButton.addClass("liked"); kommentarLikeButton.removeClass("unliked"); addLike("kommentar", thisComment.k_id, $(this)) - + } - + }); - + /* @@ -457,13 +474,9 @@ function kommentareAnzeigen(idee_id){ */ } - + }); } - - - -