Add postcast styling
Add prettyPhoto
This commit is contained in:
40
public/js/main.js
vendored
40
public/js/main.js
vendored
@@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user