This commit is contained in:
Lukas Nowy
2019-03-09 23:35:56 +01:00
635 changed files with 64891 additions and 3987 deletions

View File

@ -23,5 +23,7 @@ messaging.setBackgroundMessageHandler(payload => {
// }
// return self.registration.showNotification(title, options)
const title = payload.data.title
new Notification(title, { body: payload.data.text});
new Notification(title, {
body: payload.data.text
});
})

View File

@ -1,81 +1,98 @@
$(document).ready(function() {
$(document).ready(function () {
// Initialize Firebase
var config = {
apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
authDomain: "test-667ca.firebaseapp.com",
databaseURL: "https://test-667ca.firebaseio.com",
projectId: "test-667ca",
storageBucket: "test-667ca.appspot.com",
messagingSenderId: "221332577314"
};
// Initialize Firebase
var config = {
apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
authDomain: "test-667ca.firebaseapp.com",
databaseURL: "https://test-667ca.firebaseio.com",
projectId: "test-667ca",
storageBucket: "test-667ca.appspot.com",
messagingSenderId: "221332577314"
};
firebase.initializeApp(config);
firebase.initializeApp(config);
var segment_str = window.location.pathname;
var segment_array = segment_str.split( '/' );
var last_segment = segment_array.pop();
//verifyInvite(last_segment);
getList(last_segment);
verifyInvite(last_segment);
function verifyInvite(link) {
//alert("Ore Link", link)
firebase.auth().onAuthStateChanged(function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
$.ajax({
type: "POST",
url: "/invitemember",
data: {
idtoken: idtoken,
link: link
},
success(){
window.location.href = "/dash/" + idtoken
//alert("Success");
},
error(err){
console.error("Error: " + err);
//alert("Error");
window.location.href = "/dash/" + idtoken
}
});
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
}
function getList(link) {
firebase.auth().onAuthStateChanged(function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
$.ajax({
type: "GET",
url: "/shoppinglistsbylink?link=" + link,
data: {
idtoken: idtoken
},
success(data){
console.log(data);
$(".s_name").append(data.find(function(obj) {return obj.invitelink == link}).name);
$(".s_desc").append(data.find(function(obj) {return obj.invitelink == link}).description);
$(".s_link").append(data.find(function(obj) {return obj.invitelink == link}).invitelink);
},
error(err){
console.error("Error: " + err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
}
$(".btn_verify").click(function() {
var segment_str = window.location.pathname;
var segment_array = segment_str.split( '/' );
var segment_str = window.location.pathname;
var segment_array = segment_str.split('/');
var last_segment = segment_array.pop();
//verifyInvite(last_segment);
getList(last_segment);
verifyInvite(last_segment);
})
});
function verifyInvite(link) {
//alert("Ore Link", link)
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
$.ajax({
type: "POST",
url: "/invitemember",
data: {
idtoken: idtoken,
link: link
},
success() {
window.location.href = "/dash/" + idtoken
//alert("Success");
},
error(err) {
console.error("Error: " + err);
//alert("Error");
window.location.href = "/dash/" + idtoken
}
});
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
}
function getList(link) {
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
$.ajax({
type: "GET",
url: "/shoppinglistsbylink?link=" + link,
data: {
idtoken: idtoken
},
success(data) {
console.log(data);
$(".s_name").append(data.find(function (obj) {
return obj.invitelink == link
}).name);
$(".s_desc").append(data.find(function (obj) {
return obj.invitelink == link
}).description);
$(".s_link").append(data.find(function (obj) {
return obj.invitelink == link
}).invitelink);
},
error(err) {
console.error("Error: " + err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
}
$(".btn_verify").click(function () {
var segment_str = window.location.pathname;
var segment_array = segment_str.split('/');
var last_segment = segment_array.pop();
verifyInvite(last_segment);
})
});

View File

@ -1,6 +1,6 @@
body {
background-color: #121212;
display:none;
display: none;
}
.cont {

View File

@ -6,128 +6,118 @@ var config = {
projectId: "test-667ca",
storageBucket: "test-667ca.appspot.com",
messagingSenderId: "221332577314"
};
};
firebase.initializeApp(config);
$(document).ready(function() {
firebase.auth().onAuthStateChanged(async function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
console.log("/shoppinglistx idtoken:", idtoken);
var url = "/dash/" + idtoken
console.log("URL: ", url)
$('#dashurl').attr("href", url);
$(document).ready(function () {
firebase.auth().onAuthStateChanged(async function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
console.log("/shoppinglistx idtoken:", idtoken);
var url = "/dash/" + idtoken
console.log("URL: ", url)
$('#dashurl').attr("href", url);
}).catch((error) => console.error("/shoppinglist Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
}).catch((error) => console.error("/shoppinglist Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
eigeneEinkaufslisten();
geteilteEinkaufslisten();
$(".detailcardausgabe").hide();
$(".logout").click(function(){
$(".logout").click(function () {
console.log("click logout")
firebase.auth().signOut().then(function() {
firebase.auth().signOut().then(function () {
document.location.replace('/');
}).catch(function(error) {
}).catch(function (error) {
console.error("Logout Error: ", error)
});
});
$('.add').click(function(){
console.log("click add");
// let name = $("#einkaufslistenname").val();
firebase.auth().onAuthStateChanged(async function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
console.log("/shoppinglistx idtoken:", idtoken);
$.ajax({
type: "POST",
url: "/shoppinglist",
data: {
name: $("#einkaufslistenname").val(),
description: $("#einkaufslistenbeschreibung").val(),
color: $( "input:checked" ).val(),
idtoken: idtoken
},
success(res){
console.log("add funktioniert");
$(".listen-ausgabe").html("");
eigeneEinkaufslisten();
geteilteEinkaufslisten();
$("#EigeneListeAdd").modal("hide");
},
error(err){
console.log("/shoppinglist error", err);
}
});
}).catch((error) => console.error("/shoppinglist Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
});
$(".gruppenadd").click(function(){
// let name = $("#groupname").val();
// let color = $("#groupfarbe").val();
$("#ListenDetailAdd").modal("hide");
$.ajax({
type: "POST",
url: "/group",
data: {
sl_id: globaleAddZwischenID,
name: $("#groupname").val(),
color: $( "input:checked" ).val()
},
success(res){
console.log("groupadd funktioniert");
},
error(err){
console.log("error");
}
});
});
$(".sl_add").click(function(){
$('.add').click(function () {
console.log("click add");
// let name = $("#einkaufslistenname").val();
firebase.auth().onAuthStateChanged(async function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
console.log("/shoppinglistx idtoken:", idtoken);
$.ajax({
type: "POST",
url: "/shoppinglist",
data: {
name: $("#einkaufslistenname").val(),
description: $("#einkaufslistenbeschreibung").val(),
color: $("input:checked").val(),
idtoken: idtoken
},
success(res) {
console.log("add funktioniert");
$(".listen-ausgabe").html("");
eigeneEinkaufslisten();
geteilteEinkaufslisten();
$(".EigeneListeAdd").modal("hide");
},
error(err) {
console.log("/shoppinglist error", err);
}
});
}).catch((error) => console.error("/shoppinglist Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
});
$(".sl_add").click(function () {
$('#EigeneListeAdd').modal('show');
});
});
var globaleAddZwischenID = "";
var globalegraddid = "";
// var globaleGetZwischenID = "";
function eigeneEinkaufslisten(){
firebase.auth().onAuthStateChanged(async function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
console.log("/myshoppinglists idtoke: ", idtoken);
$.ajax({
type: "GET",
url: "/myshoppinglists",
data:{
idtoken: idtoken
},
success(res){
firebase.auth().onAuthStateChanged(async function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
console.log("/userinfo_json idtoken: ",idtoken)
$.ajax({
type: "GET",
url: "/userinfo_json",
data: {
idtoken: idtoken
},
success(data){
const userinfo = data.name;
const picture = data.picture;
console.log(data)
for(let i = 0; i < res.length; i++){
const el = res[i];
$(".listen-ausgabe").append(`<div class="col-md-12 karten">
function eigeneEinkaufslisten() {
firebase.auth().onAuthStateChanged(async function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
console.log("/myshoppinglists idtoke: ", idtoken);
$.ajax({
type: "GET",
url: "/myshoppinglists",
data: {
idtoken: idtoken
},
success(res) {
firebase.auth().onAuthStateChanged(async function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
console.log("/userinfo_json idtoken: ", idtoken)
$.ajax({
type: "GET",
url: "/userinfo_json",
data: {
idtoken: idtoken
},
success(data) {
const userinfo = data.name;
const picture = data.picture;
console.log(data)
for (let i = 0; i < res.length; i++) {
const el = res[i];
$(".listen-ausgabe").append(`<div class="col-md-12 karten">
<div class="card border-light mb-3 shadow-sm" style="max-width: 18rem;" id="${el.sl_id}">
<div class="card-header" style="background-color: #${el.color};">
<span>
@ -135,56 +125,67 @@ function eigeneEinkaufslisten(){
${userinfo}</span>
<button class="btn edit"><i class="fas fa-pencil-alt "></i></button>
<button class="btn trash"><i class="far fa-trash-alt"></i></button>
<button class="btn groupadd" data-toggle="modal" data-target=".ListenDetailAdd"><i class="fas fa-plus"></i></button>
</div>
<div class="card-body">
<h5 class="card-title">${el.name}</h5>
<p class="card-text">${el.description}</p>
</div>
</div></div>`
)
</div></div>`)
}
console.log("Eigene Einkaufslisten");
loeschen();
Detail();
// groupHinzufügen()
},
error(err) {
console.error("userinfo_json error: ", err)
}
})
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
console.log("Eigene Einkaufslisten");
loeschen();
lala();
Detail();
// groupHinzufügen()
},
error(err){
console.error("userinfo_json error: ", err)
}
})
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
},
error(err){
console.error("/myshoppinglists ajax error: ", err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
});
},
error(err) {
console.error("/myshoppinglists ajax error: ", err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
};
function geteilteEinkaufslisten(){
firebase.auth().onAuthStateChanged(async function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
console.log("/sharedshoppinglists idtoke: ", idtoken)
$.ajax({
data: "GET",
url: "/sharedshoppinglists",
data: {
idtoken: idtoken
},
success(res){
console.log("Geteilte Einkaufslisten");
},
error(err){
console.error("/sharedshoppinglists error:", err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
function geteilteEinkaufslisten() {
firebase.auth().onAuthStateChanged(async function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
console.log("/sharedshoppinglists idtoke: ", idtoken)
$.ajax({
data: "GET",
url: "/sharedshoppinglists",
data: {
idtoken: idtoken
},
success(res) {
console.log("Geteilte Einkaufslisten");
},
error(err) {
console.error("/sharedshoppinglists error:", err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
};
function loeschen(){
$(".trash").click(function(){
function loeschen() {
$(".trash").click(function () {
let card = $(this).closest(".card");
let id = card.attr("id");
@ -195,12 +196,13 @@ function loeschen(){
type: "DELETE",
url: "/shoppinglist",
data: {
sl_id: id},
success(res){
sl_id: id
},
success(res) {
console.log("card gelöscht");
card.remove();
},
error(err){
error(err) {
console.log("error");
}
});
@ -208,168 +210,249 @@ function loeschen(){
});
};
function lala(){
$(".groupadd").click(function(){
let card = $(this).closest(".card");
let id = card.attr("id");
globaleAddZwischenID = id;
$("#groupname").val("");
function lala() {
$(".groupadd").click(function () {
let getid = $(this).closest('.shoplistid');
let id = getid.attr('id');
console.log(id);
globaleAddZwischenID = id;
});
}
function Detail(){
$(".edit").click(function(){
function gruppenhinzu() {
$(".gruppenadd").click(function () {
let name = $("#groupname").val();
let color = $("input:checked").val();
// $("#ListenDetailAdd").modal("hide");
console.log(globaleAddZwischenID);
firebase.auth().onAuthStateChanged(async function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
$.ajax({
type: "POST",
url: "/group",
data: {
idtoken:idtoken,
sl_id: globaleAddZwischenID,
name: $("#groupname").val(),
color: $("input:checked").val(),
hidden: false
},
success(res) {
console.log(res);
$("input:checked").val("");
$("#groupname").val("");
$(".ListenDetailAdd").modal("hide");
$(".gruppeninhalt").append(`<div class="col-md-6 col-lg-4 shoplisteid" id="${globaleAddZwischenID}">
<div class="card mb-3 groupid" id="" style="max-width: 18rem;background-color:#${color};">
<div class="card-header"><h5 class="card-title">${name}</h5><button class="btn itemadd"><i class="fas fa-plus"></i></button><button class="btn trashgroup"><i class="far fa-trash-alt"></i></button><button class="btn seemore" type="button" data-toggle="collapse" data-target="#${name}" aria-expanded="false" aria-controls="${name}"><i class="fas fa-caret-down"></i></button>
<div class="${name}">
</div>
</div>
</div></div>
`);
},
error(err) {
console.log("error");
}
});
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
});
}
function Detail() {
$(".edit").click(function () {
$(".cardausgabe").hide();
$(".detailcardausgabe").show();
let card = $(this).closest(".card");
let id = card.attr("id");
firebase.auth().onAuthStateChanged(async function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
$.ajax({
type: "GET",
url: "/shoppinglist_json/" + id,
data: {
idtoken: idtoken
},
success(res){
console.log(res)
console.log("/myshoppinglists inside idtoken: ", idtoken)
firebase.auth().onAuthStateChanged(async function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
$.ajax({
type: "GET",
url: "/myshoppinglists",
url: "/shoppinglist_json/" + id,
data: {
idtoken: idtoken
},
success(result){
// var idtoken = getIdTokenGoogle()
success(res) {
console.log(res)
console.log("/myshoppinglists inside idtoken: ", idtoken)
$.ajax({
type: "GET",
url: "/userinfo_json",
data:{
url: "/myshoppinglists",
data: {
idtoken: idtoken
},
success(data){
let userinfo = "some info"
console.log(userinfo);
const neu = result.filter(obj => obj.sl_id === id);
success(result) {
// var idtoken = getIdTokenGoogle()
$.ajax({
type: "GET",
url: "/userinfo_json",
data: {
idtoken: idtoken
},
success(data) {
let userinfo = "some info"
console.log(userinfo);
var link = "/dash/"+idtoken;
const neu = result.filter(obj => obj.sl_id === id);
$(".kopf").attr("style",`background-color:#${neu[0].color}`);
var link = "/dash/" + idtoken;
console.log(neu[0].color);
$(".kopf").attr("style", `background-color:#${neu[0].color}`);
$(".card-header").append(`<div class="shoplistid" id="${id}">
console.log(neu[0].color);
$(".card-header").append(`<div class="shoplistid" id="${id}">
<a href="${link}" style="left: 5px; margin-top: -50px;color: black;">
<i class="fas fa-caret-left"></i>
</a>
<button class="itemadd">
<i class="fas fa-plus"></i>
</button>
<button class="btn groupadd" data-toggle="modal" data-target=".ListenDetailAdd"><i class="fas fa-plus"></i></button>
<h1 class="text-center">
${neu[0].name}
</h1></div>
`);
for (let i = 0; i < res.groups.length; i++) {
const el = res.groups[i];
$(".gruppeninhalt").append(`<div class="col-md-6 col-lg-4 shoplisteid" id="${res.sl_id}">
for (let i = 0; i < res.groups.length; i++) {
const el = res.groups[i];
$(".gruppeninhalt").append(`<div class="col-md-6 col-lg-4 shoplisteid" id="${res.sl_id}">
<div class="card mb-3 groupid ${el.group_id}" id="${el.group_id}" style="max-width: 18rem;background-color:#${el.color};">
<div class="card-header"><h5 class="card-title">${el.name}</h5><button class="btn trashgroup"><i class="far fa-trash-alt"></i></button><button class="btn seemore" type="button" data-toggle="collapse" data-target="#${el.name}" aria-expanded="false" aria-controls="${el.name}"><i class="fas fa-caret-down"></i></button>
<div class="card-header">
<h5 class="card-title">${el.name}</h5>
<button class="btn itemadd"><i class="fas fa-plus"></i></button>
<button class="btn trashgroup"><i class="far fa-trash-alt"></i></button>
<button class="btn seemore" type="button" data-toggle="collapse" data-target="#${el.name}" aria-expanded="false" aria-controls="${el.name}"><i class="fas fa-caret-down"></i></button>
<div class="${el.name}">
</div>
</div>
</div></div>
`);
for(let x = 0; x < el.content.length; x++){
const el2 = el.content[x]
$(`.${el.name}`).append(`<div class="collapse" id="${el.name}"><ul><li>${el2.count}x ${el2.name}</li></ul></div>`);
}
}
ItemAdden();
groupdelete();
for (let x = 0; x < el.content.length; x++) {
const el2 = el.content[x]
$(`.${el.name}`).append(`<div class="collapse" id="${el.name}"><ul><li>${el2.count}x ${el2.name}</li></ul></div>`);
}
}
lala();
gruppenhinzu();
ItemAdden();
groupdelete();
},
error(err) {
console.log("Detail error userinfo_json: ", err);
}
})
},
error(err){
console.log("Detail error userinfo_json: ", err);
error(err) {
console.log("Detail error myshoppinglists: ", err);
}
})
});
},
error(err){
console.log("Detail error myshoppinglists: ", err);
error(err) {
console.log("Detail error shoppinglist_json: ", err);
}
});
},
error(err){
console.log("Detail error shoppinglist_json: " , err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
});
};
function ItemAdden(){
$(".itemadd").click(function(){
let getid = $(this).closest('.shoplistid');
let id = getid.attr('id');
globaleAddZwischenID = id;
console.log(id);
$('.select').remove();
function ItemAdden() {
$(".itemadd").click(function () {
let getslid = $(this).closest('.shoplisteid');
let slid = getslid.attr('id');
console.log(slid);
let getgrid = $(this).closest('.groupid');
let grid = getgrid.attr('id');
globalegraddid = grid;
globaleAddZwischenID = slid;
$('.GroupItemAdd').modal('show');
firebase.auth().onAuthStateChanged(async function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
$.ajax({
type: "GET",
url: "/shoppinglist_json/" + id,
data: {
idtoken: idtoken
},
success(result){
// firebase.auth().onAuthStateChanged(async function (user) {
// if (user) {
// firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
// $.ajax({
// type: "GET",
// url: "/shoppinglist_json/" + id,
// data: {
// idtoken: idtoken
// },
// success(result) {
console.log(result.groups);
// console.log(result);
for (let i = 0; i < result.groups.length; i++) {
const el = result.groups[i];
$(".custom-select-groups").append(`
<option class="select" value="${el.group_id}">${el.name}</option>
`);
}
},
error(err){
console.log(err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
// for (let i = 0; i < result.groups.length; i++) {
// const el = result.groups[i];
// $(".custom-select-groups").append(`
// <option class="select" value="${el.group_id}">${el.name}</option>
// `);
// }
// },
// error(err) {
// console.log(err);
// }
// });
// }).catch((error) => console.error("Get id token client error: ", error));
// } else {
// console.log("Check Auth error", user)
// }
// });
});
}
$(".itemhinzu").click(function(){
$(".itemhinzu").click(function () {
var name = $('#itemname').val();
var zahl = $('#inputGroupSelect01').val();
var gruppe = $('#inputGroupSelect02').val();
console.log(name);
console.log(zahl);
console.log(gruppe);
$.ajax({
type: "POST",
url: "/item",
data: {
group_id: $('#inputGroupSelect02').val(),
sl_id: globaleAddZwischenID,
name: $('#itemname').val(),
count: $('#inputGroupSelect01').val()
},
success(result){
console.log("post item");
},error(err){
firebase.auth().onAuthStateChanged(async function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
$.ajax({
type: "POST",
url: "/item",
data: {
group_id: globalegraddid,
sl_id: globaleAddZwischenID,
name: $('#itemname').val(),
count: $('#inputGroupSelect01').val()
},
success(result) {
$('.GroupItemAdd').modal('hide');
console.log("post item");
},
error(err) {
}
});
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
@ -377,9 +460,9 @@ $(".itemhinzu").click(function(){
});
function groupdelete(){
$('.trashgroup').click(function(){
function groupdelete() {
$('.trashgroup').click(function () {
let getid = $(this).closest('.shoplisteid');
let shoplistid = getid.attr('id');
let getid2 = $(this).closest('.groupid');
@ -393,15 +476,16 @@ function groupdelete(){
url: "/group",
data: {
sl_id: shoplistid,
group_id: groupid},
success(res){
group_id: groupid
},
success(res) {
console.log("card gelöscht");
$(`.${groupid}`).remove();
},
error(err){
error(err) {
console.log("error");
}
});
});
};
};

File diff suppressed because it is too large Load Diff

View File

@ -1,51 +1,47 @@
// Initialize Firebase
// const firebaseconfig = {
// apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
// authDomain: "test-667ca.firebaseapp.com",
// databaseURL: "https://test-667ca.firebaseio.com",
// projectId: "test-667ca",
// storageBucket: "test-667ca.appspot.com",
// messagingSenderId: "221332577314"
// };
// firebase.initializeApp(firebaseconfig);
var msg = firebase.messaging();
msg.requestPermission()
.then(function(){
console.log("Zugriff auf msg");
return msg.getToken();
})
.then(token => {
updateUser(token);
})
.catch(err => {
console.error("Msg Error: ", err);
})
.then(function () {
return msg.getToken();
})
.then(token => {
console.log("Zugriff auf msg", token);
updateUser(token);
})
.catch(err => {
console.error("Msg Error: ", err);
})
function updateUser(token) {
firebase.auth().onAuthStateChanged(function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
$.ajax({
type: "POST",
url: "/user",
data:{
idtoken: idtoken,
message_id: token
},
success(){
console.log("User updated");
},
error(err){
console.error("Error: " + err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
$.ajax({
type: "POST",
url: "/user",
data: {
idtoken: idtoken,
message_id: token
},
success() {
console.log("User updated");
},
error(err) {
console.error("Error: " + err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
}
msg.onMessage(payload => {
const title = payload.data.title
new Notification(title, { body: payload.data.text});
})
new Notification(title, {
body: payload.data.body
});
})

View File

@ -1,101 +1,110 @@
// Initialize Firebase
var config = {
apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
authDomain: "test-667ca.firebaseapp.com",
databaseURL: "https://test-667ca.firebaseio.com",
projectId: "test-667ca",
storageBucket: "test-667ca.appspot.com",
messagingSenderId: "221332577314"
apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
authDomain: "test-667ca.firebaseapp.com",
databaseURL: "https://test-667ca.firebaseio.com",
projectId: "test-667ca",
storageBucket: "test-667ca.appspot.com",
messagingSenderId: "221332577314"
};
firebase.initializeApp(config);
function checkAuth(){
firebase.auth().onAuthStateChanged(async function(user){
if(user){
try{
firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idToken) {
console.log("Vor Replace");
function checkAuth() {
firebase.auth().onAuthStateChanged(async function (user) {
if (user) {
try {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idToken) {
console.log("Vor Replace");
window.location.replace("/dash/" + idToken);
}).catch(function(error) {
console.error("Get id token client error: ", error)
});
}catch{
console.error("checkAuth error: ")
}
// document.getElementById("loginbutton").style.display = "none";
//
}else{
// document.getElementById("loginbutton").style.display = "block";
console.log("Check Auth error", user)
}
})
var user = firebase.auth().currentUser;
window.location.replace("/dash/" + idToken);
}).catch(function (error) {
console.error("Get id token client error: ", error)
});
} catch {
console.error("checkAuth error: ")
}
// document.getElementById("loginbutton").style.display = "none";
//
} else {
// document.getElementById("loginbutton").style.display = "block";
console.log("Check Auth error", user)
}
})
var user = firebase.auth().currentUser;
}
window.onload = function(){
checkAuth();
window.onload = function () {
checkAuth();
}
var vue = new Vue({
el: '#vue-app',
data:{
el: '#vue-app',
data: {
email: "",
password: ""
},
methods: {
login() {
var provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('profile');
provider.addScope('email');
firebase.auth().signInWithPopup(provider).then(function (result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
var idToken = result.credential.idToken;
// The signed-in user info.
var user = result.user;
console.log("Eingelogt");
checkAuth();
}).catch(function (error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
});
},
methods: {
login(){
var provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('profile');
provider.addScope('email');
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
var idToken = result.credential.idToken;
// The signed-in user info.
var user = result.user;
console.log("Eingelogt");
checkAuth();
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
});
}
},
mounted() {
/*axios.post('/user', {
message_id: 'test',
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});*/
loginemail() {
firebase.auth().signInWithEmailAndPassword(this.email, this.password).then(result => {
checkAuth();
}).catch(function (error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// ...
});
}
// mounted() {
// axios.post('/user', {
// message_id: 'test',
// })
// .then(function (response) {
// console.log(response);
// })
// .catch(function (error) {
// console.log(error);
// });
// }
},
mounted() {
/*axios.post('/user', {
message_id: 'test',
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});*/
}
// mounted() {
// axios.post('/user', {
// message_id: 'test',
// })
// .then(function (response) {
// console.log(response);
// })
// .catch(function (error) {
// console.log(error);
// });
// }
});

View File

@ -0,0 +1,52 @@
// Initialize Firebase
var config = {
apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
authDomain: "test-667ca.firebaseapp.com",
databaseURL: "https://test-667ca.firebaseio.com",
projectId: "test-667ca",
storageBucket: "test-667ca.appspot.com",
messagingSenderId: "221332577314"
};
firebase.initializeApp(config);
var vue = new Vue({
el: '#vue-app',
data: {
name: "",
email: "",
picurl: "",
password: ""
},
methods: {
registerEmail() {
var user = firebase.auth().currentUser;
firebase.auth().createUserWithEmailAndPassword(this.email, this.password).catch(function (error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
console.error(error)
// ...
});
user.updateProfile({
displayName: this.name,
photoURL: this.picurl
}).then(function () {
// Update successful.
}).catch(function (error) {
console.error(error)
});
user.updateEmail(this.email).then(function () {
// Update successful.
}).catch(function (error) {
console.error(error)
});
window.location.href = "/";
}
},
})

View File

@ -1,4 +1,4 @@
$(document).ready(function() {
$(document).ready(function () {
refresh();
userinfo();
@ -13,8 +13,8 @@ $(document).ready(function() {
hidden: false
}
});
$(".btn_invite").click(function() {
$(".btn_invite").click(function () {
$.ajax({
type: "POST",
url: "/invite",
@ -25,11 +25,11 @@ $(document).ready(function() {
});
$(document).on("click", ".btn_detail", function() {
$(document).on("click", ".btn_detail", function () {
window.location.replace("/shoppinglist_json/" + $(this).closest("tr").attr("id"));
});
$(".btn_add").click(function() {
$(".btn_add").click(function () {
$.ajax({
type: "POST",
url: "/shoppinglist",
@ -37,19 +37,21 @@ $(document).ready(function() {
name: $(".name").val(),
description: $(".description").val(),
color: "red"
}, success(result) {
},
success(result) {
refresh();
}
});
});
$(document).on("click", ".btn_delete", function() {
$(document).on("click", ".btn_delete", function () {
$.ajax({
type: "DELETE",
url: "/shoppinglist",
data: {
sl_id: $(this).closest("tr").attr("id")
}, success(result) {
},
success(result) {
refresh();
}
});
@ -64,10 +66,10 @@ function refresh() {
type: "GET",
url: "/myshoppinglists",
success(data) {
for(let item of data) {
$(".tb_myshoppinglists").append("<tr id='" + item.sl_id +"'><td>" + item.name + "</td><td>" + item.description +
"</td><td> <a class='btn-floating btn-large waves-effect waves-light red btn_detail'><i class='material-icons'>forward</i></a></td>"
+ "<td><a class='btn-floating btn-large waves-effect waves-light red btn_delete'><i class='material-icons'>clear</i></a></td></tr>");
for (let item of data) {
$(".tb_myshoppinglists").append("<tr id='" + item.sl_id + "'><td>" + item.name + "</td><td>" + item.description +
"</td><td> <a class='btn-floating btn-large waves-effect waves-light red btn_detail'><i class='material-icons'>forward</i></a></td>" +
"<td><a class='btn-floating btn-large waves-effect waves-light red btn_delete'><i class='material-icons'>clear</i></a></td></tr>");
}
}
});
@ -76,9 +78,9 @@ function refresh() {
type: "GET",
url: "/sharedshoppinglists",
success(data) {
for(let item of data) {
$(".tb_sharedshoppinglists").append("<tr id='" + item.sl_id +"'><td>" + item.name + "</td><td>" + item.description +
"</td><td> <a class='btn-floating btn-large waves-effect waves-light red btn_detail'><i class='material-icons'>forward</i></a></td></tr>");
for (let item of data) {
$(".tb_sharedshoppinglists").append("<tr id='" + item.sl_id + "'><td>" + item.name + "</td><td>" + item.description +
"</td><td> <a class='btn-floating btn-large waves-effect waves-light red btn_detail'><i class='material-icons'>forward</i></a></td></tr>");
}
}
});

View File

@ -7,16 +7,18 @@ $(document).ready(function () {
var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.oGetUserMedia || navigator.msGetUserMedia;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.oGetUserMedia || navigator.msGetUserMedia;
if (navigator.getUserMedia) {
navigator.getUserMedia({ video: true }, streamWebcam, throwError);
navigator.getUserMedia({
video: true
}, streamWebcam, throwError);
}
$(".btnsnap").click(function() {
$(".btnsnap").click(function () {
snap();
});
});
function streamWebcam(stream) {

View File

@ -1,12 +1,49 @@
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
/*
*
@ -487,7 +524,13 @@ var Dropzone = function (_Emitter) {
* Allows you to translate the different units. Starting with `tb` for terabytes and going down to
* `b` for bytes.
*/
dictFileSizeUnits: { tb: "TB", gb: "GB", mb: "MB", kb: "KB", b: "b" },
dictFileSizeUnits: {
tb: "TB",
gb: "GB",
mb: "MB",
kb: "KB",
b: "b"
},
/**
* Called when dropzone initialized
* You can add event listeners here
@ -1016,7 +1059,7 @@ var Dropzone = function (_Emitter) {
var _this = _possibleConstructorReturn(this, (Dropzone.__proto__ || Object.getPrototypeOf(Dropzone)).call(this));
var fallback = void 0,
left = void 0;
left = void 0;
_this.element = el;
// For backwards compatibility since the version was in the prototype previously
_this.version = Dropzone.version;
@ -1345,7 +1388,8 @@ var Dropzone = function (_Emitter) {
// "paste": (e) =>
// noPropagation e
// @paste e
} }];
}
}];
this.clickableElements.forEach(function (clickableElement) {
return _this3.listeners.push({
@ -1450,7 +1494,7 @@ var Dropzone = function (_Emitter) {
key: "getFallbackForm",
value: function getFallbackForm() {
var existingFallback = void 0,
form = void 0;
form = void 0;
if (existingFallback = this.getExistingFallback()) {
return existingFallback;
}
@ -1647,8 +1691,8 @@ var Dropzone = function (_Emitter) {
key: "paste",
value: function paste(e) {
if (__guard__(e != null ? e.clipboardData : undefined, function (x) {
return x.items;
}) == null) {
return x.items;
}) == null) {
return;
}
@ -2603,8 +2647,8 @@ var Dropzone = function (_Emitter) {
chunk.total = e.total;
chunk.bytesSent = e.loaded;
var fileProgress = 0,
fileTotal = void 0,
fileBytesSent = void 0;
fileTotal = void 0,
fileBytesSent = void 0;
file.upload.progress = 0;
file.upload.total = 0;
file.upload.bytesSent = 0;
@ -2853,7 +2897,7 @@ var Dropzone = function (_Emitter) {
value: function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0,
v = c === 'x' ? r : r & 0x3 | 0x8;
v = c === 'x' ? r : r & 0x3 | 0x8;
return v.toString(16);
});
}
@ -2986,8 +3030,9 @@ Dropzone.discover = function () {
// incorrectly **
//
Dropzone.blacklistedBrowsers = [
// The mac os and windows phone version of opera 12 seems to have a problem with the File drag'n'drop API.
/opera.*(Macintosh|Windows Phone).*version\/12/i];
// The mac os and windows phone version of opera 12 seems to have a problem with the File drag'n'drop API.
/opera.*(Macintosh|Windows Phone).*version\/12/i
];
// Checks if the browser is supported
Dropzone.isBrowserSupported = function () {
@ -3041,7 +3086,9 @@ Dropzone.dataURItoBlob = function (dataURI) {
}
// write the ArrayBuffer to a blob
return new Blob([ab], { type: mimeString });
return new Blob([ab], {
type: mimeString
});
};
// Returns an array without the rejected item
@ -3095,7 +3142,7 @@ Dropzone.getElement = function (el, name) {
Dropzone.getElements = function (els, name) {
var el = void 0,
elements = void 0;
elements = void 0;
if (els instanceof Array) {
elements = [];
try {
@ -3248,7 +3295,7 @@ var detectVerticalSquash = function detectVerticalSquash(img) {
ctx.drawImage(img, 0, 0);
var _ctx$getImageData = ctx.getImageData(1, 0, 1, ih),
data = _ctx$getImageData.data;
data = _ctx$getImageData.data;
// search image edge pixel position in case it is squashed vertically.
@ -3521,10 +3568,11 @@ contentLoaded(window, Dropzone._autoDiscoverFunction);
function __guard__(value, transform) {
return typeof value !== 'undefined' && value !== null ? transform(value) : undefined;
}
function __guardMethod__(obj, methodName, transform) {
if (typeof obj !== 'undefined' && obj !== null && typeof obj[methodName] === 'function') {
return transform(obj, methodName);
} else {
return undefined;
}
}
}

View File

@ -1,212 +1,262 @@
var id;
$(document).ready(function() {
$(document).ready(function () {
M.AutoInit();
//initialize all modals
$('.modal').modal({
dismissible: false
});
$('.materialboxed').materialbox();
$('.fixed-action-btn').floatingActionButton();
//initialize all modals
$('.modal').modal({
dismissible: false
});
if ($(window).width() > 600) {
//large
$(".col").css("height", "100%");
}
else {
//small
$(".col").css("height", "50%");
}
$("#modal1").modal("open");
$('.materialboxed').materialbox();
$('.fixed-action-btn').floatingActionButton();
$(".btn-analyze").click(function() {
if ($(window).width() > 600) {
//large
$(".col").css("height", "100%");
} else {
//small
$(".col").css("height", "50%");
}
$("#modal1").modal("open");
$(".btn-analyze").click(function () {
analyzeUploaded();
});
//AJAX
// Initialize Firebase
var config = {
apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
authDomain: "test-667ca.firebaseapp.com",
databaseURL: "https://test-667ca.firebaseio.com",
projectId: "test-667ca",
storageBucket: "test-667ca.appspot.com",
messagingSenderId: "221332577314"
};
//AJAX
firebase.initializeApp(config);
// Initialize Firebase
var config = {
apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
authDomain: "test-667ca.firebaseapp.com",
databaseURL: "https://test-667ca.firebaseio.com",
projectId: "test-667ca",
storageBucket: "test-667ca.appspot.com",
messagingSenderId: "221332577314"
};
getAllShoppinglists();
firebase.initializeApp(config);
<<<<<<< HEAD
updateUser();
//testSearch();
function movePurchases(text) {
firebase.auth().onAuthStateChanged(function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
$.ajax({
type: "POST",
url: "/dones",
data:{
idtoken: idtoken,
sl_id: id,
billcontent: text
},
success(result){
console.log(result);
window.location.href = "/dash/" + idtoken
},
error(err){
console.error("Error: " + err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
}
$(".test").click(function() {
//movePurchases();
=======
getAllShoppinglists();
});
>>>>>>> 7926b569500ffc17a4af1ab820cddcb4b5c4e4d9
$(document).on("click", ".btndash", function() {
firebase.auth().onAuthStateChanged(function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
window.location.href = "/dash/" + idtoken
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
});
updateUser();
testSearch();
function analyzeUploaded() {
$("#modalEND").modal("open");
var img = document.getElementById("blah");
Tesseract.recognize(img).progress((progress) => {
if (progress.status == "recognizing text") {
loading = true;
}
}).then((result) => {
loading = false;
console.log(result.text);
movePurchases(result.text);
$(".determinate").css("width", "0%");
});
}
setInterval(updateProgress(), 500);
function updateProgress(percent) {
if(loading == true) {
$(".determinate").css("width", progress.progress * 100 + "%");
function movePurchases(text) {
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
$.ajax({
type: "POST",
url: "/dones",
data: {
idtoken: idtoken,
sl_id: id,
billcontent: text
},
success(result) {
console.log(result);
window.location.href = "/dash/" + idtoken
},
error(err) {
console.error("Error: " + err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
}
}
function updateUser() {
firebase.auth().onAuthStateChanged(function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
$.ajax({
type: "POST",
url: "/user",
data:{
idtoken: idtoken,
message_id: "msgtest"
},
success(){
console.log("USer updated");
},
error(err){
console.error("Error: " + err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
}
function testSearch() {
console.log("dpne");
$.ajax({
type: "DELETE",
url: "/member",
data: {
sl_id: "PDADo1iJ",
uid: "VZT25Xd3rLXEmGGUcrtocbJ9QBu2"
},
success(data) {
console.log(data);
},
error(err) {
console.error(err);
}
$(".test").click(function () {
//movePurchases();
getAllShoppinglists();
});
}
function getAllShoppinglists() {
firebase.auth().onAuthStateChanged(function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
$.ajax({
type: "GET",
url: "/myshoppinglists",
data:{
idtoken: idtoken,
},
success(data){
$(".preloader-wrapper").css("display", "none");
for(let item of data) {
$(".output").append("<a id='" + item.sl_id +"' class='collection-item'>" + item.name + "</a>")
}
},
error(err){
console.error("Error: " + err);
$(document).on("click", ".btndash", function () {
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
window.location.href = "/dash/" + idtoken
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
}).catch((error) => console.error("Get id token client error: ", error));}else{console.log("Check Auth error", user)}});
}
});
$(document).on("click", ".collection-item", function() {
id = $(this).closest("a").attr("id");
function analyzeUploaded() {
$(".active").removeClass("active");
$("#modalEND").modal("open");
$(this).addClass("active");
});
var img = document.getElementById("blah");
$(".btncont").click(function() {
run([{y:100}, {y:0}], $(".r1"));
});
Tesseract.recognize(img).progress((progress) => {
function run(v, elem){
//Reverse the array
var reversed = JSON.parse(JSON.stringify(v)).reverse();
$(v[0]).animate(v[1], {
//The speed the element moves - lower is faster
duration: 500,
step: function(val) {
//Adding the transform to your element
elem.css("transform", `translateY(${val}%)`);
if (progress.status == "recognizing text") {
loading = true;
}
}).then((result) => {
loading = false;
console.log(result.text);
movePurchases(result.text);
$(".determinate").css("width", "0%");
});
}
setInterval(updateProgress(), 500);
function updateProgress(percent) {
if (loading == true) {
$(".determinate").css("width", progress.progress * 100 + "%");
}
})
};
$(".opt1").click(function() {
run([{y:0}, {y:-100}], $(".r1"))
}
run([{y:0}, {y:-100}], $(".r2"));
//$("#modal2").modal("open");
});
function updateUser() {
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
$.ajax({
type: "POST",
url: "/user",
data: {
idtoken: idtoken,
message_id: "msgtest"
},
success() {
console.log("USer updated");
},
error(err) {
console.error("Error: " + err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
}
$(".opt2").click(function() {
// $('.row').animate({'margin-top': '-100%'}, 1000);
});
function testSearch() {
console.log("dpne");
$.ajax({
type: "DELETE",
url: "/member",
data: {
sl_id: "PDADo1iJ",
uid: "VZT25Xd3rLXEmGGUcrtocbJ9QBu2"
},
success(data) {
console.log(data);
},
error(err) {
console.error(err);
}
});
}
function getAllShoppinglists() {
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
$.ajax({
type: "GET",
url: "/myshoppinglists",
data: {
idtoken: idtoken,
},
success(data) {
$(".preloader-wrapper").css("display", "none");
for (let item of data) {
$(".output").append("<a id='" + item.sl_id + "' class='collection-item'>" + item.name + "</a>")
}
},
error(err) {
console.error("Error: " + err);
}
});
}).catch((error) => console.error("Get id token client error: ", error));
} else {
console.log("Check Auth error", user)
}
});
}
$(document).on("click", ".collection-item", function () {
id = $(this).closest("a").attr("id");
$(".active").removeClass("active");
$(this).addClass("active");
});
$(".btncont").click(function () {
run([{
y: 100
}, {
y: 0
}], $(".r1"));
});
/*$.ajax({
type: "POST",
url : "/movedoneitem",
data : {
sl_id : 'hcMssjPd',
group_id: 'hcMssjPd',
item_id: 'EHmY4ymD'
}
})*/
function run(v, elem) {
//Reverse the array
var reversed = JSON.parse(JSON.stringify(v)).reverse();
$(v[0]).animate(v[1], {
//The speed the element moves - lower is faster
duration: 500,
step: function (val) {
//Adding the transform to your element
elem.css("transform", `translateY(${val}%)`);
}
})
};
$(".opt1").click(function () {
run([{
y: 0
}, {
y: -100
}], $(".r1"))
run([{
y: 0
}, {
y: -100
}], $(".r2"));
//$("#modal2").modal("open");
});
$(".opt2").click(function () {
// $('.row').animate({'margin-top': '-100%'}, 1000);
});
});
@ -228,5 +278,4 @@ var loading = false;
$(".determinate").css("width", "0%");
});
}
*/
*/

View File

@ -22,14 +22,14 @@
.trash{
background: transparent;
position:absolute;
right: 29px;
right: 5px;
margin-top:-7px;
}
.edit{
background: transparent;
position: absolute;
right: 60px;
right: 29px;
margin-top:-7px;
}
@ -47,7 +47,8 @@
.itemadd{
background: transparent;
position: absolute;
right:5px;
right:47px;
margin-top:-40px;
border: 0px;
}
.seemore{
@ -69,7 +70,7 @@
.trashgroup{
background: transparent;
position: absolute;
right:23px;
right:25px;
margin-top:-40px;
}