2018-10-23 01:05:09 +03:00
|
|
|
define(["loading", "libraryMenu", "globalize", "listViewStyle", "emby-linkbutton"], function(loading, libraryMenu, globalize) {
|
|
|
|
"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;
|
2018-10-23 01:05:09 +03:00
|
|
|
html += list.map(function(i) {
|
|
|
|
var itemHtml = "";
|
2019-03-06 18:18:49 +09:00
|
|
|
if (i.Category !== lastCategory) {
|
|
|
|
lastCategory = i.Category;
|
|
|
|
if (lastCategory) {
|
|
|
|
itemHtml += "</div>";
|
|
|
|
itemHtml += "</div>";
|
|
|
|
}
|
|
|
|
itemHtml += '<div class="verticalSection verticalSection-extrabottompadding">';
|
|
|
|
itemHtml += '<div class="sectionTitleContainer" style="margin-bottom:1em;">';
|
|
|
|
itemHtml += '<h2 class="sectionTitle">';
|
|
|
|
itemHtml += i.Category;
|
|
|
|
itemHtml += "</h2>";
|
|
|
|
if (showHelp) {
|
|
|
|
showHelp = false;
|
|
|
|
itemHtml += '<a is="emby-linkbutton" class="raised button-alt headerHelpButton" target="_blank" href="https://web.archive.org/web/20181216120305/https://github.com/MediaBrowser/Wiki/wiki/Notifications">';
|
|
|
|
itemHtml += globalize.translate("Help");
|
|
|
|
itemHtml += "</a>";
|
|
|
|
}
|
|
|
|
itemHtml += "</div>";
|
|
|
|
itemHtml += '<div class="paperList">';
|
|
|
|
}
|
|
|
|
itemHtml += '<a class="listItem listItem-border" is="emby-linkbutton" data-ripple="false" href="notificationsetting.html?type=' + i.Type + '">';
|
2019-03-07 22:00:13 +00:00
|
|
|
if (i.Enabled) {
|
|
|
|
itemHtml += '<i class="listItemIcon md-icon">notifications_active</i>';
|
|
|
|
} else {
|
|
|
|
itemHtml += '<i class="listItemIcon md-icon" style="background-color:#999;">notifications_off</i>';
|
|
|
|
}
|
2019-03-06 18:18:49 +09:00
|
|
|
itemHtml += '<div class="listItemBody">';
|
|
|
|
itemHtml += '<div class="listItemBodyText">' + i.Name + "</div>";
|
|
|
|
itemHtml += "</div>";
|
|
|
|
itemHtml += '<button type="button" is="paper-icon-button-light"><i class="md-icon">mode_edit</i></button>';
|
|
|
|
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
|
|
|
});
|