Fix issues with clicking place when place popup open (close #16)

master
Skylar Ittner 5 years ago
parent c3c7599be8
commit 7864cf2ccb

@ -90,10 +90,12 @@ function scanCode() {
}
function openPlace(id, name) {
var placepopupnonce = Math.random();
$("#place-info").addClass("display-none");
$("#place-error-msg").addClass("display-none");
$("#place-popup .preloader").removeClass("display-none");
$("#place-popup").data("placeid", id);
$("#place-popup").data("placepopupnonce", placepopupnonce);
$("#place-title").text(name);
app.popup.open("#place-popup");
@ -107,6 +109,14 @@ function openPlace(id, name) {
});
var refreshPlaceStats = function () {
if (id != $("#place-popup").data("placeid")) {
console.log("refreshPlaceStats: place ID changed, stopping refresh");
return;
}
if (placepopupnonce != $("#place-popup").data("placepopupnonce")) {
console.log("refreshPlaceStats: placepopupnonce changed, stopping redundant refresh");
return;
}
if (app.popup.get("#place-popup").opened) {
updatePlaceStats(id);
setTimeout(refreshPlaceStats, 2000);

Loading…
Cancel
Save