';
if (slides.length) {
html += '
';
slides.forEach(function (item, index) {
html += '
';
html += '
%20+%20')
';
if (item.title || item.subtitle) {
html += '
';
if (item.title) html += '' + escapeHtml(item.title) + '';
if (item.subtitle) html += '' + escapeHtml(item.subtitle) + '';
html += '
';
}
html += '
';
});
html += '
';
} else {
html += '
Featured slideshow reserved
';
}
html += '
Photo Gallery
';
if (gallery.length) {
html += '
';
gallery.forEach(function (item, index) {
html += '
';
html += '
';
html += '
';
});
html += '
';
} else {
html += '
Gallery reserved
';
}
html += '
Journal Entries
';
if (posts.length) {
html += '
';
} else {
html += '
Journal entries reserved
';
}
regionDetailContent.innerHTML = html;
const galleryButtons = regionDetailContent.querySelectorAll(".fl-photo-tile-button");
galleryButtons.forEach(function (button) {
button.addEventListener("click", function () {
openLightbox(gallery, Number(button.getAttribute("data-gallery-index") || 0));
});
});
const slideEls = regionDetailContent.querySelectorAll(".fl-region-slide");
if (slideEls.length > 1) {
let index = 0;
slideTimer = window.setInterval(function () {
slideEls[index].classList.remove("is-active");
index = (index + 1) % slideEls.length;
slideEls[index].classList.add("is-active");
}, 4200);
}
}
back.addEventListener("click", function () {
clearSlideshow();
if (history.length === 0) return;
const previous = history.pop();
if (previous.type === "world") goToWorld(false);
else if (previous.type === "continent") goToContinent(previous.key, false, previous.focusCountryKey || null);
else if (previous.type === "country") goToCountry(previous.key, false);
else if (previous.type === "region") goToRegionDetail(previous.countryKey, previous.region, false);
else goToWorld(false);
});
bindLightboxControls();
goToWorld(false);
})();