Skip to content

Commit

Permalink
add hack for spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
MaertHaekkinen committed Nov 28, 2024
1 parent 97772cd commit 4659a3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion ajapaik/ajapaik/static/js/ajp-frontpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,17 @@
window.updateFrontpagePhotosAsync = function() {
const targetDiv = $('#ajp-frontpage-historic-photos');
targetDiv.removeClass('hidden ajp-invisible');
$('#ajp-loading-overlay').show();
$('#ajp-album-filter-box').addClass('d-none');
$('#ajp-photo-filter-box').removeClass('d-none');
syncStateToUrl();
$.ajax({
url: window.frontpageAsyncURL + window.location.search,
method: 'GET',
beforeSend: function() {
$('#ajp-loading-overlay').show();
// HACK!
window.loadingPhotos = true;
},
success: function(response) {
setWindowPaginationParameters(response);
let collection;
Expand Down Expand Up @@ -578,10 +582,13 @@
historicPhotoGalleryDiv.justifiedGallery();
}
$('#ajp-loading-overlay').hide();
// HACK!
window.loadingPhotos = false;
$(window).scrollTop(0);
},
error: function() {
$('#ajp-loading-overlay').hide();
window.loadingPhotos = false;
},
});
};
Expand Down
4 changes: 3 additions & 1 deletion ajapaik/ajapaik/templates/core/base_bootstrap.html
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,9 @@
$('#ajp-loading-overlay').show();
});
window.addEventListener('pageshow', function() {
$('#ajp-loading-overlay').hide();
if (!window.loadingPhotos) {
$('#ajp-loading-overlay').hide();
}
});

window.fbAsyncInit = function() {
Expand Down

0 comments on commit 4659a3d

Please sign in to comment.