mirror of
https://github.com/shirt-dev/netflix-international.git
synced 2025-05-04 08:30:34 +00:00
Separate subtitle language
This commit is contained in:
parent
a793273c04
commit
5216752ee9
5 changed files with 52 additions and 5 deletions
|
@ -110,6 +110,11 @@ function get_preferred_locale() {
|
||||||
return globalOptions.preferredLocale;
|
return globalOptions.preferredLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function get_preferred_text_locale() {
|
||||||
|
return globalOptions.preferredTextLocale;
|
||||||
|
}
|
||||||
|
|
||||||
do_patch(
|
do_patch(
|
||||||
"Hello world",
|
"Hello world",
|
||||||
/(.*)/,
|
/(.*)/,
|
||||||
|
@ -150,7 +155,7 @@ do_patch(
|
||||||
do_patch(
|
do_patch(
|
||||||
"Set preferred text locale",
|
"Set preferred text locale",
|
||||||
/preferredTextLocale:.\.preferredTextLocale/,
|
/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
|
// run our patched copy of playercore in a non-privileged context on the page
|
||||||
|
|
|
@ -47,7 +47,8 @@ chromeStorageGet({
|
||||||
setMaxBitrate: false,
|
setMaxBitrate: false,
|
||||||
disableVP9: false,
|
disableVP9: false,
|
||||||
useDDPlus: false,
|
useDDPlus: false,
|
||||||
preferredLocale: "en",
|
preferredLocale: null,
|
||||||
|
preferredTextLocale: null,
|
||||||
}).then(items => {
|
}).then(items => {
|
||||||
// very messy workaround for accessing chrome storage outside of background / content scripts
|
// very messy workaround for accessing chrome storage outside of background / content scripts
|
||||||
let mainScript = document.createElement("script");
|
let mainScript = document.createElement("script");
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Netflix International",
|
"name": "Netflix International",
|
||||||
"description": "Displays all available Netflix audio tracks.",
|
"description": "Displays all available Netflix audio tracks.",
|
||||||
"version": "2.0.10",
|
"version": "2.0.11",
|
||||||
"author": "shirt",
|
"author": "shirt",
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
"default_icon": "img/icon128.png",
|
"default_icon": "img/icon128.png",
|
||||||
|
|
|
@ -21,8 +21,45 @@
|
||||||
<br>
|
<br>
|
||||||
<input type="checkbox" id="useDDPlus"><label for="useDDPlus">Use Dolby Digital Plus (Chromium Edge)</label>
|
<input type="checkbox" id="useDDPlus"><label for="useDDPlus">Use Dolby Digital Plus (Chromium Edge)</label>
|
||||||
<br>
|
<br>
|
||||||
<label for="preferredLocale">Preferred language</label>
|
<label for="preferredLocale">Preferred audio language</label>
|
||||||
<select name="preferredLocale" id="preferredLocale">
|
<select name="preferredLocale" id="preferredLocale">
|
||||||
|
<option value="null">None</option>
|
||||||
|
<option value="ar">ar</option>
|
||||||
|
<option value="cs">cs</option>
|
||||||
|
<option value="da">da</option>
|
||||||
|
<option value="de">de</option>
|
||||||
|
<option value="el">el</option>
|
||||||
|
<option value="en">en</option>
|
||||||
|
<option value="es">es</option>
|
||||||
|
<option value="fi">fi</option>
|
||||||
|
<option value="fr">fr</option>
|
||||||
|
<option value="he">he</option>
|
||||||
|
<option value="hi">hi</option>
|
||||||
|
<option value="hr">hr</option>
|
||||||
|
<option value="hu">hu</option>
|
||||||
|
<option value="id">id</option>
|
||||||
|
<option value="it">it</option>
|
||||||
|
<option value="ja">ja</option>
|
||||||
|
<option value="ko">ko</option>
|
||||||
|
<option value="ms">ms</option>
|
||||||
|
<option value="nb">nb</option>
|
||||||
|
<option value="nl">nl</option>
|
||||||
|
<option value="pl">pl</option>
|
||||||
|
<option value="pt">pt</option>
|
||||||
|
<option value="ro">ro</option>
|
||||||
|
<option value="ru">ru</option>
|
||||||
|
<option value="sv">sv</option>
|
||||||
|
<option value="ta">ta</option>
|
||||||
|
<option value="te">te</option>
|
||||||
|
<option value="th">th</option>
|
||||||
|
<option value="tr">tr</option>
|
||||||
|
<option value="uk">uk</option>
|
||||||
|
<option value="vi">vi</option>
|
||||||
|
<option value="zh">zh</option>
|
||||||
|
</select>
|
||||||
|
<label for="preferredTextLocale">Preferred subtitle language</label>
|
||||||
|
<select name="preferredTextLocale" id="preferredTextLocale">
|
||||||
|
<option value="null">None</option>
|
||||||
<option value="ar">ar</option>
|
<option value="ar">ar</option>
|
||||||
<option value="cs">cs</option>
|
<option value="cs">cs</option>
|
||||||
<option value="da">da</option>
|
<option value="da">da</option>
|
||||||
|
|
|
@ -6,6 +6,7 @@ function save_options() {
|
||||||
const disableVP9 = document.getElementById("disableVP9").checked;
|
const disableVP9 = document.getElementById("disableVP9").checked;
|
||||||
const useDDPlus = document.getElementById("useDDPlus").checked;
|
const useDDPlus = document.getElementById("useDDPlus").checked;
|
||||||
const preferredLocale = document.getElementById("preferredLocale").value;
|
const preferredLocale = document.getElementById("preferredLocale").value;
|
||||||
|
const preferredTextLocale = document.getElementById("preferredTextLocale").value;
|
||||||
|
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
use6Channels: use6Channels,
|
use6Channels: use6Channels,
|
||||||
|
@ -14,6 +15,7 @@ function save_options() {
|
||||||
disableVP9: disableVP9,
|
disableVP9: disableVP9,
|
||||||
useDDPlus: useDDPlus,
|
useDDPlus: useDDPlus,
|
||||||
preferredLocale: preferredLocale,
|
preferredLocale: preferredLocale,
|
||||||
|
preferredTextLocale: preferredTextLocale,
|
||||||
}, function() {
|
}, function() {
|
||||||
var status = document.getElementById("status");
|
var status = document.getElementById("status");
|
||||||
status.textContent = "Options saved.";
|
status.textContent = "Options saved.";
|
||||||
|
@ -30,7 +32,8 @@ function restore_options() {
|
||||||
setMaxBitrate: false,
|
setMaxBitrate: false,
|
||||||
disableVP9: false,
|
disableVP9: false,
|
||||||
useDDPlus: false,
|
useDDPlus: false,
|
||||||
preferredLocale: "en",
|
preferredLocale: null,
|
||||||
|
preferredTextLocale: null,
|
||||||
}, function(items) {
|
}, function(items) {
|
||||||
document.getElementById("use51").checked = items.use6Channels;
|
document.getElementById("use51").checked = items.use6Channels;
|
||||||
document.getElementById("showAllTracks").checked = items.showAllTracks;
|
document.getElementById("showAllTracks").checked = items.showAllTracks;
|
||||||
|
@ -38,6 +41,7 @@ function restore_options() {
|
||||||
document.getElementById("disableVP9").checked = items.disableVP9;
|
document.getElementById("disableVP9").checked = items.disableVP9;
|
||||||
document.getElementById("useDDPlus").checked = items.useDDPlus;
|
document.getElementById("useDDPlus").checked = items.useDDPlus;
|
||||||
document.getElementById("preferredLocale").value = items.preferredLocale;
|
document.getElementById("preferredLocale").value = items.preferredLocale;
|
||||||
|
document.getElementById("preferredTextLocale").value = items.preferredTextLocale;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue