Skip to content

Instantly share code, notes, and snippets.

View magyarmelinda's full-sized avatar

Magyar Melinda Barbara magyarmelinda

View GitHub Profile
function scanBarcode() {
cordova.plugins.barcodeScanner.scan(
function (result) {
document.getElementById("product-code").value = result.text;
getProductInfoWithYahoo(result.text);
},
function (error) {
alert("Scanning failed: " + error);
},
{
// Set options for camera
function setOptions(srcType) {
const options = {
quality: 50,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: srcType,
encodingType: Camera.EncodingType.JPEG,
mediaType: Camera.MediaType.PICTURE,
allowEdit: false,
correctOrientation: true,
// Gives back the current location & adds a marker to the map
// onSuccess callback accepts a Position object, which contains the current coordinates
// onError callback receives a PositionError object
function currentLocation(map) {
navigator.geolocation.getCurrentPosition(function (position) {
onSuccess(map, position);
document.getElementById("shop-location").value = position.coords.latitude + " " + position.coords.longitude;
}, onError);
}
// Add new items to the Shop List
function addNewShopToFirebase(jsonObject) {
db.collection('shops').add({
'name': jsonObject.name,
'telephone': jsonObject.telephone,
'address': jsonObject.address,
'location': jsonObject.location
});
}
let db = null;
let useDatabaseApi = false;
// Firebase configuration and initialization
const initFirebase = () => {
// You can copy-paste the whole firebase Config function from the
// Firebase Project Preview Settings, after you set up the project
const firebaseConfig = {
apiKey: "PUT_YOUR_KEY_HERE",
authDomain: "YOUR_AUTH_DOMAIN",
#panel-header {
text-align: left !important;
width: 100%;
}
.card-bg {
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}
// Go to a folder where you want to create your project
// Then enter the following command:
monaca create projectname
// Choose JavaScript from the list and press Enter
// After that, choose the Framework7 Core Tab View from the list and press Enter again
// If the installation process is finished, your project is ready to go