Public Version 1 on spinn-mit.ch

This commit is contained in:
nooahe committed 2023-01-03 16:08:52 +01:00
1 parent 522e01979f
commit 13ebde7ef1
11 files changed
+460 -145

No files matched your search

+69 -58
View File
@@ -1,7 +1,4 @@
//LocalLike Objekt erstellen
let localLikes = {}
@@ -34,11 +31,13 @@ $(document).ready(function(){
// submit kommentar nicht seite neu laden
$("#kommentarform").submit(function(e) {
console.log("Submitted")
console.log("Comment Submitted")
e.preventDefault(); // avoid to execute the actual submit of the form.
});
if(!localStorage.getItem('firstVisit')){
console.log("loadStartscreen");
@@ -52,7 +51,6 @@ $(document).ready(function(){
}
//LocalStorage erstellen oder auslesen
@@ -81,9 +79,6 @@ $(document).ready(function(){
}
})
@@ -127,9 +122,6 @@ function openOverlay(){
}
//LocalStorage Anpassen (Likes hinzufügen oder entfernen)
@@ -165,11 +157,8 @@ function chageLocalStorrage(typ, id, addRemove){
}
// IDEE ANZEIGEN
function ideeAnzeigen(data) {
document.getElementById("overlay_container").innerHTML = "";
@@ -182,11 +171,19 @@ function ideeAnzeigen(data) {
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");
@@ -194,50 +191,47 @@ function ideeAnzeigen(data) {
inhaltErstellen.appendChild(inhaltInhalt);
inhaltErstellen.classList.add("ideeInhalt");
/*
<div class="pswp-gallery pswp-gallery--single-column" id="gallery--getting-started">
<a href="https://cdn.photoswipe.com/photoswipe-demo-images/photos/7/img-2500.jpg"
data-pswp-width="1875"
data-pswp-height="2500"
data-cropped="true"
target="_blank">
<img src="https://cdn.photoswipe.com/photoswipe-demo-images/photos/7/img-200.jpg" alt="" />
</a>
</div> */
if(data.bild != null && data.bild != ""){
let bildContainer = $("<div>").addClass("ImgContainer");
let bildContainer = $("<div>").attr({id: "gallery--getting-started", class: "ImgContainer pswp-gallery pswp-gallery--single-column"});
let loadingscreen = $("<div>").addClass("loadingscreen");
let loader = $("<div>").addClass("loader");
loader.appendTo(loadingscreen)
loadingscreen.appendTo($("#overlay_container"))
let imgUrlArr = JSON.parse(data.bild);
bildContainer.css("background-image", "url(" + imgUrlArr[0] + ")");
for (let i = 0; i < imgUrlArr.length; i++) {
//let img = $("<img>").addClass("previewImage");
//img.attr("src", imgUrlArr[i]);
//img.appendTo(bildContainer);
bildContainer.css("background-image","url(" + imgUrlArr[i] + ")")
let pswpA = $("<a>").attr({href: imgUrlArr[i], 'data-cropped': "true", target: "_blank"})
pswpA.appendTo(bildContainer)
}
bildContainer.prependTo($("#overlay_container"))
} else {
inhaltContainer.classList.add("class","topMargin")
}
/*
let bild = document.createElement("img");
bild.src = data.bild;
bild.classList.add("ideeBilder");
bild.classList.add("loeschen");
document.getElementById('idee').appendChild(bild);
console.log(data);
*/
let ideeLike = document.createElement("img");
ideeLike.classList.add("herz");
@@ -255,7 +249,9 @@ function ideeAnzeigen(data) {
document.getElementById('overlay_container').appendChild(inhaltContainer);
document.getElementById('inhaltContainer').appendChild(likesErstellen);
document.getElementById('inhaltContainer').appendChild(ideeLike);
document.getElementById('inhaltContainer').appendChild(titelErstellen);
titleLocationContainer.appendChild(titelErstellen);
titleLocationContainer.appendChild(adresseErstellen);
document.getElementById('inhaltContainer').appendChild(titleLocationContainer);
document.getElementById('inhaltContainer').appendChild(inhaltErstellen);
@@ -368,8 +364,6 @@ function removeLike(typ, id, element){
// kommentar formular likesErstellen
function kommentarErstellen(idee_id) {
@@ -428,7 +422,7 @@ function kommentarErstellen(idee_id) {
// Idee formular erstellen
function formularErstellen(koordianten) {
function formularErstellen(koordianten, ergebnisAdresse) {
document.getElementById("overlay_container").innerHTML = "";
@@ -458,6 +452,11 @@ function formularErstellen(koordianten) {
titel_input.setAttribute("name", "titel");
titel_input.setAttribute("placeholder", "TITEL");
let adresse_input = document.createElement("input");
adresse_input.setAttribute("type", "text");
adresse_input.classList.add("adresse");
adresse_input.setAttribute("name", "adresse");
adresse_input.setAttribute("value", ergebnisAdresse);
let text_input = $("<textarea>");
@@ -478,6 +477,7 @@ function formularErstellen(koordianten) {
document.getElementById("form").appendChild(titel_input);
document.getElementById("form").appendChild(adresse_input);
textAndImage.appendTo("#form");
text_input.appendTo(textAndImage);
@@ -488,38 +488,43 @@ function formularErstellen(koordianten) {
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.html('<input type="hidden" role="uploadcare-uploader" data-public-key="3a3c37e85850c6cfe077" data-multiple="true" data-images-only data-clearable data-tabs="file camera" data-image-shrink="1024x1024" data-system-dialog="true"/>')
imageUpload.appendTo(textAndImage);
// get a widget reference
const widget = uploadcare.Widget("[role=uploadcare-uploader]", { multiple: false});
const widget = uploadcare.Widget("[role=uploadcare-uploader]", { multiple: true});
// listen to the "upload completed" event
widget.onUploadComplete(fileInfo => {
widget.onUploadComplete(fileGroupInfo => {
// get a information about uploaded group
// check https://uploadcare.com/docs/file-uploader-api/file-groups/#file-group-info
let linkArr = [];
let ImgUrl;
$("<div>").addClass("ImgPrevContainer").appendTo($("div.image-preview"));
ImgUrl = "https://ucarecdn.com/" + fileInfo.uuid + "/-/preview/-/quality/smart/-/format/auto/";
console.log(fileInfo);
for (var i = 0; i < fileGroupInfo.count && i < 4; i++) {
ImgUrl = "https://ucarecdn.com/" + fileGroupInfo.uuid + "/nth/" + i + "/-/preview/-/quality/smart/-/format/auto/";
linkArr.push(ImgUrl);
createImgPrev(ImgUrl + "-/resize/x100/"); //img Preview 100 pixels high
};
// ImgUrl = "https://ucarecdn.com/" + fileInfo.uuid + "/-/preview/-/quality/smart/-/format/auto/";
// console.log(fileInfo);
// linkArr.push(ImgUrl);
let linkArrString = JSON.stringify(linkArr);
console.log(linkArrString);
image_links.value = linkArrString;
console.log(image_links.value);
$(".uploadcare--widget__button_type_remove").click(() => {
console.log("delete");
@@ -533,15 +538,18 @@ function formularErstellen(koordianten) {
$(".uploadcare--widget__button_type_open needsclick").addClass("test")
};
function createImgPrev(imgURL){
let prevImg = $("<div>").addClass("prevIMG");
prevImg.css("background-image", "url(" + 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 + ')');
// $("div.ImgPrevContainer").css('background-image', 'url(' + imgURL + ')');
}
@@ -628,3 +636,6 @@ function kommentareAnzeigen(idee_id){
}
+21 -6
View File
@@ -2,9 +2,24 @@ import PhotoSwipeLightbox from '/js/photoswipe-lightbox.esm.js';
import PhotoSwipe from '/js/photoswipe.esm.js';
const lightbox = new PhotoSwipeLightbox({
gallery: '#gallery--getting-started',
children: 'a',
pswpModule: PhotoSwipe
});
lightbox.init();
let allImgs = document.querySelectorAll("#map")
for (let i = 0; i < allImgs.length; i++) {
allImgs[i].addEventListener("click", function() {
console.log("testtest");
const lightbox = new PhotoSwipeLightbox({
gallery: '#gallery--getting-started',
children: 'a',
pswpModule: PhotoSwipe,
});
lightbox.init();
});
}