Fix issues with clicking place when place popup open (close #16)
This commit is contained in:
parent
c3c7599be8
commit
7864cf2ccb
@ -90,10 +90,12 @@ function scanCode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openPlace(id, name) {
|
function openPlace(id, name) {
|
||||||
|
var placepopupnonce = Math.random();
|
||||||
$("#place-info").addClass("display-none");
|
$("#place-info").addClass("display-none");
|
||||||
$("#place-error-msg").addClass("display-none");
|
$("#place-error-msg").addClass("display-none");
|
||||||
$("#place-popup .preloader").removeClass("display-none");
|
$("#place-popup .preloader").removeClass("display-none");
|
||||||
$("#place-popup").data("placeid", id);
|
$("#place-popup").data("placeid", id);
|
||||||
|
$("#place-popup").data("placepopupnonce", placepopupnonce);
|
||||||
$("#place-title").text(name);
|
$("#place-title").text(name);
|
||||||
app.popup.open("#place-popup");
|
app.popup.open("#place-popup");
|
||||||
|
|
||||||
@ -107,6 +109,14 @@ function openPlace(id, name) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var refreshPlaceStats = function () {
|
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) {
|
if (app.popup.get("#place-popup").opened) {
|
||||||
updatePlaceStats(id);
|
updatePlaceStats(id);
|
||||||
setTimeout(refreshPlaceStats, 2000);
|
setTimeout(refreshPlaceStats, 2000);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user