rework mod/ping and desktop notification logic
`mod/ping.php` returns all notifications ordered by date mixing system notifications, private messages, intros, registrations remove 'notify_full' mode remove `&arr;` from unseen notes, 'seen' attrib now is "1" or "0" new note attribute 'timestamp' desktop notification logic use timestamp to check which notification show to the user notification html template use timestamp to show full date to user in tooltip `relative_date()` don't append full date on dates older than 24 hours
This commit is contained in:
13
js/main.js
13
js/main.js
@@ -186,13 +186,20 @@
|
||||
var notification_id = 0;
|
||||
eNotif.children("note").each(function(){
|
||||
e = $(this);
|
||||
text = e.text().format("<span class='contactname'>"+e.attr('name')+"</span>");
|
||||
html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen'));
|
||||
var text = e.text().format("<span class='contactname'>"+e.attr('name')+"</span>");
|
||||
var seenclass = (e.attr('seen')==1)?"notify-seen":"notify-unseen";
|
||||
var html = notifications_tpl.format(e.attr('href'),
|
||||
e.attr('photo'), // {0}
|
||||
text, // {1}
|
||||
e.attr('date'), // {2}
|
||||
seenclass, // {3}
|
||||
new Date(e.attr('timestamp')*1000) // {4}
|
||||
);
|
||||
nnm.append(html);
|
||||
});
|
||||
$(eNotif.children("note").get().reverse()).each(function(){
|
||||
e = $(this);
|
||||
notification_id = parseInt(e.attr('href').match(/\d+$/)[0]);
|
||||
notification_id = parseInt(e.attr('timestamp'));
|
||||
if (notification_lastitem!== null && notification_id > notification_lastitem) {
|
||||
if (getNotificationPermission()==="granted") {
|
||||
var notification = new Notification(document.title, {
|
||||
|
||||
Reference in New Issue
Block a user