diff --git a/src/dashboard/livetvtuner.js b/src/dashboard/livetvtuner.js index 5ded7e6bf4..1cc806d05b 100644 --- a/src/dashboard/livetvtuner.js +++ b/src/dashboard/livetvtuner.js @@ -2,31 +2,54 @@ define(["globalize", "loading", "libraryMenu", "dom", "emby-input", "emby-button "use strict"; function isM3uVariant(type) { - return -1 !== ["nextpvr"].indexOf(type || "") + return ["nextpvr"].indexOf(type || "") !== -1; } function fillTypes(view, currentId) { - return ApiClient.getJSON(ApiClient.getUrl("LiveTv/TunerHosts/Types")).then(function(types) { + ApiClient.getJSON(ApiClient.getUrl("LiveTv/TunerHosts/Types")).then(function(types) { var selectType = view.querySelector(".selectType"); selectType.innerHTML = types.map(function(t) { - return '" - }).join("") + '", selectType.disabled = null != currentId, selectType.value = "", onTypeChange.call(selectType) - }) + return '"; + }).join(""); + selectType.innerHTML += '"; + + selectType.disabled = null != currentId; + selectType.value = ""; + onTypeChange.call(selectType); + }); } function reload(view, providerId) { - view.querySelector(".txtDevicePath").value = "", view.querySelector(".chkFavorite").checked = !1, view.querySelector(".txtDevicePath").value = "", providerId && ApiClient.getNamedConfiguration("livetv").then(function(config) { - var info = config.TunerHosts.filter(function(i) { - return i.Id === providerId - })[0]; - fillTunerHostInfo(view, info) - }) + view.querySelector(".txtDevicePath").value = ""; + view.querySelector(".chkFavorite").checked = false; + view.querySelector(".txtDevicePath").value = ""; + if (providerId) { + ApiClient.getNamedConfiguration("livetv").then(function(config) { + var info = config.TunerHosts.filter(function(i) { + return i.Id === providerId; + })[0]; + fillTunerHostInfo(view, info); + }); + } } function fillTunerHostInfo(view, info) { - var selectType = view.querySelector(".selectType"), - type = info.Type || ""; - info.Source && isM3uVariant(info.Source) && (type = info.Source), selectType.value = type, onTypeChange.call(selectType), view.querySelector(".txtDevicePath").value = info.Url || "", view.querySelector(".txtFriendlyName").value = info.FriendlyName || "", view.querySelector(".txtUserAgent").value = info.UserAgent || "", view.querySelector(".fldDeviceId").value = info.DeviceId || "", view.querySelector(".chkFavorite").checked = info.ImportFavoritesOnly, view.querySelector(".chkTranscode").checked = info.AllowHWTranscoding, view.querySelector(".chkStreamLoop").checked = info.EnableStreamLooping, view.querySelector(".txtTunerCount").value = info.TunerCount || "0" + var selectType = view.querySelector(".selectType"); + var type = info.Type || ""; + if (info.Source && isM3uVariant(info.Source)) { + selectType.value = info.Source; + onTypeChange.call(selectType); + } + view.querySelector(".txtDevicePath").value = info.Url || ""; + view.querySelector(".txtFriendlyName").value = info.FriendlyName || ""; + view.querySelector(".txtUserAgent").value = info.UserAgent || ""; + view.querySelector(".fldDeviceId").value = info.DeviceId || ""; + view.querySelector(".chkFavorite").checked = info.ImportFavoritesOnly; + view.querySelector(".chkTranscode").checked = info.AllowHWTranscoding; + view.querySelector(".chkStreamLoop").checked = info.EnableStreamLooping; + view.querySelector(".txtTunerCount").value = info.TunerCount || "0"; } function submitForm(page) { @@ -92,7 +115,6 @@ define(["globalize", "loading", "libraryMenu", "dom", "emby-input", "emby-button } return function(view, params) { params.id || view.querySelector(".btnDetect").classList.remove("hide"), view.addEventListener("viewshow", function() { - libraryMenu.setTabs("livetvadmin", 0, getTabs); var currentId = params.id; fillTypes(view, currentId).then(function() { reload(view, currentId) diff --git a/src/scripts/livetvstatus.js b/src/scripts/livetvstatus.js index 1beb1a9c69..3a7078ccd8 100644 --- a/src/scripts/livetvstatus.js +++ b/src/scripts/livetvstatus.js @@ -230,7 +230,6 @@ define(["jQuery", "globalize", "scripts/taskbutton", "dom", "libraryMenu", "layo addProvider(this) }), page.querySelector(".devicesList").addEventListener("click", onDevicesListClick) }).on("pageshow", "#liveTvStatusPage", function() { - libraryMenu.setTabs("livetvadmin", 0, getTabs); var page = this; reload(page), taskButton({ mode: "on", diff --git a/src/scripts/notificationsettings.js b/src/scripts/notificationsettings.js index 173db03bca..78948fd56b 100644 --- a/src/scripts/notificationsettings.js +++ b/src/scripts/notificationsettings.js @@ -2,20 +2,55 @@ define(["loading", "libraryMenu", "globalize", "listViewStyle", "emby-linkbutton "use strict"; function reload(page) { - loading.show(), ApiClient.getJSON(ApiClient.getUrl("Notifications/Types")).then(function(list) { - var html = "", - lastCategory = "", - showHelp = !0; + loading.show(); + ApiClient.getJSON(ApiClient.getUrl("Notifications/Types")).then(function(list) { + var html = ""; + var lastCategory = ""; + var showHelp = true; html += list.map(function(i) { var itemHtml = ""; - return i.Category != lastCategory && (lastCategory = i.Category, lastCategory && (itemHtml += "", itemHtml += ""), itemHtml += '
', itemHtml += '
', itemHtml += '

', itemHtml += i.Category, itemHtml += "

", showHelp && (showHelp = !1, itemHtml += '' + globalize.translate("Help") + ""), itemHtml += "
", itemHtml += '
'), itemHtml += '', i.Enabled ? itemHtml += 'notifications_active' : itemHtml += 'notifications_off', itemHtml += '
', itemHtml += '
' + i.Name + "
", itemHtml += "
", itemHtml += '', itemHtml += "
" - }).join(""), list.length && (html += "
", html += "
"), page.querySelector(".notificationList").innerHTML = html, loading.hide() + if (i.Category !== lastCategory) { + lastCategory = i.Category; + if (lastCategory) { + itemHtml += ""; + itemHtml += ""; + } + itemHtml += '
'; + itemHtml += '
'; + itemHtml += '

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

"; + if (showHelp) { + showHelp = false; + itemHtml += ''; + itemHtml += globalize.translate("Help"); + itemHtml += ""; + } + itemHtml += "
"; + itemHtml += '
'; + } + itemHtml += ''; + i.Enabled ? itemHtml += 'notifications_active' : itemHtml += 'notifications_off'; + itemHtml += '
'; + itemHtml += '
' + i.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() { - libraryMenu.setTabs("notifications", 0, getTabs), reload(view) - }) + reload(view); + }); } }); \ No newline at end of file