fix things, some things should work

This commit is contained in:
2024-09-15 21:21:39 -04:00
parent 646bdd32b5
commit f087478736
37 changed files with 9965 additions and 9965 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 692 KiB

After

Width:  |  Height:  |  Size: 696 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 142 KiB

+4700 -4700
View File
File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 829 KiB

After

Width:  |  Height:  |  Size: 834 KiB

File diff suppressed because one or more lines are too long
+7 -7
View File
@@ -1,8 +1,8 @@
document.addEventListener('DOMContentLoaded', function() {
var charts = document.querySelectorAll('[data-bss-chart]');
for (var chart of charts) {
chart.chart = new Chart(chart, JSON.parse(chart.dataset.bssChart));
}
document.addEventListener('DOMContentLoaded', function() {
var charts = document.querySelectorAll('[data-bss-chart]');
for (var chart of charts) {
chart.chart = new Chart(chart, JSON.parse(chart.dataset.bssChart));
}
}, false);
+7 -7
View File
File diff suppressed because one or more lines are too long
+76 -76
View File
@@ -1,76 +1,76 @@
(function() {
"use strict"; // Start of use strict
var sidebar = document.querySelector('.sidebar');
var sidebarToggles = document.querySelectorAll('#sidebarToggle, #sidebarToggleTop');
if (sidebar) {
var collapseEl = sidebar.querySelector('.collapse');
var collapseElementList = [].slice.call(document.querySelectorAll('.sidebar .collapse'))
var sidebarCollapseList = collapseElementList.map(function (collapseEl) {
return new bootstrap.Collapse(collapseEl, { toggle: false });
});
for (var toggle of sidebarToggles) {
// Toggle the side navigation
toggle.addEventListener('click', function(e) {
document.body.classList.toggle('sidebar-toggled');
sidebar.classList.toggle('toggled');
if (sidebar.classList.contains('toggled')) {
for (var bsCollapse of sidebarCollapseList) {
bsCollapse.hide();
}
};
});
}
// Close any open menu accordions when window is resized below 768px
window.addEventListener('resize', function() {
var vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
if (vw < 768) {
for (var bsCollapse of sidebarCollapseList) {
bsCollapse.hide();
}
};
});
}
// Prevent the content wrapper from scrolling when the fixed side navigation hovered over
var fixedNaigation = document.querySelector('body.fixed-nav .sidebar');
if (fixedNaigation) {
fixedNaigation.on('mousewheel DOMMouseScroll wheel', function(e) {
var vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
if (vw > 768) {
var e0 = e.originalEvent,
delta = e0.wheelDelta || -e0.detail;
this.scrollTop += (delta < 0 ? 1 : -1) * 30;
e.preventDefault();
}
});
}
var scrollToTop = document.querySelector('.scroll-to-top');
if (scrollToTop) {
// Scroll to top button appear
window.addEventListener('scroll', function() {
var scrollDistance = window.pageYOffset;
//check if user is scrolling up
if (scrollDistance > 100) {
scrollToTop.style.display = 'block';
} else {
scrollToTop.style.display = 'none';
}
});
}
})(); // End of use strict
(function() {
"use strict"; // Start of use strict
var sidebar = document.querySelector('.sidebar');
var sidebarToggles = document.querySelectorAll('#sidebarToggle, #sidebarToggleTop');
if (sidebar) {
var collapseEl = sidebar.querySelector('.collapse');
var collapseElementList = [].slice.call(document.querySelectorAll('.sidebar .collapse'))
var sidebarCollapseList = collapseElementList.map(function (collapseEl) {
return new bootstrap.Collapse(collapseEl, { toggle: false });
});
for (var toggle of sidebarToggles) {
// Toggle the side navigation
toggle.addEventListener('click', function(e) {
document.body.classList.toggle('sidebar-toggled');
sidebar.classList.toggle('toggled');
if (sidebar.classList.contains('toggled')) {
for (var bsCollapse of sidebarCollapseList) {
bsCollapse.hide();
}
};
});
}
// Close any open menu accordions when window is resized below 768px
window.addEventListener('resize', function() {
var vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
if (vw < 768) {
for (var bsCollapse of sidebarCollapseList) {
bsCollapse.hide();
}
};
});
}
// Prevent the content wrapper from scrolling when the fixed side navigation hovered over
var fixedNaigation = document.querySelector('body.fixed-nav .sidebar');
if (fixedNaigation) {
fixedNaigation.on('mousewheel DOMMouseScroll wheel', function(e) {
var vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
if (vw > 768) {
var e0 = e.originalEvent,
delta = e0.wheelDelta || -e0.detail;
this.scrollTop += (delta < 0 ? 1 : -1) * 30;
e.preventDefault();
}
});
}
var scrollToTop = document.querySelector('.scroll-to-top');
if (scrollToTop) {
// Scroll to top button appear
window.addEventListener('scroll', function() {
var scrollDistance = window.pageYOffset;
//check if user is scrolling up
if (scrollDistance > 100) {
scrollToTop.style.display = 'block';
} else {
scrollToTop.style.display = 'none';
}
});
}
})(); // End of use strict
+104 -104
View File
@@ -1,105 +1,105 @@
const socket = io();
// map
var map = L.map('map').setView([48.505, -0.09], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.marker([51.5, -0.09]).addTo(map)
.bindPopup('your car... soon(tm)')
.openPopup();
// charts
const ctx = document.getElementById('speedGraph').getContext('2d');
chart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
label: 'Vehicle speed',
borderColor: 'rgba(75, 192, 192, 1)',
fill: false,
}]
},
options: {
responsive: true,
scales: {
x: {
reverse: true,
title: {
display: true,
text: 'Time',
}
},
y: {
title: {
display: true,
text: 'Speed'
}
}
}
}
});
// websockets
socket.on('connect', function(data) {
console.log('socket.io is connected')
});
socket.on('obd_status', function(data) {
console.log(data);
const status = document.getElementById('obd-status');
status.innerHTML = data;
});
socket.on('obd_speed', function(data) {
const time = data[0]; // Assuming data[0] is the time value
const speed = data[1]; // Assuming data[1] is the speed value
const maxDataPoints = 8; // Adjust this value as needed
const status = document.getElementById('obd-speed');
status.innerHTML = speed;
// Get a reference to the chart's data
const chartData = chart.data.datasets[0].data;
// Unshift the new data points to the beginning of the chart dataset
chartData.unshift({ x: time, y: speed });
// Remove data points if the number of data points exceeds maxDataPoints
while (chartData.length > maxDataPoints) {
chartData.pop(); // Remove the oldest data point from the end
}
// Update the chart
chart.update();
});
socket.on('obd_rpm', function(data) {
console.log("obd rpm "+data);
const status = document.getElementById('obd-rpm');
status.innerHTML = data;
});
socket.on('obd_error', function(data) {
console.log("obd errors "+data);
const status = document.getElementById('obd-error');
status.innerHTML = data;
});
socket.on('rpi_uptime', function(data) {
const status = document.getElementById('rpi-uptime');
status.innerHTML = data;
});
socket.on('gps_location', function(data) {
console.log("location received")
const LocationX = document.getElementById('gpsLocationX');
const LocationY = document.getElementById('gpsLocationY');
LocationX.innerHTML = data[0];
LocationY.innerHTML = data[1];
const socket = io();
// map
var map = L.map('map').setView([48.505, -0.09], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.marker([51.5, -0.09]).addTo(map)
.bindPopup('your car... soon(tm)')
.openPopup();
// charts
const ctx = document.getElementById('speedGraph').getContext('2d');
chart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
label: 'Vehicle speed',
borderColor: 'rgba(75, 192, 192, 1)',
fill: false,
}]
},
options: {
responsive: true,
scales: {
x: {
reverse: true,
title: {
display: true,
text: 'Time',
}
},
y: {
title: {
display: true,
text: 'Speed'
}
}
}
}
});
// websockets
socket.on('connect', function(data) {
console.log('socket.io is connected')
});
socket.on('obd_status', function(data) {
console.log(data);
const status = document.getElementById('obd-status');
status.innerHTML = data;
});
socket.on('obd_speed', function(data) {
const time = data[0]; // Assuming data[0] is the time value
const speed = data[1]; // Assuming data[1] is the speed value
const maxDataPoints = 8; // Adjust this value as needed
const status = document.getElementById('obd-speed');
status.innerHTML = speed;
// Get a reference to the chart's data
const chartData = chart.data.datasets[0].data;
// Unshift the new data points to the beginning of the chart dataset
chartData.unshift({ x: time, y: speed });
// Remove data points if the number of data points exceeds maxDataPoints
while (chartData.length > maxDataPoints) {
chartData.pop(); // Remove the oldest data point from the end
}
// Update the chart
chart.update();
});
socket.on('obd_rpm', function(data) {
console.log("obd rpm "+data);
const status = document.getElementById('obd-rpm');
status.innerHTML = data;
});
socket.on('obd_error', function(data) {
console.log("obd errors "+data);
const status = document.getElementById('obd-error');
status.innerHTML = data;
});
socket.on('rpi_uptime', function(data) {
const status = document.getElementById('rpi-uptime');
status.innerHTML = data;
});
socket.on('gps_location', function(data) {
console.log("location received")
const LocationX = document.getElementById('gpsLocationX');
const LocationY = document.getElementById('gpsLocationY');
LocationX.innerHTML = data[0];
LocationY.innerHTML = data[1];
});