done purchases remove, ocr scan, read image
This commit is contained in:
		
							
								
								
									
										3530
									
								
								express-server/public/ocrscan/dropzone.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3530
									
								
								express-server/public/ocrscan/dropzone.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										12
									
								
								express-server/public/ocrscan/fileuploads.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								express-server/public/ocrscan/fileuploads.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
function readURL(input) {
 | 
			
		||||
    if (input.files && input.files[0]) {
 | 
			
		||||
        var reader = new FileReader();
 | 
			
		||||
 | 
			
		||||
        reader.onload = function (e) {
 | 
			
		||||
            $('#blah')
 | 
			
		||||
                .attr('src', e.target.result).attr('width', "650px")
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        reader.readAsDataURL(input.files[0]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
$(document).ready(function() {
 | 
			
		||||
 | 
			
		||||
        //initialize all modals           
 | 
			
		||||
        $('.modal').modal();
 | 
			
		||||
        $('.materialboxed').materialbox();
 | 
			
		||||
 | 
			
		||||
    $(".btnanalyze").click(function() {
 | 
			
		||||
        analyze();
 | 
			
		||||
        analyzeUploaded();
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@@ -27,6 +27,23 @@ function analyze() {
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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) {
 | 
			
		||||
@@ -34,4 +51,43 @@ function updateProgress(percent) {
 | 
			
		||||
        $(".determinate").css("width", progress.progress * 100 + "%");
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//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"
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  firebase.initializeApp(config);
 | 
			
		||||
 | 
			
		||||
function movePurchases() {
 | 
			
		||||
    firebase.auth().onAuthStateChanged(function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
 | 
			
		||||
        $.ajax({
 | 
			
		||||
            type: "POST",
 | 
			
		||||
            url: "/donepurchases",
 | 
			
		||||
            data:{
 | 
			
		||||
                idtoken: idtoken,
 | 
			
		||||
                sl_id: "BplQ5lFU",
 | 
			
		||||
                billcontent: "fsfs"
 | 
			
		||||
            },
 | 
			
		||||
            success(result){
 | 
			
		||||
              console.log(result);
 | 
			
		||||
            },
 | 
			
		||||
            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();
 | 
			
		||||
})
 | 
			
		||||
@@ -1,12 +1,8 @@
 | 
			
		||||
body {
 | 
			
		||||
    background-color: #fafafa;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.cont1 {
 | 
			
		||||
    background-color: #424242;
 | 
			
		||||
    margin-top: 1em;
 | 
			
		||||
    padding-top: 10px;
 | 
			
		||||
}
 | 
			
		||||
html, body {
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    background-color: #90caf9;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
#video {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
@@ -14,4 +10,27 @@ body {
 | 
			
		||||
 | 
			
		||||
#canvas {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.cont {
 | 
			
		||||
    margin-top: 3%;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    border-radius: 30px;
 | 
			
		||||
    background-color: rgb(44, 44, 44);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.opt1 {
 | 
			
		||||
    background-color: rgb(44, 44, 44);
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    border-radius: 30px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.opt2 {
 | 
			
		||||
    background-color: rgb(44, 44, 44);
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    border-radius: 30px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.blah {
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user