Skip to content
- Choosing a selection results in a full page refresh.
- Opens in a new window.
// Ensure reviews with photos come first on the first page
window.addEventListener('load', function() {
let reviews = document.querySelectorAll('.jdgm-review');
let reviewsWithPhotos = [];
let reviewsWithoutPhotos = [];
reviews.forEach(function(review) {
let gallery = review.querySelector('.jdgm-gallery-wrapper');
if (gallery && gallery.children.length > 0) {
reviewsWithPhotos.push(review);
} else {
reviewsWithoutPhotos.push(review);
}
});
// Concatenate reviews with photos first, then reviews without photos
let sortedReviews = [...reviewsWithPhotos, ...reviewsWithoutPhotos];
// Place sorted reviews back in the correct order
let reviewsContainer = document.querySelector('.jdgm-reviews-container');
reviewsContainer.innerHTML = '';
sortedReviews.forEach(function(review) {
reviewsContainer.appendChild(review);
});
});