From 5216752ee9e9de3426b11f97e280b63670a03ab6 Mon Sep 17 00:00:00 2001 From: shirt <2660574+shirt-dev@users.noreply.github.com> Date: Sun, 24 Apr 2022 23:11:44 -0400 Subject: [PATCH] Separate subtitle language --- cadmium-playercore-shim.js | 7 ++++++- content_script.js | 3 ++- manifest.json | 2 +- pages/options.html | 39 +++++++++++++++++++++++++++++++++++++- pages/options.js | 6 +++++- 5 files changed, 52 insertions(+), 5 deletions(-) diff --git a/cadmium-playercore-shim.js b/cadmium-playercore-shim.js index 9a67704..ae233ea 100644 --- a/cadmium-playercore-shim.js +++ b/cadmium-playercore-shim.js @@ -110,6 +110,11 @@ function get_preferred_locale() { return globalOptions.preferredLocale; } +// eslint-disable-next-line no-unused-vars +function get_preferred_text_locale() { + return globalOptions.preferredTextLocale; +} + do_patch( "Hello world", /(.*)/, @@ -150,7 +155,7 @@ do_patch( do_patch( "Set preferred text locale", /preferredTextLocale:.\.preferredTextLocale/, - "preferredTextLocale: get_preferred_locale()" + "preferredTextLocale: get_preferred_text_locale()" ); // run our patched copy of playercore in a non-privileged context on the page diff --git a/content_script.js b/content_script.js index ba63a0c..7e54d78 100644 --- a/content_script.js +++ b/content_script.js @@ -47,7 +47,8 @@ chromeStorageGet({ setMaxBitrate: false, disableVP9: false, useDDPlus: false, - preferredLocale: "en", + preferredLocale: null, + preferredTextLocale: null, }).then(items => { // very messy workaround for accessing chrome storage outside of background / content scripts let mainScript = document.createElement("script"); diff --git a/manifest.json b/manifest.json index 19b17ff..06b0420 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Netflix International", "description": "Displays all available Netflix audio tracks.", - "version": "2.0.10", + "version": "2.0.11", "author": "shirt", "browser_action": { "default_icon": "img/icon128.png", diff --git a/pages/options.html b/pages/options.html index d1efd82..0b1ca94 100644 --- a/pages/options.html +++ b/pages/options.html @@ -21,8 +21,45 @@

- + + +