diff --git a/src/components/filterdialog/filterdialog.js b/src/components/filterdialog/filterdialog.js index d23bdb41d3..7301c65669 100644 --- a/src/components/filterdialog/filterdialog.js +++ b/src/components/filterdialog/filterdialog.js @@ -1,29 +1,48 @@ -define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "require", "emby-checkbox", "emby-collapse", "css!./style"], function(dialogHelper, globalize, connectionManager, events, browser, require) { +define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "require", "emby-checkbox", "emby-collapse", "css!./style"], function (dialogHelper, globalize, connectionManager, events, browser, require) { "use strict"; function renderOptions(context, selector, cssClass, items, isCheckedFn) { var elem = context.querySelector(selector); - items.length ? elem.classList.remove("hide") : elem.classList.add("hide"); + if (items.length) { + elem.classList.remove("hide"); + } else { + elem.classList.add("hide"); + } var html = ""; - html += '
', html += items.map(function(filter) { - var itemHtml = "", - checkedHtml = isCheckedFn(filter) ? " checked" : ""; - return itemHtml += "" - }).join(""), html += "
", elem.querySelector(".filterOptions").innerHTML = html + html += '
'; + html += items.map(function (filter) { + var itemHtml = ""; + var checkedHtml = isCheckedFn(filter) ? " checked" : ""; + itemHtml += ""; + return itemHtml; + }).join(""); + html += "
"; + elem.querySelector(".filterOptions").innerHTML = html; } function renderFilters(context, result, query) { - result.Tags && (result.Tags.length = Math.min(result.Tags.length, 50)), renderOptions(context, ".genreFilters", "chkGenreFilter", result.Genres, function(i) { - return -1 != ("|" + (query.Genres || "") + "|").indexOf("|" + i + "|") - }), renderOptions(context, ".officialRatingFilters", "chkOfficialRatingFilter", result.OfficialRatings, function(i) { - return -1 != ("|" + (query.OfficialRatings || "") + "|").indexOf("|" + i + "|") - }), renderOptions(context, ".tagFilters", "chkTagFilter", result.Tags, function(i) { - return -1 != ("|" + (query.Tags || "") + "|").indexOf("|" + i + "|") - }), renderOptions(context, ".yearFilters", "chkYearFilter", result.Years, function(i) { - return -1 != ("," + (query.Years || "") + ",").indexOf("," + i + ",") - }), renderOptions(context, ".audioLanguagesFilters", "chkAudioLanguagesFilter", result.AudioLanguages, function(i) { - return -1 != ("," + (query.AudioLanguages || "") + ",").indexOf("," + i + ",") - }) + if (result.Tags) { + result.Tags.length = Math.min(result.Tags.length, 50); + } + renderOptions(context, ".genreFilters", "chkGenreFilter", result.Genres, function (i) { + var delimeter = "|"; + return (delimeter + (query.Genres || "") + delimeter).indexOf(delimeter + i + delimeter) != -1; + }); + renderOptions(context, ".officialRatingFilters", "chkOfficialRatingFilter", result.OfficialRatings, function (i) { + var delimeter = "|"; + return (delimeter + (query.OfficialRatings || "") + delimeter).indexOf(delimeter + i + delimeter) != -1; + }); + renderOptions(context, ".tagFilters", "chkTagFilter", result.Tags, function (i) { + var delimeter = "|"; + return (delimeter + (query.Tags || "") + delimeter).indexOf(delimeter + i + delimeter) != -1; + }); + renderOptions(context, ".yearFilters", "chkYearFilter", result.Years, function (i) { + var delimeter = ","; + return (delimeter + (query.Years || "") + delimeter).indexOf(delimeter + i + delimeter) != -1; + }); } function loadDynamicFilters(context, apiClient, userId, itemQuery) { @@ -31,177 +50,361 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", " UserId: userId, ParentId: itemQuery.ParentId, IncludeItemTypes: itemQuery.IncludeItemTypes - })).then(function(result) { - renderFilters(context, result, itemQuery) - }) + })).then(function (result) { + renderFilters(context, result, itemQuery); + }); } function updateFilterControls(context, options) { - var elems, i, length, query = options.query; - if ("livetvchannels" == options.mode) context.querySelector(".chkFavorite").checked = 1 == query.IsFavorite, context.querySelector(".chkLikes").checked = 1 == query.IsLiked, context.querySelector(".chkDislikes").checked = 1 == query.IsDisliked; - else - for (elems = context.querySelectorAll(".chkStandardFilter"), i = 0, length = elems.length; i < length; i++) { - var chkStandardFilter = elems[i], - filters = "," + (query.Filters || ""), - filterName = chkStandardFilter.getAttribute("data-filter"); - chkStandardFilter.checked = -1 != filters.indexOf("," + filterName) + var elems; + var i; + var length; + var query = options.query; + + if (options.mode == "livetvchannels") { + context.querySelector(".chkFavorite").checked = query.IsFavorite == true; + context.querySelector(".chkLikes").checked = query.IsLiked == true; + context.querySelector(".chkDislikes").checked = query.IsDisliked == true; + } else { + elems = context.querySelectorAll(".chkStandardFilter"); + for (i = 0, length = elems.length; i < length; i++) { + var chkStandardFilter = elems[i]; + var filters = "," + (query.Filters || ""); + var filterName = chkStandardFilter.getAttribute("data-filter"); + chkStandardFilter.checked = filters.indexOf("," + filterName) != -1; } - for (elems = context.querySelectorAll(".chkVideoTypeFilter"), i = 0, length = elems.length; i < length; i++) { - var chkVideoTypeFilter = elems[i], - filters = "," + (query.VideoTypes || ""), - filterName = chkVideoTypeFilter.getAttribute("data-filter"); - chkVideoTypeFilter.checked = -1 != filters.indexOf("," + filterName) } - for (context.querySelector(".chk3DFilter").checked = 1 == query.Is3D, context.querySelector(".chkHDFilter").checked = 1 == query.IsHD, context.querySelector(".chk4KFilter").checked = 1 == query.Is4K, context.querySelector(".chkSDFilter").checked = 1 == query.IsHD, context.querySelector("#chkSubtitle").checked = 1 == query.HasSubtitles, context.querySelector("#chkTrailer").checked = 1 == query.HasTrailer, context.querySelector("#chkThemeSong").checked = 1 == query.HasThemeSong, context.querySelector("#chkThemeVideo").checked = 1 == query.HasThemeVideo, context.querySelector("#chkSpecialFeature").checked = 1 == query.HasSpecialFeature, context.querySelector("#chkSpecialEpisode").checked = 0 == query.ParentIndexNumber, context.querySelector("#chkMissingEpisode").checked = 1 == query.IsMissing, context.querySelector("#chkFutureEpisode").checked = 1 == query.IsUnaired, i = 0, length = elems.length; i < length; i++) { - var chkStatus = elems[i], - filters = "," + (query.SeriesStatus || ""), - filterName = chkStatus.getAttribute("data-filter"); - chkStatus.checked = -1 != filters.indexOf("," + filterName) + + elems = context.querySelectorAll(".chkVideoTypeFilter"); + for (i = 0, length = elems.length; i < length; i++) { + var chkVideoTypeFilter = elems[i]; + var filters = "," + (query.VideoTypes || ""); + var filterName = chkVideoTypeFilter.getAttribute("data-filter"); + chkVideoTypeFilter.checked = filters.indexOf("," + filterName) != -1; + } + context.querySelector(".chk3DFilter").checked = query.Is3D == true; + context.querySelector(".chkHDFilter").checked = query.IsHD == true; + context.querySelector(".chk4KFilter").checked = query.Is4K == true; + context.querySelector(".chkSDFilter").checked = query.IsHD == true; + context.querySelector("#chkSubtitle").checked = query.HasSubtitles == true; + context.querySelector("#chkTrailer").checked = query.HasTrailer == true; + context.querySelector("#chkThemeSong").checked = query.HasThemeSong == true; + context.querySelector("#chkThemeVideo").checked = query.HasThemeVideo == true; + context.querySelector("#chkSpecialFeature").checked = query.HasSpecialFeature == true; + context.querySelector("#chkSpecialEpisode").checked = query.ParentIndexNumber == 0; + context.querySelector("#chkMissingEpisode").checked = query.IsMissing == true; + context.querySelector("#chkFutureEpisode").checked = query.IsUnaired == true; + for (i = 0, length = elems.length; i < length; i++) { + var chkStatus = elems[i]; + var filters = "," + (query.SeriesStatus || ""); + var filterName = chkStatus.getAttribute("data-filter"); + chkStatus.checked = filters.indexOf("," + filterName) != -1; } } function triggerChange(instance) { - events.trigger(instance, "filterchange") + events.trigger(instance, "filterchange"); } function parentWithClass(elem, className) { - for (; !elem.classList || !elem.classList.contains(className);) - if (!(elem = elem.parentNode)) return null; - return elem + while (!elem.classList || !elem.classList.contains(className)) { + elem = elem.parentNode; + if (!elem) { + return null; + } + } + return elem; } function setVisibility(context, options) { - "livetvchannels" != options.mode && "albums" != options.mode && "artists" != options.mode && "albumartists" != options.mode && "songs" != options.mode || hideByClass(context, "videoStandard"), enableDynamicFilters(options.mode) && (context.querySelector(".genreFilters").classList.remove("hide"), context.querySelector(".officialRatingFilters").classList.remove("hide"), context.querySelector(".tagFilters").classList.remove("hide"), context.querySelector(".yearFilters").classList.remove("hide"), context.querySelector(".audioLanguagesFilters").classList.remove("hide")), "movies" != options.mode && "episodes" != options.mode || context.querySelector(".videoTypeFilters").classList.remove("hide"), options.mode, "movies" != options.mode && "series" != options.mode && "episodes" != options.mode || context.querySelector(".features").classList.remove("hide"), "series" == options.mode && context.querySelector(".seriesStatus").classList.remove("hide"), "episodes" == options.mode && showByClass(context, "episodeFilter") + if (options.mode == "livetvchannels" || options.mode == "albums" || options.mode == "artists" || options.mode == "albumartists" || options.mode == "songs") { + hideByClass(context, "videoStandard"); + } + + if (enableDynamicFilters(options.mode)) { + context.querySelector(".genreFilters").classList.remove("hide"); + context.querySelector(".officialRatingFilters").classList.remove("hide"); + context.querySelector(".tagFilters").classList.remove("hide"); + context.querySelector(".yearFilters").classList.remove("hide"); + } + + if (options.mode == "movies" || options.mode == "episodes") { + context.querySelector(".videoTypeFilters").classList.remove("hide"); + } + + if (options.mode == "movies" || options.mode == "series" || options.mode == "episodes") { + context.querySelector(".features").classList.remove("hide"); + } + + if (options.mode == "series") { + context.querySelector(".seriesStatus").classList.remove("hide"); + } + + if (options.mode == "episodes") { + showByClass(context, "episodeFilter"); + } } function showByClass(context, className) { - for (var elems = context.querySelectorAll("." + className), i = 0, length = elems.length; i < length; i++) elems[i].classList.remove("hide") + var elems = context.querySelectorAll("." + className); + + for (var i = 0, length = elems.length; i < length; i++) { + elems[i].classList.remove("hide"); + } } function hideByClass(context, className) { - for (var elems = context.querySelectorAll("." + className), i = 0, length = elems.length; i < length; i++) elems[i].classList.add("hide") + var elems = context.querySelectorAll("." + className); + + for (var i = 0, length = elems.length; i < length; i++) { + elems[i].classList.add("hide"); + } } function enableDynamicFilters(mode) { - return "movies" == mode || "series" == mode || "albums" == mode || "albumartists" == mode || "artists" == mode || "songs" == mode || "episodes" == mode + return mode == "movies" || mode == "series" || mode == "albums" || mode == "albumartists" || mode == "artists" || mode == "songs" || mode == "episodes"; } - return function(options) { + + return function (options) { function onFavoriteChange() { var query = options.query; - query.StartIndex = 0, query.IsFavorite = !!this.checked || null, triggerChange(self) + query.StartIndex = 0; + query.IsFavorite = !!this.checked || null; + triggerChange(self); } function onStandardFilterChange() { - var query = options.query, - filterName = this.getAttribute("data-filter"), - filters = query.Filters || ""; - filters = ("," + filters).replace("," + filterName, "").substring(1), this.checked && (filters = filters ? filters + "," + filterName : filterName), query.StartIndex = 0, query.Filters = filters, triggerChange(self) + var query = options.query; + var filterName = this.getAttribute("data-filter"); + var filters = query.Filters || ""; + filters = ("," + filters).replace("," + filterName, "").substring(1); + + if (this.checked) { + filters = filters ? filters + "," + filterName : filterName; + } + + query.StartIndex = 0; + query.Filters = filters; + triggerChange(self); } function onVideoTypeFilterChange() { - var query = options.query, - filterName = this.getAttribute("data-filter"), - filters = query.VideoTypes || ""; - filters = ("," + filters).replace("," + filterName, "").substring(1), this.checked && (filters = filters ? filters + "," + filterName : filterName), query.StartIndex = 0, query.VideoTypes = filters, triggerChange(self) + var query = options.query; + var filterName = this.getAttribute("data-filter"); + var filters = query.VideoTypes || ""; + filters = ("," + filters).replace("," + filterName, "").substring(1); + + if (this.checked) { + filters = filters ? filters + "," + filterName : filterName; + } + + query.StartIndex = 0; + query.VideoTypes = filters; + triggerChange(self); } function onStatusChange() { - var query = options.query, - filterName = this.getAttribute("data-filter"), - filters = query.SeriesStatus || ""; - filters = ("," + filters).replace("," + filterName, "").substring(1), this.checked && (filters = filters ? filters + "," + filterName : filterName), query.SeriesStatus = filters, query.StartIndex = 0, triggerChange(self) + var query = options.query; + var filterName = this.getAttribute("data-filter"); + var filters = query.SeriesStatus || ""; + filters = ("," + filters).replace("," + filterName, "").substring(1); + + if (this.checked) { + filters = filters ? filters + "," + filterName : filterName; + } + + query.SeriesStatus = filters; + query.StartIndex = 0; + triggerChange(self); } function bindEvents(context) { - var elems, i, length, query = options.query; - if ("livetvchannels" == options.mode) { - for (elems = context.querySelectorAll(".chkFavorite"), i = 0, length = elems.length; i < length; i++) elems[i].addEventListener("change", onFavoriteChange); - context.querySelector(".chkLikes").addEventListener("change", function() { - query.StartIndex = 0, query.IsLiked = !!this.checked || null, triggerChange(self) - }), context.querySelector(".chkDislikes").addEventListener("change", function() { - query.StartIndex = 0, query.IsDisliked = !!this.checked || null, triggerChange(self) - }) - } else - for (elems = context.querySelectorAll(".chkStandardFilter"), i = 0, length = elems.length; i < length; i++) elems[i].addEventListener("change", onStandardFilterChange); - for (elems = context.querySelectorAll(".chkVideoTypeFilter"), i = 0, length = elems.length; i < length; i++) elems[i].addEventListener("change", onVideoTypeFilterChange); - for (context.querySelector(".chk3DFilter").addEventListener("change", function() { - query.StartIndex = 0, query.Is3D = !!this.checked || null, triggerChange(self) - }), context.querySelector(".chk4KFilter").addEventListener("change", function() { - query.StartIndex = 0, query.Is4K = !!this.checked || null, triggerChange(self) - }), context.querySelector(".chkHDFilter").addEventListener("change", function() { - query.StartIndex = 0, query.IsHD = !!this.checked || null, triggerChange(self) - }), context.querySelector(".chkSDFilter").addEventListener("change", function() { - query.StartIndex = 0, query.IsHD = !this.checked && null, triggerChange(self) - }), elems = context.querySelectorAll(".chkStatus"), i = 0, length = elems.length; i < length; i++) elems[i].addEventListener("change", onStatusChange); - context.querySelector("#chkTrailer").addEventListener("change", function() { - query.StartIndex = 0, query.HasTrailer = !!this.checked || null, triggerChange(self) - }), context.querySelector("#chkThemeSong").addEventListener("change", function() { - query.StartIndex = 0, query.HasThemeSong = !!this.checked || null, triggerChange(self) - }), context.querySelector("#chkSpecialFeature").addEventListener("change", function() { - query.StartIndex = 0, query.HasSpecialFeature = !!this.checked || null, triggerChange(self) - }), context.querySelector("#chkThemeVideo").addEventListener("change", function() { - query.StartIndex = 0, query.HasThemeVideo = !!this.checked || null, triggerChange(self) - }), context.querySelector("#chkMissingEpisode").addEventListener("change", function() { - query.StartIndex = 0, this.checked ? (query.IsMissing = !0, query.IsUnaired = !1) : (query.IsMissing = !1, query.IsUnaired = context.querySelector("#chkFutureEpisode").checked || null), triggerChange(self) - }), context.querySelector("#chkSpecialEpisode").addEventListener("change", function() { - query.StartIndex = 0, query.ParentIndexNumber = this.checked ? 0 : null, triggerChange(self) - }), context.querySelector("#chkFutureEpisode").addEventListener("change", function() { - query.StartIndex = 0, this.checked ? (query.IsUnaired = !0, query.IsMissing = null) : (query.IsUnaired = null, query.IsMissing = context.querySelector("#chkMissingEpisode").checked), triggerChange(self) - }), context.querySelector("#chkSubtitle").addEventListener("change", function() { - query.StartIndex = 0, query.HasSubtitles = !!this.checked || null, triggerChange(self) - }), context.addEventListener("change", function(e) { + var elems; + var i; + var length; + var query = options.query; + + if (options.mode == "livetvchannels") { + elems = context.querySelectorAll(".chkFavorite"); + for (i = 0, length = elems.length; i < length; i++) { + elems[i].addEventListener("change", onFavoriteChange); + } + context.querySelector(".chkLikes").addEventListener("change", function () { + query.StartIndex = 0; + query.IsLiked = this.checked ? true : null; + triggerChange(self); + }); + context.querySelector(".chkDislikes").addEventListener("change", function () { + query.StartIndex = 0; + query.IsDisliked = this.checked ? true : null; + triggerChange(self); + }); + } else { + elems = context.querySelectorAll(".chkStandardFilter"); + for (i = 0, length = elems.length; i < length; i++) { + elems[i].addEventListener("change", onStandardFilterChange); + } + } + elems = context.querySelectorAll(".chkVideoTypeFilter"); + for (i = 0, length = elems.length; i < length; i++) { + elems[i].addEventListener("change", onVideoTypeFilterChange); + } + context.querySelector(".chk3DFilter").addEventListener("change", function () { + query.StartIndex = 0; + query.Is3D = this.checked ? true : null; + triggerChange(self); + }); + context.querySelector(".chk4KFilter").addEventListener("change", function () { + query.StartIndex = 0; + query.Is4K = this.checked ? true : null; + triggerChange(self); + }); + context.querySelector(".chkHDFilter").addEventListener("change", function () { + query.StartIndex = 0; + query.IsHD = this.checked ? true : null; + triggerChange(self); + }); + context.querySelector(".chkSDFilter").addEventListener("change", function () { + query.StartIndex = 0; + query.IsHD = this.checked ? false : null; + triggerChange(self); + }); + elems = context.querySelectorAll(".chkStatus"); + for (i = 0, length = elems.length; i < length; i++) { + elems[i].addEventListener("change", onStatusChange); + } + context.querySelector("#chkTrailer").addEventListener("change", function () { + query.StartIndex = 0; + query.HasTrailer = this.checked ? true : null; + triggerChange(self); + }); + context.querySelector("#chkThemeSong").addEventListener("change", function () { + query.StartIndex = 0; + query.HasThemeSong = this.checked ? true : null; + triggerChange(self); + }); + context.querySelector("#chkSpecialFeature").addEventListener("change", function () { + query.StartIndex = 0; + query.HasSpecialFeature = this.checked ? true : null; + triggerChange(self); + }); + context.querySelector("#chkThemeVideo").addEventListener("change", function () { + query.StartIndex = 0; + query.HasThemeVideo = this.checked ? true : null; + triggerChange(self); + }); + context.querySelector("#chkMissingEpisode").addEventListener("change", function () { + query.StartIndex = 0; + query.IsMissing = this.checked ? true : false; + triggerChange(self); + }); + context.querySelector("#chkSpecialEpisode").addEventListener("change", function () { + query.StartIndex = 0; + query.ParentIndexNumber = this.checked ? 0 : null; + triggerChange(self); + }); + context.querySelector("#chkFutureEpisode").addEventListener("change", function () { + query.StartIndex = 0; + if (this.checked) { + query.IsUnaired = true; + query.IsVirtualUnaired = null; + } else { + query.IsUnaired = null; + query.IsVirtualUnaired = false; + } + triggerChange(self); + }); + context.querySelector("#chkSubtitle").addEventListener("change", function () { + query.StartIndex = 0; + query.HasSubtitles = this.checked ? true : null; + triggerChange(self); + }); + context.addEventListener("change", function (e) { var chkGenreFilter = parentWithClass(e.target, "chkGenreFilter"); if (chkGenreFilter) { - var filterName = chkGenreFilter.getAttribute("data-filter"), - filters = query.Genres || "", - delimiter = "|"; - return filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1), chkGenreFilter.checked && (filters = filters ? filters + delimiter + filterName : filterName), query.StartIndex = 0, query.Genres = filters, void triggerChange(self) + var filterName = chkGenreFilter.getAttribute("data-filter"); + var filters = query.Genres || ""; + var delimiter = "|"; + filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1); + if (chkGenreFilter.checked) { + filters = filters ? (filters + delimiter + filterName) : filterName; + } + query.StartIndex = 0; + query.Genres = filters; + triggerChange(self); + return; } var chkTagFilter = parentWithClass(e.target, "chkTagFilter"); if (chkTagFilter) { - var filterName = chkTagFilter.getAttribute("data-filter"), - filters = query.Tags || "", - delimiter = "|"; - return filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1), chkTagFilter.checked && (filters = filters ? filters + delimiter + filterName : filterName), query.StartIndex = 0, query.Tags = filters, void triggerChange(self) + var filterName = chkTagFilter.getAttribute("data-filter"); + var filters = query.Tags || ""; + var delimiter = "|"; + filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1); + if (chkTagFilter.checked) { + filters = filters ? (filters + delimiter + filterName) : filterName; + } + query.StartIndex = 0; + query.Tags = filters; + triggerChange(self); + return; } var chkYearFilter = parentWithClass(e.target, "chkYearFilter"); if (chkYearFilter) { - var filterName = chkYearFilter.getAttribute("data-filter"), - filters = query.Years || "", - delimiter = ","; - return filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1), chkYearFilter.checked && (filters = filters ? filters + delimiter + filterName : filterName), query.StartIndex = 0, query.Years = filters, void triggerChange(self) - } - var chkAudioLanguagesFilter = parentWithClass(e.target, "chkAudioLanguagesFilter"); - if (chkAudioLanguagesFilter) { - var filterName = chkAudioLanguagesFilter.getAttribute("data-filter"), - filters = query.AudioLanguages || "", - delimiter = ","; - return filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1), chkAudioLanguagesFilter.checked && (filters = filters ? filters + delimiter + filterName : filterName), query.StartIndex = 0, query.AudioLanguages = filters, void triggerChange(self) + var filterName = chkYearFilter.getAttribute("data-filter"); + var filters = query.Years || ""; + var delimiter = ","; + filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1); + if (chkYearFilter.checked) { + filters = filters ? (filters + delimiter + filterName) : filterName; + } + query.StartIndex = 0; + query.Years = filters; + triggerChange(self); + return; } var chkOfficialRatingFilter = parentWithClass(e.target, "chkOfficialRatingFilter"); if (chkOfficialRatingFilter) { - var filterName = chkOfficialRatingFilter.getAttribute("data-filter"), - filters = query.OfficialRatings || "", - delimiter = "|"; - return filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1), chkOfficialRatingFilter.checked && (filters = filters ? filters + delimiter + filterName : filterName), query.StartIndex = 0, query.OfficialRatings = filters, void triggerChange(self) + var filterName = chkOfficialRatingFilter.getAttribute("data-filter"); + var filters = query.OfficialRatings || ""; + var delimiter = "|"; + filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1); + if (chkOfficialRatingFilter.checked) { + filters = filters ? (filters + delimiter + filterName) : filterName; + } + query.StartIndex = 0; + query.OfficialRatings = filters; + triggerChange(self); + return; } - }) + }); } + var self = this; - self.show = function() { - return new Promise(function(resolve, reject) { - require(["text!./filterdialog.template.html"], function(template) { + + self.show = function () { + return new Promise(function (resolve, reject) { + require(["text!./filterdialog.template.html"], function (template) { var dlg = dialogHelper.createDialog({ - removeOnClose: !0, - modal: !1 + removeOnClose: true, + modal: false }); - if (dlg.classList.add("ui-body-a"), dlg.classList.add("background-theme-a"), dlg.classList.add("formDialog"), dlg.classList.add("filterDialog"), dlg.innerHTML = globalize.translateDocument(template), setVisibility(dlg, options), dialogHelper.open(dlg), dlg.addEventListener("close", resolve), updateFilterControls(dlg, options), bindEvents(dlg), enableDynamicFilters(options.mode)) { + dlg.classList.add("ui-body-a"); + dlg.classList.add("background-theme-a"); + dlg.classList.add("formDialog"); + dlg.classList.add("filterDialog"); + dlg.innerHTML = globalize.translateDocument(template); + setVisibility(dlg, options); + dialogHelper.open(dlg); + dlg.addEventListener("close", resolve); + updateFilterControls(dlg, options); + bindEvents(dlg); + if (enableDynamicFilters(options.mode)) { dlg.classList.add("dynamicFilterDialog"); var apiClient = connectionManager.getApiClient(options.serverId); - loadDynamicFilters(dlg, apiClient, apiClient.getCurrentUserId(), options.query) + loadDynamicFilters(dlg, apiClient, apiClient.getCurrentUserId(), options.query); } - }) - }) - } - } + }); + }); + }; + }; }); diff --git a/src/components/filterdialog/filterdialog.template.html b/src/components/filterdialog/filterdialog.template.html index 70b5c1c67f..20f0f2fc91 100644 --- a/src/components/filterdialog/filterdialog.template.html +++ b/src/components/filterdialog/filterdialog.template.html @@ -1,62 +1,67 @@
-

- ${HeaderFilters} -

-
- - - - - - - - - -
-
-
-

- ${HeaderStatus} -

-
- - + +
+
+
+ + + + + + + + + +
+
+
+ +
+
+
+ + +
-
@@ -104,7 +109,8 @@
- -
-
-
-
diff --git a/src/components/filterdialog/style.css b/src/components/filterdialog/style.css index ccf65b9d50..5daf6eb38c 100644 --- a/src/components/filterdialog/style.css +++ b/src/components/filterdialog/style.css @@ -14,7 +14,7 @@ @media all and (min-height:600px) { .dynamicFilterDialog { top: 10% !important; - bottom: 10% !important + bottom: 25% !important } } @@ -33,4 +33,4 @@ margin-left: -150px !important; left: 50% !important } -} \ No newline at end of file +} diff --git a/src/strings/cs.json b/src/strings/cs.json index bac04e3f86..61a0544130 100644 --- a/src/strings/cs.json +++ b/src/strings/cs.json @@ -1314,7 +1314,6 @@ "HeaderAllowMediaDeletionFrom": "Povolit smazání médií z", "HeaderAppearsOn": "Appears On", "HeaderAudio": "Audio", - "HeaderAudioLanguages": "Jazyk zvuku", "HeaderBlockItemsWithNoRating": "Blokovat položky s žádnými nebo nerozpoznanými informacemi o hodnocení:", "HeaderCameraUploadHelp": "Aplikace Jellyfin mohou automaticky nahrávat fotografie z mobilních zařízení do serveru Jellyfin.", "HeaderChapterImages": "Obrázky kapitol", diff --git a/src/strings/da.json b/src/strings/da.json index 4bbba1ba1d..52bba949b3 100644 --- a/src/strings/da.json +++ b/src/strings/da.json @@ -1227,7 +1227,6 @@ "HeaderApp": "App", "HeaderAppearsOn": "Forekommer I", "HeaderAudioBooks": "Lydbøger", - "HeaderAudioLanguages": "Lyd Sprog", "HeaderBranding": "Mærkning", "HeaderContinueListening": "Fortsæt med At Høre", "HeaderDestination": "Destination", diff --git a/src/strings/de.json b/src/strings/de.json index a22c216c94..23ccc65b8a 100644 --- a/src/strings/de.json +++ b/src/strings/de.json @@ -285,7 +285,6 @@ "HeaderApiKeysHelp": "Externe Applikationen benötigen einen API-Schlüssel, um mit dem Jellyfin-Server zu kommunizieren. API-Schlüssel werden beim Anmelden mit einem Jellyfin-Konto oder durch eine manuelle Freigabe vergeben.", "HeaderAppearsOn": "Erscheint auf", "HeaderAudioBooks": "Hörbücher", - "HeaderAudioLanguages": "Audiosprachen", "HeaderAudioSettings": "Audioeinstellungen", "HeaderAutomaticUpdates": "Automatische Updates", "HeaderBlockItemsWithNoRating": "Blockiere Inhalte mit keiner oder nicht erkannter Altersfreigabe:", diff --git a/src/strings/en-gb.json b/src/strings/en-gb.json index 0304deef2c..ab50dbe544 100644 --- a/src/strings/en-gb.json +++ b/src/strings/en-gb.json @@ -336,7 +336,6 @@ "HeaderApp": "App", "HeaderAppearsOn": "Appears On", "HeaderAudioBooks": "Audio Books", - "HeaderAudioLanguages": "Audio Languages", "HeaderAudioSettings": "Audio Settings", "HeaderAutomaticUpdates": "Automatic Updates", "HeaderBooks": "Books", diff --git a/src/strings/en-us.json b/src/strings/en-us.json index f0e07bf2b2..86aa529ee9 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -305,7 +305,6 @@ "HeaderApp": "App", "HeaderAppearsOn": "Appears On", "HeaderAudioBooks": "Audio Books", - "HeaderAudioLanguages": "Audio Languages", "HeaderAudioSettings": "Audio Settings", "HeaderAutomaticUpdates": "Automatic Updates", "HeaderBlockItemsWithNoRating": "Block items with no or unrecognized rating information:", diff --git a/src/strings/es-mx.json b/src/strings/es-mx.json index 56b2582b98..2b78c9cf3c 100644 --- a/src/strings/es-mx.json +++ b/src/strings/es-mx.json @@ -1365,7 +1365,6 @@ "General": "General", "HeaderAdmin": "Administrador", "HeaderApp": "App", - "HeaderAudioLanguages": "Idiomas de audio", "HeaderError": "Error", "HeaderFavoriteMovies": "Peliculas favoritas", "HeaderFavoriteShows": "Programas favoritos", diff --git a/src/strings/es.json b/src/strings/es.json index bfaeac26ca..fbf570d27a 100644 --- a/src/strings/es.json +++ b/src/strings/es.json @@ -1290,7 +1290,6 @@ "HeaderAlbums": "Álbumes", "HeaderApp": "Aplicación", "HeaderAppearsOn": "Aparece en", - "HeaderAudioLanguages": "Idiomas de audio", "HeaderBranding": "Remarcado", "HeaderError": "Error", "HeaderMusicQuality": "Calidad de sonido", diff --git a/src/strings/fr.json b/src/strings/fr.json index 41172eff03..9b12312782 100644 --- a/src/strings/fr.json +++ b/src/strings/fr.json @@ -288,7 +288,6 @@ "HeaderApp": "Application", "HeaderAppearsOn": "Apparait dans", "HeaderAudioBooks": "Livres audios", - "HeaderAudioLanguages": "Langues audio", "HeaderAudioSettings": "Réglages audio", "HeaderAutomaticUpdates": "Mises à jour automatiques", "HeaderBlockItemsWithNoRating": "Bloquer les éléments avec des informations de classification inconnues ou n'en disposant pas :", diff --git a/src/strings/hu.json b/src/strings/hu.json index 5ce563770f..fbe1505f61 100644 --- a/src/strings/hu.json +++ b/src/strings/hu.json @@ -724,7 +724,6 @@ "HeaderApiKey": "API Kulcs", "HeaderApiKeys": "API Kulcsok", "HeaderAppearsOn": "Megjelenik", - "HeaderAudioLanguages": "Audió nyelv", "HeaderBooks": "Könyvek", "HeaderCancelRecording": "Felvétel törlése", "HeaderCancelSeries": "Sorozat törlése", diff --git a/src/strings/it.json b/src/strings/it.json index 0f07e69b6c..f2f9c61079 100644 --- a/src/strings/it.json +++ b/src/strings/it.json @@ -1312,7 +1312,6 @@ "General": "Generale", "HeaderApp": "Applicazione", "HeaderAppearsOn": "Appare In", - "HeaderAudioLanguages": "Lingue Audio", "HeaderCastAndCrew": "Cast", "HeaderCastCrew": "Cast", "HeaderMedia": "Media", diff --git a/src/strings/ja.json b/src/strings/ja.json index 5c7f19b81c..38638d2a35 100644 --- a/src/strings/ja.json +++ b/src/strings/ja.json @@ -306,7 +306,6 @@ "HeaderApp": "アプリ", "HeaderAppearsOn": "表示", "HeaderAudioBooks": "オーディオブック", - "HeaderAudioLanguages": "音声言語", "HeaderAudioSettings": "音声設定", "HeaderAutomaticUpdates": "自動更新", "HeaderBlockItemsWithNoRating": "評価情報がない、または認識できないアイテムをブロックします。", diff --git a/src/strings/kk.json b/src/strings/kk.json index 86e297d94d..7189926df8 100644 --- a/src/strings/kk.json +++ b/src/strings/kk.json @@ -1416,7 +1416,6 @@ "Yes": "Iá", "Yesterday": "Keshe", "ChangingMetadataImageSettingsNewContent": "Metaderekterdi nemese sýretterdi júkteý parametrlerin ózgertýi tek tasyǵyshhanaǵa ústelgen jańa mazmunǵa qoldanylady. Ózgeristerdi qoldanystaǵy ataýlarǵa qoldaný úshin olardyń metaderekterin qolmen jańǵyrtý qajet.", - "HeaderAudioLanguages": "Dybys tilderi", "LabelDynamicExternalId": "{0} Id:", "LeaveBlankToNotSetAPassword": "Paróldi ornatpaý úshin bul óristi bos qaldyrýǵa bolady.", "MessageImageFileTypeAllowed": "Tek qana JPEG jáne PNG faıldary qoldaýda.", diff --git a/src/strings/nl.json b/src/strings/nl.json index d7d2746e2e..df9a0b263a 100644 --- a/src/strings/nl.json +++ b/src/strings/nl.json @@ -1283,7 +1283,6 @@ "Genres": "Genres", "GenresValue": "Genres: {0}", "HeaderAlbums": "Albums", - "HeaderAudioLanguages": "Geluidstalen", "HeaderCastAndCrew": "Cast & Crew", "HeaderCastCrew": "Cast & Crew", "Art": "Afbeeldingen", diff --git a/src/strings/pl.json b/src/strings/pl.json index f9fe63e80c..b5c61587de 100644 --- a/src/strings/pl.json +++ b/src/strings/pl.json @@ -1371,7 +1371,6 @@ "ButtonOk": "Ok", "ButtonStart": "Start", "FormatValue": "Format: {0}", - "HeaderAudioLanguages": "Języki Audio", "HeaderFavoriteMovies": "Ulubione filmy", "HeaderFavoriteShows": "Ulubione seriale", "HeaderFavoriteEpisodes": "Ulubione odcinki", diff --git a/src/strings/pt-br.json b/src/strings/pt-br.json index cfcdd468b5..730ac20aae 100644 --- a/src/strings/pt-br.json +++ b/src/strings/pt-br.json @@ -1331,7 +1331,6 @@ "GuideProviderLogin": "Provedor", "HeaderAdmin": "Administrador", "HeaderApp": "Aplicativo", - "HeaderAudioLanguages": "Opções de áudio", "HeaderStatus": "Status", "HeaderTags": "Marcações", "Horizontal": "Horizontal", diff --git a/src/strings/ru.json b/src/strings/ru.json index 763e0347f5..e3ce76b26a 100644 --- a/src/strings/ru.json +++ b/src/strings/ru.json @@ -1381,7 +1381,6 @@ "Yes": "Да", "Yesterday": "Вчера", "ChangingMetadataImageSettingsNewContent": "Изменения в настройках загрузки метаданных или иллюстраций применяются только к новому содержанию, добавляемому в медиатеку. Чтобы применить изменения к наличным произведениям, необходимо обновить их метаданные вручную.", - "HeaderAudioLanguages": "Языки аудио", "LabelDynamicExternalId": "{0} Ид:", "LeaveBlankToNotSetAPassword": "Оставьте пустым, чтобы не назначать пароль.", "MessageImageFileTypeAllowed": "Поддерживаются только файлы JPEG и PNG.", diff --git a/src/strings/zh-cn.json b/src/strings/zh-cn.json index 3641897b5a..a5928ea9d4 100644 --- a/src/strings/zh-cn.json +++ b/src/strings/zh-cn.json @@ -1345,7 +1345,6 @@ "ErrorDeletingItem": "服务器删除项目时出错。请确认服务器具有对媒体文件夹的写入权限并重试。", "GroupBySeries": "按系列分组", "HeaderApp": "应用程序", - "HeaderAudioLanguages": "音频语言", "DirectStreamHelp1": "该媒体文件的分辨率和编码(H.264、AC3 等)与您的设备兼容,但容器格式(.mkv、.avi、.wmv 等)不受支持。因此,视频在串流至您的设备之前将会被即时封装为另一种格式。", "HeaderAppearsOn": "出现于", "HeaderCancelSeries": "取消系列", diff --git a/src/strings/zh-tw.json b/src/strings/zh-tw.json index a9f9f80c04..821a8cd414 100644 --- a/src/strings/zh-tw.json +++ b/src/strings/zh-tw.json @@ -582,7 +582,6 @@ "HeaderAppearsOn": "同時出現於", "HeaderAudio": "音訊", "HeaderAudioBooks": "有聲書", - "HeaderAudioLanguages": "音訊語言", "HeaderAudioSettings": "音訊設定", "HeaderAudioTracks": "音軌", "HeaderBackdrops": "背景",