ocr update
This commit is contained in:
parent
1579c199c3
commit
c8fe9b045a
@ -28,7 +28,7 @@ function movePurchases() {
|
||||
firebase.auth().onAuthStateChanged(function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/donepurchases",
|
||||
url: "/dones",
|
||||
data:{
|
||||
idtoken: idtoken,
|
||||
sl_id: "BplQ5lFU",
|
||||
@ -47,11 +47,38 @@ function movePurchases() {
|
||||
$(".test").click(function() {
|
||||
movePurchases();
|
||||
});
|
||||
|
||||
function analyzeUploaded() {
|
||||
var img = document.getElementById("blah");
|
||||
|
||||
Tesseract.recognize(img).progress((progress) => {
|
||||
|
||||
if (progress.status == "recognizing text") {
|
||||
loading = true;
|
||||
}
|
||||
}).then((result) => {
|
||||
loading = false;
|
||||
$(".output").text(result.text);
|
||||
$('#modal1').modal("open");
|
||||
movePurchases();
|
||||
$(".determinate").css("width", "0%");
|
||||
});
|
||||
}
|
||||
|
||||
setInterval(updateProgress(), 500);
|
||||
|
||||
function updateProgress(percent) {
|
||||
if(loading == true) {
|
||||
$(".determinate").css("width", progress.progress * 100 + "%");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var loading = false;
|
||||
|
||||
function analyze() {
|
||||
/*function analyze() {
|
||||
var img = document.getElementById("canvas").toDataURL();
|
||||
|
||||
Tesseract.recognize(img).progress((progress) => {
|
||||
@ -67,29 +94,4 @@ function analyze() {
|
||||
$(".determinate").css("width", "0%");
|
||||
});
|
||||
}
|
||||
|
||||
function analyzeUploaded() {
|
||||
var img = document.getElementById("blah");
|
||||
|
||||
Tesseract.recognize(img).progress((progress) => {
|
||||
|
||||
if (progress.status == "recognizing text") {
|
||||
loading = true;
|
||||
}
|
||||
}).then((result) => {
|
||||
loading = false;
|
||||
$(".output").text(result.text);
|
||||
$('#modal1').modal("open");
|
||||
|
||||
$(".determinate").css("width", "0%");
|
||||
});
|
||||
}
|
||||
|
||||
setInterval(updateProgress(), 500);
|
||||
|
||||
function updateProgress(percent) {
|
||||
if(loading == true) {
|
||||
$(".determinate").css("width", progress.progress * 100 + "%");
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
@ -428,4 +428,27 @@ router.get("/scan/", async (req, res,) => {
|
||||
res.render("ocrscan");
|
||||
});
|
||||
|
||||
|
||||
router.post("/dones", async function(req, res, next) {
|
||||
console.log("/shoppinglist idtoken: ", req.body.idtoken)
|
||||
var token = req.body.idtoken;
|
||||
|
||||
var uid;
|
||||
firebaseAdmin.auth().verifyIdToken(token)
|
||||
.then(async function(decodedToken) {
|
||||
uid = decodedToken.uid;
|
||||
console.log("UID: ", uid);
|
||||
console.log("So andere sachen: ", req.body.name, req.body.description);
|
||||
try {
|
||||
|
||||
res.status(200).send("Done");
|
||||
}
|
||||
|
||||
catch(err) {
|
||||
res.status(400).send(await err);
|
||||
}
|
||||
}).catch(function(error) {
|
||||
console.log(error)
|
||||
});
|
||||
});
|
||||
module.exports = router;
|
||||
|
@ -36,6 +36,11 @@
|
||||
<div class="progress grey lighten-1">
|
||||
<div class="determinate green accent-4" style="width: 0%"></div>
|
||||
</div>
|
||||
|
||||
<ul class="collection with-header">
|
||||
<li class="collection-header"><h4>Choose List</h4></li>
|
||||
<li class="collection-item"><div>Test<a class="secondary-content"><i class="material-icons">send</i></a></div></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user