From 11cedaa7e411cdfa4e6458e167adb43f01feb11d Mon Sep 17 00:00:00 2001 From: Philippe Date: Sat, 19 Jan 2019 16:48:11 +0100 Subject: [PATCH] Support Frontend audio language filter selection jellyfin#617 Show audio languages filter if any have been received in get filters call Localized audio languages filter header in three languages --- src/components/filterdialog/filterdialog.js | 11 ++++++++++- .../filterdialog/filterdialog.template.html | 9 +++++++-- src/strings/de.json | 1 + src/strings/en-US.json | 1 + src/strings/fr.json | 1 + 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/components/filterdialog/filterdialog.js b/src/components/filterdialog/filterdialog.js index 560919889e..bd0cd7820f 100644 --- a/src/components/filterdialog/filterdialog.js +++ b/src/components/filterdialog/filterdialog.js @@ -21,6 +21,8 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", " 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 + ",") }) } @@ -69,7 +71,7 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", " } 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")), "movies" != options.mode && "episodes" != options.mode || context.querySelector(".videoTypeFilters").classList.remove("hide"), options.mode, "movies" != options.mode && "series" != options.mode && "games" != 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") + "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 && "games" != 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") } function showByClass(context, className) { @@ -169,6 +171,13 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", " 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 chkOfficialRatingFilter = parentWithClass(e.target, "chkOfficialRatingFilter"); if (chkOfficialRatingFilter) { var filterName = chkOfficialRatingFilter.getAttribute("data-filter"), diff --git a/src/components/filterdialog/filterdialog.template.html b/src/components/filterdialog/filterdialog.template.html index 9eb7416207..9c0c15e69a 100644 --- a/src/components/filterdialog/filterdialog.template.html +++ b/src/components/filterdialog/filterdialog.template.html @@ -1,4 +1,4 @@ -
+

${HeaderFilters}

@@ -151,4 +151,9 @@
-
\ No newline at end of file + +
+
+
+
+ diff --git a/src/strings/de.json b/src/strings/de.json index da32a9ac1e..f96cbb0106 100644 --- a/src/strings/de.json +++ b/src/strings/de.json @@ -271,6 +271,7 @@ "HeaderApiKeysHelp": "Externe Applikationen benötigen einen API Key um mit Jellyfin Server zu kommunizieren. API Keys werden beim loggin mit einem Jellyfin Konto vergeben oder durch eine manuelle Freigabe.", "HeaderApp": "App", "HeaderAudio": "Audio", + "HeaderAudioLanguages": "Audiosprachen", "HeaderAudioSettings": "Audioeinstellungen", "HeaderAudioTracks": "Audiospuren", "HeaderAutomaticUpdates": "Automatische Updates", diff --git a/src/strings/en-US.json b/src/strings/en-US.json index a16cba5bdd..3d3a2c4a23 100644 --- a/src/strings/en-US.json +++ b/src/strings/en-US.json @@ -271,6 +271,7 @@ "HeaderApiKeysHelp": "External applications are required to have an Api key in order to communicate with Jellyfin Server. Keys are issued by logging in with an Jellyfin account, or by manually granting the application a key.", "HeaderApp": "App", "HeaderAudio": "Audio", + "HeaderAudioLanguages": "Audio Languages", "HeaderAudioSettings": "Audio Settings", "HeaderAudioTracks": "Audio Tracks", "HeaderAutomaticUpdates": "Automatic Updates", diff --git a/src/strings/fr.json b/src/strings/fr.json index f09b360825..386924a391 100644 --- a/src/strings/fr.json +++ b/src/strings/fr.json @@ -271,6 +271,7 @@ "HeaderApiKeysHelp": "Les applications externes ont besoin d'une clé d'API pour communiquer avec le serveur Jellyfin. Les clés sont distribuées lors d'une connexion avec un compte Jellyfin, ou bien en accordant manuellement une clé à une application.", "HeaderApp": "Application", "HeaderAudio": "Audio", + "HeaderAudioLanguages": "Langues audio", "HeaderAudioSettings": "Paramètres audio", "HeaderAudioTracks": "Pistes audio", "HeaderAutomaticUpdates": "Mises à jour automatiques",