This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#panel-header { | |
text-align: left !important; | |
width: 100%; | |
} | |
.card-bg { | |
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scanBarcode() { | |
cordova.plugins.barcodeScanner.scan( | |
function (result) { | |
document.getElementById("product-code").value = result.text; | |
getProductInfoWithYahoo(result.text); | |
}, | |
function (error) { | |
alert("Scanning failed: " + error); | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getProductInfoWithYahoo = (barcode) => { | |
try { | |
cordova.plugin.http.get('https://shopping.yahooapis.jp/ShoppingWebService/V3/itemSearch', { | |
appid: yahooApiKey, | |
jan_code: barcode | |
}, {}, function (response) { | |
const data = JSON.parse(response.data); | |
if (data && data.hits && data.hits.length) { | |
document.getElementById("product-name").value = data.hits[0].name; | |
document.getElementById("product-price").value = "¥" + data.hits[0].price; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let map = null; | |
//For the edit-shop page, the map needs a different name | |
if (!map) map = L.map('newShopMap', {doubleClickZoom: false}).locate({setView: true, maxZoom: 12}); | |
map.setView([35.40, 139.50], 12); | |
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | |
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' | |
}).addTo(map); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let onSuccess = function (map, p) { | |
L.marker([p.coords.latitude, p.coords.longitude]) | |
.addTo(map) | |
.bindPopup("Your current location.") | |
.openPopup(); | |
map.setView([p.coords.latitude, p.coords.longitude], 14); | |
}; |
OlderNewer