jellyfin-web/dashboard-ui/scripts/notificationlist.js

54 lines
1.4 KiB
JavaScript
Raw Normal View History

(function ($, document, Notifications) {
2014-10-30 21:57:24 -07:00
$(document).on("pageinit", "#notificationsPage", function () {
2014-05-29 21:16:11 -07:00
// If there is no user logged in there can be no notifications
if (!Dashboard.getCurrentUserId()) return;
var elem = $(".notificationsList");
var btn = $(".btnMarkReadContainer");
var startIndex = 0;
var limit = 10;
Notifications.showNotificationsList(startIndex, limit, elem, btn);
2014-05-27 07:30:21 -07:00
elem.on("click", ".btnPreviousPage", function (e) {
2014-05-27 07:30:21 -07:00
e.preventDefault();
2014-05-27 07:30:21 -07:00
startIndex = startIndex - limit;
2014-05-27 07:30:21 -07:00
if (startIndex < 0) startIndex = 0;
2014-05-27 07:30:21 -07:00
Notifications.showNotificationsList(startIndex, limit, elem, btn);
2014-05-27 07:30:21 -07:00
})
.on("click", ".btnNextPage", function (e) {
e.preventDefault();
startIndex = startIndex + limit;
Notifications.showNotificationsList(startIndex, limit, elem, btn);
});
2014-05-27 07:30:21 -07:00
$(".readOnlyContent").on("click", ".btnMarkRead", function () {
var ids = $(".notificationsList div").map(function () {
return this.getAttribute('data-notificationid');
}).get();
2014-05-27 07:30:21 -07:00
Notifications.markNotificationsRead(ids, function () {
Notifications.showNotificationsList(startIndex, limit, elem, btn);
});
});
});
})(jQuery, document, Notifications);