Merge pull request #898 from croisez/main
Removing DetectionsPanel if already present, before displaying a new one
This commit is contained in:
+2
-2
@@ -26,7 +26,7 @@ iframe {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
height: 93%;
|
||||
height: 90%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -836,4 +836,4 @@ pre#timer.bash {
|
||||
|
||||
#ddnewline::before {
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,6 +495,7 @@ window.setInterval(function(){
|
||||
</style>
|
||||
<script>
|
||||
function generateMiniGraph(elem, comname) {
|
||||
|
||||
// Make an AJAX call to fetch the number of detections for the bird species
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', '/todays_detections.php?comname=' + comname);
|
||||
@@ -502,9 +503,10 @@ function generateMiniGraph(elem, comname) {
|
||||
if (xhr.status === 200) {
|
||||
var detections = JSON.parse(xhr.responseText);
|
||||
|
||||
console.log(detections)
|
||||
|
||||
// Create a div element for the chart window
|
||||
if (typeof(window.chartWindow) != 'undefined') {
|
||||
document.body.removeChild(window.chartWindow);
|
||||
}
|
||||
var chartWindow = document.createElement('div');
|
||||
chartWindow.className = "chartdiv"
|
||||
chartWindow.style.position = 'fixed';
|
||||
@@ -615,6 +617,7 @@ function generateMiniGraph(elem, comname) {
|
||||
document.body.removeChild(chartWindow);
|
||||
});
|
||||
chartWindow.appendChild(closeButton);
|
||||
window.chartWindow = chartWindow;
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
@@ -631,4 +634,4 @@ window.addEventListener('scroll', function() {
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -660,9 +660,10 @@ function generateMiniGraph(elem, comname) {
|
||||
if (xhr.status === 200) {
|
||||
var detections = JSON.parse(xhr.responseText);
|
||||
|
||||
console.log(detections)
|
||||
|
||||
// Create a div element for the chart window
|
||||
if (typeof(window.chartWindow) != 'undefined') {
|
||||
document.body.removeChild(window.chartWindow);
|
||||
}
|
||||
var chartWindow = document.createElement('div');
|
||||
chartWindow.className = "chartdiv"
|
||||
chartWindow.style.position = 'fixed';
|
||||
@@ -773,6 +774,7 @@ function generateMiniGraph(elem, comname) {
|
||||
document.body.removeChild(chartWindow);
|
||||
});
|
||||
chartWindow.appendChild(closeButton);
|
||||
window.chartWindow = chartWindow;
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
|
||||
Reference in New Issue
Block a user