Fix notifications
This commit is contained in:
@@ -291,18 +291,23 @@ $('#notificationMenuButton').click(() => {
|
||||
if (data.success) {
|
||||
loadNotificationsAsync();
|
||||
}
|
||||
},
|
||||
error: console.log
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const notificationCount = 5;
|
||||
let notificationOffset = 0;
|
||||
|
||||
function loadNotificationsAsync() {
|
||||
$.ajax({
|
||||
url: '/Main/getNotifications',
|
||||
method: 'POST',
|
||||
data: {
|
||||
count: notificationCount,
|
||||
offset: notificationOffset
|
||||
},
|
||||
beforeSend: () => {
|
||||
$('#notificationMenu').prepend('<div class="text-center"><i class="fa fa-cog fa-spin fa-4x my-4"></i></div>');
|
||||
$('#notificationMenu').find('.list-group').empty();
|
||||
$('#notificationMenu').find('.fa').removeClass('fa-frown text-danger').addClass('fa-spin fa-cog');
|
||||
},
|
||||
success: (data) => {
|
||||
$('#notificationMenu').find('.text-center').remove();
|
||||
@@ -325,9 +330,12 @@ function loadNotificationsAsync() {
|
||||
$('#notificationCount').text(unread.length);
|
||||
}
|
||||
}
|
||||
notificationOffset++;
|
||||
}
|
||||
},
|
||||
error: console.log
|
||||
error: () => {
|
||||
$('#notificationMenu').find('.fa').removeClass('fa-spin fa-cog').addClass('fa-frown text-danger');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
function showFullPost(uuid, username) {
|
||||
console.log(uuid, username);
|
||||
let defaultUrl = window.location.pathname;
|
||||
if(window.location.pathname.indexOf('user') === -1)
|
||||
defaultUrl += window.location.search;
|
||||
@@ -7,8 +6,9 @@ function showFullPost(uuid, username) {
|
||||
$.ajax({
|
||||
url: "/user/single_post_data/" + username + "/" + uuid,
|
||||
beforeSend: () => {
|
||||
const origin = encodeURI(btoa(window.location.href));
|
||||
const origin = encodeURI(btoa(window.location.href.split('/post')[0]));
|
||||
window.history.pushState('', '', '/user/' + username + '/post/' + uuid + '?o=' + origin);
|
||||
|
||||
$('body').append(`
|
||||
<div class="modal fade postFullviewModal" role="dialog" tabindex="-1" id="postFullviewModal">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
@@ -32,17 +32,13 @@ function showFullPost(uuid, username) {
|
||||
modal.modal('show');
|
||||
|
||||
modal.on('hidden.bs.modal', () => {
|
||||
console.log('test');
|
||||
$('.postFullviewModal').remove();
|
||||
window.history.replaceState('', '', defaultUrl);
|
||||
});
|
||||
},
|
||||
success: (data) => {
|
||||
$('#postFullviewModal .modal-body').empty().append(data);
|
||||
registerPostEvents();
|
||||
|
||||
$('#postFullviewModal').on('hide.bs.modal', (e) => {
|
||||
window.history.replaceState('', '', defaultUrl);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user