resoved conflicts

master
nooahe 2022-11-15 15:11:14 +01:00
commit 93bab0b3c5
3 changed files with 98 additions and 44 deletions

View File

@ -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;
}
}
=======
.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

View File

@ -12,6 +12,19 @@ dbVerbindungErzeugen()
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SPINN MIT!</title>
<link rel="stylesheet" href="/css/style.css">
<script>UPLOADCARE_LOCALE="de"
UPLOADCARE_LOCALE_TRANSLATIONS = {
buttons: {
choose: {
files: {
other: 'Bild hochladen'
}
}
}
}</script>
</head>
<body>
<h1>spinn mit!!</h1>
@ -26,14 +39,20 @@ dbVerbindungErzeugen()
<div id="idee_container">
<img src="/images/cancel.png" id="cancel">
<div id="idee">
</div>
<div class="image-preview" id="image-upload">
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://ucarecdn.com/libs/widget/3.x/uploadcare.full.min.js"></script>
<script src="js/functions.js"></script>
<script src="js/main.js"></script>

View File

@ -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){
*/
}
});
}