ocr
This commit is contained in:
		@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@@ -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%");
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
		Reference in New Issue
	
	Block a user