`;
if(updateUrl){
history.pushState(
{place:id},
"",
"#photo-"+id
);
}
window.scrollTo({
top:0,
behavior:"smooth"
});
}
function back(){
const home = document.getElementById("egp-home");
const detail = document.getElementById("egp-detail");
detail.classList.remove("active");
home.classList.remove("hidden");
history.pushState(
{},
"",
window.location.pathname
);
window.scrollTo({
top:0,
behavior:"smooth"
});
}
function loadHash(){
const hash = window.location.hash;
if(hash.indexOf("#photo-") === 0){
const id = hash.replace("#photo-","");
if(PLACES[id]){
openPlace(id,false);
return;
}
}
backWithoutHistory();
}
function backWithoutHistory(){
const home = document.getElementById("egp-home");
const detail = document.getElementById("egp-detail");
detail.classList.remove("active");
home.classList.remove("hidden");
window.scrollTo(0,0);
}
window.addEventListener("popstate",function(){
loadHash();
});
window.addEventListener("hashchange",function(){
loadHash();
});
/* PUBLIC API */
window.EGPhoto = {
open:openPlace,
back:back
};
/* START */
document.addEventListener("DOMContentLoaded",function(){
loadHash();
});
})();
