mirror of
https://github.com/shirt-dev/netflix-international.git
synced 2025-05-03 16:30:33 +00:00
Add preferred language option (closes #1)
This commit is contained in:
parent
5ac499f5cf
commit
a793273c04
5 changed files with 66 additions and 2 deletions
|
@ -105,6 +105,11 @@ function get_profile_list() {
|
|||
return custom_profiles;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function get_preferred_locale() {
|
||||
return globalOptions.preferredLocale;
|
||||
}
|
||||
|
||||
do_patch(
|
||||
"Hello world",
|
||||
/(.*)/,
|
||||
|
@ -136,5 +141,17 @@ if (globalOptions.showAllTracks) {
|
|||
);
|
||||
}
|
||||
|
||||
do_patch(
|
||||
"Set preferred audio locale",
|
||||
/preferredAudioLocale:.\.preferredAudioLocale/,
|
||||
"preferredAudioLocale: get_preferred_locale()"
|
||||
);
|
||||
|
||||
do_patch(
|
||||
"Set preferred text locale",
|
||||
/preferredTextLocale:.\.preferredTextLocale/,
|
||||
"preferredTextLocale: get_preferred_locale()"
|
||||
);
|
||||
|
||||
// run our patched copy of playercore in a non-privileged context on the page
|
||||
window.Function(cadmium_src)();
|
||||
|
|
|
@ -47,6 +47,7 @@ chromeStorageGet({
|
|||
setMaxBitrate: false,
|
||||
disableVP9: false,
|
||||
useDDPlus: false,
|
||||
preferredLocale: "en",
|
||||
}).then(items => {
|
||||
// very messy workaround for accessing chrome storage outside of background / content scripts
|
||||
let mainScript = document.createElement("script");
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
"manifest_version": 2,
|
||||
"name": "Netflix International",
|
||||
"description": "Displays all available Netflix audio tracks.",
|
||||
"version": "2.0.9",
|
||||
"version": "2.0.10",
|
||||
"author": "shirt",
|
||||
"browser_action": {
|
||||
"default_icon": "img/icon128.png"
|
||||
"default_icon": "img/icon128.png",
|
||||
"default_popup": "pages/options.html"
|
||||
},
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
|
||||
<head>
|
||||
<title>Netflix International Options</title>
|
||||
<style>
|
||||
body {
|
||||
min-width: 300px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -16,6 +21,42 @@
|
|||
<br>
|
||||
<input type="checkbox" id="useDDPlus"><label for="useDDPlus">Use Dolby Digital Plus (Chromium Edge)</label>
|
||||
<br>
|
||||
<label for="preferredLocale">Preferred language</label>
|
||||
<select name="preferredLocale" id="preferredLocale">
|
||||
<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>
|
||||
<br>
|
||||
|
||||
<div id="status"></div>
|
||||
<button id="save">Save</button>
|
||||
|
|
|
@ -5,6 +5,7 @@ function save_options() {
|
|||
const setMaxBitrate = document.getElementById("setMaxBitrate").checked;
|
||||
const disableVP9 = document.getElementById("disableVP9").checked;
|
||||
const useDDPlus = document.getElementById("useDDPlus").checked;
|
||||
const preferredLocale = document.getElementById("preferredLocale").value;
|
||||
|
||||
chrome.storage.sync.set({
|
||||
use6Channels: use6Channels,
|
||||
|
@ -12,6 +13,7 @@ function save_options() {
|
|||
setMaxBitrate: setMaxBitrate,
|
||||
disableVP9: disableVP9,
|
||||
useDDPlus: useDDPlus,
|
||||
preferredLocale: preferredLocale,
|
||||
}, function() {
|
||||
var status = document.getElementById("status");
|
||||
status.textContent = "Options saved.";
|
||||
|
@ -28,12 +30,14 @@ function restore_options() {
|
|||
setMaxBitrate: false,
|
||||
disableVP9: false,
|
||||
useDDPlus: false,
|
||||
preferredLocale: "en",
|
||||
}, function(items) {
|
||||
document.getElementById("use51").checked = items.use6Channels;
|
||||
document.getElementById("showAllTracks").checked = items.showAllTracks;
|
||||
document.getElementById("setMaxBitrate").checked = items.setMaxBitrate;
|
||||
document.getElementById("disableVP9").checked = items.disableVP9;
|
||||
document.getElementById("useDDPlus").checked = items.useDDPlus;
|
||||
document.getElementById("preferredLocale").value = items.preferredLocale;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue