define(["loading", "libraryMenu", "globalize", "listViewStyle", "emby-button"], function(loading, libraryMenu, globalize) { "use strict"; function reload(page) { loading.show(); ApiClient.getJSON(ApiClient.getUrl("Notifications/Types")).then(function(list) { var html = ""; var lastCategory = ""; var showHelp = true; html += list.map(function(notification) { var itemHtml = ""; if (notification.Category !== lastCategory) { lastCategory = notification.Category; if (lastCategory) { itemHtml += ""; itemHtml += ""; } itemHtml += '
'; itemHtml += '
'; itemHtml += '

'; itemHtml += notification.Category; itemHtml += "

"; if (showHelp) { showHelp = false; itemHtml += ''; itemHtml += globalize.translate("Help"); itemHtml += ""; } itemHtml += "
"; itemHtml += '
'; } itemHtml += ''; if (notification.Enabled) { itemHtml += 'notifications_active'; } else { itemHtml += 'notifications_off'; } itemHtml += '
'; itemHtml += '
' + notification.Name + "
"; itemHtml += "
"; itemHtml += ''; itemHtml += "
"; return itemHtml; }).join(""); if (list.length) { html += "
"; html += "
"; } page.querySelector(".notificationList").innerHTML = html; loading.hide(); }) } return function(view, params) { view.addEventListener("viewshow", function() { reload(view); }); } });