Add postcast styling

Add prettyPhoto
This commit is contained in:
Jorit Tijsen
2024-03-18 17:17:54 +01:00
parent 8ce3a1d7b3
commit 742c126a0a
31 changed files with 1284 additions and 361 deletions

40
public/js/main.js vendored
View File

@@ -1,41 +1 @@
function loadMoreNews(e, _options) {
var options = $.extend( {
loadingElementId: '#loading'
}, _options );
window.loadMoreNews = window.loadMoreNewsSettings ?? {}
var nextPage = window.loadMoreNewsSettings.nextPage ?? 2;
var isLoading = window.loadMoreNewsSettings.isLoading ?? false;
var $isLoading = $(options.loadingElementId).hide();
e.preventDefault();
if (!isLoading) {
// Set flag and update UI
isLoading = 1;
$isLoading.show();
var $button = $(this).attr("disabled", "disabled");
// Fire request for the next page
$.ajax({url: document.location.pathname + '?pagina=' + nextPage})
.always(function () {
// Whether success or failure, update the UI again
isLoading = 0;
$isLoading.hide();
$button.removeAttr("disabled");
})
.done(function (data) {
if (!data) {
// When no data was returned, disable the button permanently
page = -1;
$button.attr("disabled", "disabled").text("Geen nieuws meer.");
return;
}
console.log($(data));
console.log($(data).find('#items-more-news'));
$('#items-more-news').append($(data).find('#items-more-news'));
$('#items-most-read').append($(data).find('#items-most-read'));
++nextPage;
});
}
}