2019-02-27 22:26:23 +00:00
|
|
|
define(["loading", "libraryMenu", "globalize", "listViewStyle", "emby-button"], function(loading, libraryMenu, globalize) {
|
2018-10-23 01:05:09 +03:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
function reload(page) {
|
2019-03-06 18:18:49 +09:00
|
|
|
loading.show();
|
|
|
|
ApiClient.getJSON(ApiClient.getUrl("Notifications/Types")).then(function(list) {
|
|
|
|
var html = "";
|
|
|
|
var lastCategory = "";
|
|
|
|
var showHelp = true;
|
2019-03-09 11:37:40 +09:00
|
|
|
html += list.map(function(notification) {
|
2018-10-23 01:05:09 +03:00
|
|
|
var itemHtml = "";
|
2019-03-09 11:37:40 +09:00
|
|
|
if (notification.Category !== lastCategory) {
|
|
|
|
lastCategory = notification.Category;
|
2019-03-06 18:18:49 +09:00
|
|
|
if (lastCategory) {
|
|
|
|
itemHtml += "</div>";
|
|
|
|
itemHtml += "</div>";
|
|
|
|
}
|
|
|
|
itemHtml += '<div class="verticalSection verticalSection-extrabottompadding">';
|
|
|
|
itemHtml += '<div class="sectionTitleContainer" style="margin-bottom:1em;">';
|
|
|
|
itemHtml += '<h2 class="sectionTitle">';
|
2019-03-09 11:37:40 +09:00
|
|
|
itemHtml += notification.Category;
|
2019-03-06 18:18:49 +09:00
|
|
|
itemHtml += "</h2>";
|
|
|
|
if (showHelp) {
|
|
|
|
showHelp = false;
|
2019-10-04 14:34:50 -04:00
|
|
|
itemHtml += '<a is="emby-linkbutton" class="raised button-alt headerHelpButton" target="_blank" href="https://docs.jellyfin.org/general/server/notifications.html">';
|
2019-03-06 18:18:49 +09:00
|
|
|
itemHtml += globalize.translate("Help");
|
|
|
|
itemHtml += "</a>";
|
|
|
|
}
|
|
|
|
itemHtml += "</div>";
|
|
|
|
itemHtml += '<div class="paperList">';
|
|
|
|
}
|
2019-03-09 11:37:40 +09:00
|
|
|
itemHtml += '<a class="listItem listItem-border" is="emby-linkbutton" data-ripple="false" href="notificationsetting.html?type=' + notification.Type + '">';
|
|
|
|
if (notification.Enabled) {
|
2020-02-23 01:22:55 +03:00
|
|
|
itemHtml += '<i class="listItemIcon material-icons notifications_active"></i>';
|
2019-03-07 22:00:13 +00:00
|
|
|
} else {
|
2020-02-23 01:22:55 +03:00
|
|
|
itemHtml += '<i class="listItemIcon material-icons notifications_off" style="background-color:#999;"></i>';
|
2019-03-07 22:00:13 +00:00
|
|
|
}
|
2019-03-06 18:18:49 +09:00
|
|
|
itemHtml += '<div class="listItemBody">';
|
2019-03-09 11:37:40 +09:00
|
|
|
itemHtml += '<div class="listItemBodyText">' + notification.Name + "</div>";
|
2019-03-06 18:18:49 +09:00
|
|
|
itemHtml += "</div>";
|
2020-02-23 01:22:55 +03:00
|
|
|
itemHtml += '<button type="button" is="paper-icon-button-light"><i class="material-icons mode_edit"></i></button>';
|
2019-03-06 18:18:49 +09:00
|
|
|
itemHtml += "</a>";
|
|
|
|
return itemHtml;
|
|
|
|
}).join("");
|
|
|
|
|
|
|
|
if (list.length) {
|
|
|
|
html += "</div>";
|
|
|
|
html += "</div>";
|
|
|
|
}
|
|
|
|
page.querySelector(".notificationList").innerHTML = html;
|
|
|
|
loading.hide();
|
2018-10-23 01:05:09 +03:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return function(view, params) {
|
|
|
|
view.addEventListener("viewshow", function() {
|
2019-03-06 18:18:49 +09:00
|
|
|
reload(view);
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-03-07 22:00:13 +00:00
|
|
|
});
|