OCR Scan Design (fast) fertig und funktioniert

This commit is contained in:
LukasNowy
2019-01-29 16:55:05 +01:00
parent 65ed6c932c
commit ea512efee4
4 changed files with 103 additions and 16 deletions

View File

@ -23,7 +23,7 @@ $(document).ready(function() {
$("#modal1").modal("open");
$(".btnanalyze").click(function() {
$(".btn-analyze").click(function() {
analyzeUploaded();
});
@ -55,6 +55,7 @@ function movePurchases(text) {
},
success(result){
console.log(result);
alert("Done");
},
error(err){
console.error("Error: " + err);
@ -68,6 +69,12 @@ $(".test").click(function() {
getAllShoppinglists();
});
$(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)}});
});
function analyzeUploaded() {
var img = document.getElementById("blah");
@ -78,8 +85,7 @@ function analyzeUploaded() {
}
}).then((result) => {
loading = false;
$(".output").text(result.text);
$('#modal1').modal("open");
console.log(result.text);
movePurchases(result.text);
$(".determinate").css("width", "0%");
});
@ -124,12 +130,28 @@ $(document).on("click", ".collection-item", function() {
});
$(".btncont").click(function() {
$('.r1').animate({'margin-top': '0'}, 1000);
run([{y:100}, {y:0}], $(".r1"));
});
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() {
$('.r1').animate({'margin-top': '-100%'}, 1000);
$(".r2").css("display", "block");
run([{y:0}, {y:-100}], $(".r1"))
run([{y:0}, {y:-100}], $(".r2"));
//$("#modal2").modal("open");
});
$(".opt2").click(function() {