correction bug in https://github.com/mcguirepr89/BirdNET-Pi/pull/898
This commit is contained in:
@@ -506,6 +506,7 @@ function generateMiniGraph(elem, comname) {
|
|||||||
// Create a div element for the chart window
|
// Create a div element for the chart window
|
||||||
if (typeof(window.chartWindow) != 'undefined') {
|
if (typeof(window.chartWindow) != 'undefined') {
|
||||||
document.body.removeChild(window.chartWindow);
|
document.body.removeChild(window.chartWindow);
|
||||||
|
window.chartWindow = undefined;
|
||||||
}
|
}
|
||||||
var chartWindow = document.createElement('div');
|
var chartWindow = document.createElement('div');
|
||||||
chartWindow.className = "chartdiv"
|
chartWindow.className = "chartdiv"
|
||||||
@@ -615,6 +616,7 @@ function generateMiniGraph(elem, comname) {
|
|||||||
closeButton.style.right = '5px';
|
closeButton.style.right = '5px';
|
||||||
closeButton.addEventListener('click', function() {
|
closeButton.addEventListener('click', function() {
|
||||||
document.body.removeChild(chartWindow);
|
document.body.removeChild(chartWindow);
|
||||||
|
window.chartWindow = undefined;
|
||||||
});
|
});
|
||||||
chartWindow.appendChild(closeButton);
|
chartWindow.appendChild(closeButton);
|
||||||
window.chartWindow = chartWindow;
|
window.chartWindow = chartWindow;
|
||||||
@@ -631,6 +633,7 @@ window.addEventListener('scroll', function() {
|
|||||||
// Loop through all chart elements and remove them
|
// Loop through all chart elements and remove them
|
||||||
charts.forEach(function(chart) {
|
charts.forEach(function(chart) {
|
||||||
chart.parentNode.removeChild(chart);
|
chart.parentNode.removeChild(chart);
|
||||||
|
window.chartWindow = undefined;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user