resoved conflicts
This commit is contained in:
commit
93bab0b3c5
3 files changed
+98
-44
No files matched your search
+55
-42
@@ -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 = '<input type="hidden" role="uploadcare-uploader" data-public-key="3a3c37e85850c6cfe077" data-multiple="true" data-images-only data-public- data-clearable data-tabs="file camera" data-image-shrink: "1024x1024" data-system-dialog="false"/>';
|
||||
|
||||
// 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 = $("<img>").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){
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user