Remove extra console logging and improve what's left behind, fix map reload errors

master
Skylar Ittner 4 years ago
parent 91e31c449e
commit a0cbb0dbe5

@ -112,12 +112,12 @@ function searchAutofillByStreet(q) {
return b[1] - a[1];
});
console.log(sortedDB);
//console.log(sortedDB);
q = q.toLowerCase();
for (var i = 0; i < sortedDB.length; i++) {
console.log(sortedDB[i][0].toLowerCase().indexOf(q));
//console.log(sortedDB[i][0].toLowerCase().indexOf(q));
if (sortedDB[i][0].toLowerCase().includes(q)) {
streets.push(sortedDB[i][0]);
}

@ -16,7 +16,7 @@ $(".view-main").on("click", "#addresslist .package-list-item .directions-btn", f
});
$(".view-main").on("swipeout:delete", "#addresslist .package-list-item", function () {
console.log("Deleting package", $(this).data("packageid"));
console.log("Info", "Deleting package", $(this).data("packageid"));
deletePackage($(this).data("packageid"));
});
@ -62,8 +62,8 @@ function loadPackageList(sortType) {
var anum = parseInt(a.value.address.split(" ", 1)[0], 10);
var bnum = parseInt(b.value.address.split(" ", 1)[0], 10);
console.log("aalpha", aalpha);
console.log("balpha", balpha);
//console.log("aalpha", aalpha);
//console.log("balpha", balpha);
switch (sortType) {
case "alpha_desc":
if (aalpha > balpha) {

@ -49,7 +49,7 @@ if ("geolocation" in navigator) {
var currentTimestamp = Math.floor(Date.now() / 1000);
if (lastGpsUpdateTimestamp < (currentTimestamp - 10)) {
updateDistances(position.coords.latitude, position.coords.longitude);
var alertinterval = localStorage.getItem("alertinterval");
if (alertinterval == null) {
alertinterval = 30;
@ -100,7 +100,7 @@ if ("geolocation" in navigator) {
});
} else {
geoerrorcount++;
console.log("Geolocation error #" + geoerrorcount + ": ", error);
console.log("Warn", "Geolocation error #" + geoerrorcount + ": ", error);
// Stop showing error toasts if they're happening a lot
if (geoerrorcount <= 3) {
app.toast.show({
@ -172,7 +172,7 @@ function getDistance(lat1, lon1, lat2, lon2) {
* Respects user "units" setting ("metric" or "imperial").
* @param number meters
* @param bool space Add a space between number and units. Default true.
* @returns string "1000 ft", "2 mi", "3 km",
* @returns string "1000 ft", "2 mi", "3 km",
*/
function getDisplayDistance(meters, space) {
if (typeof space == 'undefined') {

@ -63,10 +63,7 @@ router.on("pageInit", function (pagedata) {
});
router.on("routeChange", function (newRoute) {
console.log(newRoute);
if (newRoute == "home") {
router.refreshPage();
}
console.log("Info", "Navigating to ", newRoute.path);
});
// Set alert radius to 100 meters by default

@ -66,9 +66,9 @@ $("#addpackagebtn").click(function () {
$(".view-main").off("click", "#historylist .history-list-item");
$(".view-main").on("click", "#historylist .history-list-item", function () {
console.log("Asking to delete ", $(this).data("package"));
console.log("Info", "Asking to delete ", $(this).data("package"));
confirmDeletePackage(getPackage($(this).data("package")), function (id) {
console.log("Removing history item", id);
console.log("Info", "Removing history item", id);
$('#historylist .history-list-item[data-package="' + id + '"]').remove();
if ($('#historylist .history-list-item').length == 0) {
$("#no-history").removeClass("display-none");

@ -17,7 +17,7 @@ function createMap() {
if (mapboxgl.supported()) {
map = mapboxMap();
} else {
console.log("Warning: mapbox-gl not supported, falling back to Leaflet");
console.log("Warn", "mapbox-gl not supported, falling back to Leaflet");
maptype = "leaflet";
map = leafletMap();
}
@ -44,17 +44,22 @@ function reloadMap() {
map.off();
map.remove();
map = null;
createMap();
if (map.maptype == "mapbox") {
map.jumpTo({
center: mapcenter,
zoom: mapzoom,
bearing: mapbearing,
pitch: mappitch
});
if (document.getElementById("mapbox") != null) {
createMap();
if (map.maptype == "mapbox") {
map.jumpTo({
center: mapcenter,
zoom: mapzoom,
bearing: mapbearing,
pitch: mappitch
});
} else {
map.setView(mapcenter, mapzoom);
}
} else {
map.setView(mapcenter, mapzoom);
console.log("Info", "Not re-creating map because #mapbox is not in DOM. Creation will be automatically triggered when map page is loaded.");
}
} else {
createMap();
@ -80,12 +85,12 @@ function openPackageInfoSheet(coordid, refreshOnly) {
refreshOnly = false;
}
console.log("Packages array: ", packages);
//console.log("Packages array: ", packages);
for (var i = 0; i < packages.length; i++) {
if (packages[i].id == coordid) {
package = packages[i];
console.log("Single Address:", package);
//console.log("Single Address:", package);
$("#package-info-get-directions").attr("href", "geo:" + package.coords[0] + "," + package.coords[1]);
$("#package-info-sheet-inner .list ul").html("");

@ -67,7 +67,7 @@ function leafletMap() {
map.updatePackageLayer = function (data) {
map.packagelayer.clearLayers();
console.log(data);
//console.log(data);
for (var i = 0; i < data.length; i++) {
// JavaScript variable scope and anonymous functions are dumb
@ -75,7 +75,7 @@ function leafletMap() {
// of the loop, or something like that
(function (datai) {
var iconName = getMapIconForItems(datai.items);
console.log(iconName);
//console.log(iconName);
var icon = L.icon({
iconUrl: "assets/images/" + iconName + ".png",

@ -91,7 +91,7 @@ function mapboxMap() {
// of the loop, or something like that
(function (datai) {
var iconName = getMapIconForItems(datai.items);
console.log(iconName);
//console.log(iconName);
var el = document.createElement("div");
el.className = "package-marker";

@ -65,16 +65,16 @@ function getMapIconForItems(items) {
// Count how many types we have, and set/overwrite the icon assuming we
// only have that type. If we end up with multiple types, we return that
// icon instead of a specific one.
console.log(types);
//console.log(types);
for (var type in types) {
console.log(type);
//console.log(type);
item_types++;
if (types[type] == 1) {
icon = SETTINGS.itemtypes[type].mapicon;
} else {
icon = SETTINGS.itemtypes[type].pluralmapicon;
}
console.log(icon);
//console.log(icon);
}
if (item_types > 1) {
return "multiple-items";

@ -71,7 +71,7 @@ function setupHTML5BarcodeScanner() {
$("#web-barcode-ui").removeClass("hidden");
// Stolen from https://zxing-js.github.io/library/examples/multi-camera/
const codeReader = new ZXing.BrowserMultiFormatReader();
console.log('ZXing code reader initialized');
console.log("Info", 'ZXing code reader initialized');
codeReader.getVideoInputDevices()
.then((videoInputDevices) => {
if (videoInputDevices.length == 0) {
@ -84,7 +84,6 @@ function setupHTML5BarcodeScanner() {
codeReader.decodeFromInputVideoDeviceContinuously(selectedDeviceId, 'barcode-viewer', (result, err) => {
if (result) {
console.log(result);
codeReader.reset();
$("#web-barcode-ui").addClass("hidden");
success(result.text);
@ -123,15 +122,15 @@ function initCordova() {
document.addEventListener("deviceready", function () {
if (localStorage.getItem("wakelock") == "true") {
window.powerManagement.acquire(function () {
console.log('Wakelock acquired');
console.log("Info", 'Wakelock acquired');
}, function () {
console.log('Failed to acquire wakelock');
console.log("Warn", 'Failed to acquire wakelock');
});
} else {
window.powerManagement.release(function () {
console.log('Wakelock released');
console.log("Info", 'Wakelock released');
}, function () {
console.log('Failed to release wakelock');
console.log("Warn", 'Failed to release wakelock');
});
}
}, false);

Loading…
Cancel
Save