mirror of
https://github.com/shirt-dev/netflix-international.git
synced 2025-05-06 00:50:33 +00:00
Compare commits
38 commits
Author | SHA1 | Date | |
---|---|---|---|
d0e76f73bf | |||
2d5268217e | |||
aacc5fc76f | |||
79ca463a5a | |||
1ff293ccf3 | |||
de26c23498 | |||
|
cfe541e0e3 | ||
e577af2849 | |||
24b0d31ab5 | |||
3a84478776 | |||
3435e4d136 | |||
96856b02e0 | |||
0c6844c4bb | |||
a4bc5f94cd | |||
a7bb37d62f | |||
2a06fa2286 | |||
101b56e9a0 | |||
264a18c53e | |||
5216752ee9 | |||
a793273c04 | |||
5ac499f5cf | |||
3a4a467543 | |||
b128e59a8a | |||
31deacb016 | |||
091a46959a | |||
087295e482 | |||
994c72c8a3 | |||
76683a2076 | |||
a8fe307fa7 | |||
71785e47ef | |||
e8da6a1dfd | |||
099dfd0107 | |||
28b4b01913 | |||
2380097d45 | |||
4383594d23 | |||
d598943ed4 | |||
ec7f85d334 | |||
dbda234888 |
15 changed files with 455 additions and 238 deletions
29
.eslintrc.json
Normal file
29
.eslintrc.json
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 12
|
||||
},
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
"tab"
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"double"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"always"
|
||||
]
|
||||
}
|
||||
}
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.zip
|
||||
_metadata
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021 shirt
|
||||
Copyright (c) 2022 shirt
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
Extension to play Netflix with all dubs & subs, 1080p, and 5.1.
|
||||
|
||||
- Firefox: https://addons.mozilla.org/en-US/firefox/addon/netflix-international/
|
||||
- Chrome (currently taken down): https://chrome.google.com/webstore/detail/netflix-international/pbbaoiomplacehgkfnlejmibhmbebaal
|
||||
- Chrome: https://chrome.google.com/webstore/detail/netflix-international/pbbaoiomplacehgkfnlejmibhmbebaal
|
||||
|
||||
Contact me on discord: shirt#1337
|
||||
Contact me on discord: shirt#1337
|
||||
|
||||
# Based on the following extensions
|
||||
- https://github.com/DavidBuchanan314/Turbo-Recadmiumator
|
||||
- https://github.com/truedread/netflix-1080p
|
||||
- https://github.com/lkmvip/netflix-4K-DDplus
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
// https://stackoverflow.com/a/45985333
|
||||
function getBrowser() {
|
||||
if (typeof chrome !== "undefined") {
|
||||
if (typeof browser !== "undefined") {
|
||||
return "Firefox";
|
||||
} else {
|
||||
return "Chrome";
|
||||
}
|
||||
} else {
|
||||
return "Edge";
|
||||
}
|
||||
}
|
||||
|
||||
chrome.webRequest.onBeforeRequest.addListener(
|
||||
function (details) {
|
||||
/* Allow our shim to load an untouched copy */
|
||||
if (details.url.endsWith("?no_filter")) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (getBrowser() == "Chrome") {
|
||||
return {
|
||||
redirectUrl: chrome.extension.getURL("cadmium-playercore-shim.js")
|
||||
};
|
||||
}
|
||||
|
||||
/* Work around funky CORS behaviour on Firefox */
|
||||
else if (getBrowser() == "Firefox") {
|
||||
let filter = browser.webRequest.filterResponseData(details.requestId);
|
||||
let encoder = new TextEncoder();
|
||||
filter.onstop = event => {
|
||||
fetch(browser.extension.getURL("cadmium-playercore-shim.js")).
|
||||
then(response => response.text()).
|
||||
then(text => {
|
||||
filter.write(encoder.encode(text));
|
||||
filter.close();
|
||||
});
|
||||
};
|
||||
return {};
|
||||
}
|
||||
|
||||
else {
|
||||
console.error("Unsupported web browser.");
|
||||
return {};
|
||||
}
|
||||
}, {
|
||||
urls: [
|
||||
"*://assets.nflxext.com/*/ffe/player/html/*",
|
||||
"*://www.assets.nflxext.com/*/ffe/player/html/*"
|
||||
]
|
||||
}, ["blocking"]
|
||||
);
|
|
@ -1,18 +1,29 @@
|
|||
/* This script runs as a drop-in replacement of the original cadmium-playercore */
|
||||
/* eslint-disable no-undef */
|
||||
// This script runs as a drop-in replacement of the original cadmium-playercore. This is not a content script.
|
||||
console.log("Netflix International script active!");
|
||||
|
||||
// promisify chrome storage API for easier chaining
|
||||
function chromeStorageGet(opts) {
|
||||
if (getBrowser() == "Firefox") {
|
||||
return chrome.storage.sync.get(opts);
|
||||
}
|
||||
else {
|
||||
return new Promise(resolve => {
|
||||
chrome.storage.sync.get(opts, resolve);
|
||||
});
|
||||
if (window.globalOptions === undefined) {
|
||||
try {
|
||||
window.globalOptions = JSON.parse(document.getElementById("netflix-intl-settings").innerText);
|
||||
} catch(e) {
|
||||
console.error("Could not load settings:", e);
|
||||
}
|
||||
}
|
||||
|
||||
/* eslint-disable no-undef */
|
||||
// https://stackoverflow.com/a/45985333
|
||||
function getBrowser() {
|
||||
if (typeof chrome !== "undefined") {
|
||||
if (typeof browser !== "undefined") {
|
||||
return "Firefox";
|
||||
} else {
|
||||
return "Chrome";
|
||||
}
|
||||
} else {
|
||||
return "Edge";
|
||||
}
|
||||
}
|
||||
|
||||
function do_patch(desc, needle, replacement) {
|
||||
var match = cadmium_src.match(needle);
|
||||
if (!match) {
|
||||
|
@ -30,40 +41,73 @@ function do_patch(desc, needle, replacement) {
|
|||
the response before the body of this script finishes executing */
|
||||
var request = new XMLHttpRequest();
|
||||
var cadmium_url = document.getElementById("player-core-js").src;
|
||||
request.open("GET", cadmium_url + "?no_filter", false); // synchronous
|
||||
request.open("GET", cadmium_url, false); // synchronous
|
||||
request.send();
|
||||
|
||||
var cadmium_src = request.responseText;
|
||||
|
||||
function get_profile_list() {
|
||||
custom_profiles = [
|
||||
"playready-h264mpl30-dash",
|
||||
"playready-h264mpl31-dash",
|
||||
"playready-h264mpl40-dash",
|
||||
"playready-h264hpl30-dash",
|
||||
"playready-h264hpl31-dash",
|
||||
"playready-h264hpl40-dash",
|
||||
"heaac-2-dash",
|
||||
"heaac-2hq-dash",
|
||||
"simplesdh",
|
||||
"nflx-cmisc",
|
||||
"BIF240",
|
||||
"BIF320"
|
||||
];
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function get_profile_list(original_profiles) {
|
||||
var profiles = original_profiles;
|
||||
// Always add h264 main profiles
|
||||
if (original_profiles.includes("playready-h264mpl30-dash")) {
|
||||
profiles = profiles.concat([
|
||||
"playready-h264mpl30-dash",
|
||||
"playready-h264mpl31-dash",
|
||||
"playready-h264mpl40-dash",
|
||||
"h264mpl30-dash-playready-prk-qc",
|
||||
"h264mpl31-dash-playready-prk-qc",
|
||||
"h264mpl40-dash-playready-prk-qc",
|
||||
]);
|
||||
}
|
||||
|
||||
if (!globalOptions.disableVP9) {
|
||||
custom_profiles = custom_profiles.concat([
|
||||
if (!globalOptions.disableHPL) {
|
||||
if (original_profiles.includes("playready-h264hpl30-dash")) {
|
||||
profiles = profiles.concat([
|
||||
"playready-h264hpl30-dash",
|
||||
"playready-h264hpl31-dash",
|
||||
"playready-h264hpl40-dash",
|
||||
]);
|
||||
}
|
||||
if (original_profiles.includes("h264hpl30-dash-playready-live")) {
|
||||
profiles = profiles.concat([
|
||||
"h264hpl30-dash-playready-live",
|
||||
"h264hpl31-dash-playready-live",
|
||||
"h264hpl40-dash-playready-live",
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
profiles = profiles.filter(val => !val.includes("h264hpl"));
|
||||
}
|
||||
|
||||
if (!globalOptions.disableVP9 && original_profiles.includes("vp9-profile0-L30-dash-cenc")) {
|
||||
profiles = profiles.concat([
|
||||
"vp9-profile0-L30-dash-cenc",
|
||||
"vp9-profile0-L31-dash-cenc",
|
||||
"vp9-profile0-L40-dash-cenc",
|
||||
]);
|
||||
} else {
|
||||
profiles = profiles.filter(val => !val.includes("vp9-"));
|
||||
}
|
||||
|
||||
if (globalOptions.use6Channels) {
|
||||
custom_profiles.push("heaac-5.1-dash");
|
||||
if (!globalOptions.disableAV1 && original_profiles.includes("av1-main-L30-dash-cbcs-prk")) {
|
||||
profiles = profiles.concat([
|
||||
"av1-main-L30-dash-cbcs-prk",
|
||||
"av1-main-L31-dash-cbcs-prk",
|
||||
"av1-main-L40-dash-cbcs-prk",
|
||||
]);
|
||||
} else {
|
||||
profiles = profiles.filter(val => !val.includes("av1-"));
|
||||
}
|
||||
|
||||
return custom_profiles;
|
||||
if (globalOptions.use6Channels) {
|
||||
profiles = profiles.concat([
|
||||
"heaac-5.1-dash",
|
||||
]);
|
||||
}
|
||||
|
||||
profiles = [...new Set(profiles)].sort();
|
||||
return profiles;
|
||||
}
|
||||
|
||||
do_patch(
|
||||
|
@ -74,35 +118,40 @@ do_patch(
|
|||
|
||||
do_patch(
|
||||
"Custom profiles",
|
||||
/(viewableId:.,profiles:).,/,
|
||||
"$1 get_profile_list(),"
|
||||
/(viewableId:.,profiles:)(.),/,
|
||||
"$1 get_profile_list($2),"
|
||||
);
|
||||
|
||||
do_patch(
|
||||
"Custom profiles 2",
|
||||
/(name:"default",profiles:).}/,
|
||||
"$1 get_profile_list()}"
|
||||
)
|
||||
|
||||
do_patch(
|
||||
"Re-enable Ctrl+Shift+Alt+S menu",
|
||||
/this\...\....\s*\&\&\s*this\.toggle\(\);/,
|
||||
"this.toggle();"
|
||||
/(name:"default",profiles:)(.)}/,
|
||||
"$1 get_profile_list($2)}"
|
||||
);
|
||||
|
||||
if (globalOptions.use6Channels) {
|
||||
do_patch("Show channel indicator",
|
||||
/displayName:([^\.]{1})\.([^,]{2}),/,
|
||||
"displayName:$1.$2 + \" - \" + $1.channelsFormat,"
|
||||
)
|
||||
}
|
||||
do_patch(
|
||||
"Re-enable Ctrl+Shift+Alt+B menu",
|
||||
/this\...\....\s*&&\s*this\.toggle\(\);/,
|
||||
"this.toggle();"
|
||||
);
|
||||
|
||||
if (globalOptions.showAllTracks) {
|
||||
do_patch("Show all audio tracks",
|
||||
/"showAllSubDubTracks",!1/,
|
||||
"\"showAllSubDubTracks\",!0"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// run our patched copy of playercore
|
||||
eval(cadmium_src);
|
||||
do_patch(
|
||||
"Set preferred audio locale",
|
||||
/preferredAudioLocale:.\.preferredAudioLocale/,
|
||||
"preferredAudioLocale: globalOptions.preferredLocale"
|
||||
);
|
||||
|
||||
do_patch(
|
||||
"Set preferred text locale",
|
||||
/preferredTextLocale:.\.preferredTextLocale/,
|
||||
"preferredTextLocale: globalOptions.preferredTextLocale"
|
||||
);
|
||||
|
||||
// run our patched copy of playercore in a non-privileged context on the page
|
||||
window.Function(cadmium_src)();
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/* eslint-disable no-undef */
|
||||
|
||||
script_urls = [];
|
||||
var script_urls = [];
|
||||
|
||||
urls = [
|
||||
'netflix_max_bitrate.js'
|
||||
var urls = [
|
||||
"netflix_max_bitrate.js"
|
||||
];
|
||||
|
||||
// https://stackoverflow.com/a/45985333
|
||||
|
@ -20,50 +21,42 @@ function getBrowser() {
|
|||
|
||||
// promisify chrome storage API for easier chaining
|
||||
function chromeStorageGet(opts) {
|
||||
if (getBrowser() == "Firefox") {
|
||||
return chrome.storage.sync.get(opts);
|
||||
}
|
||||
else {
|
||||
return new Promise(resolve => {
|
||||
chrome.storage.sync.get(opts, resolve);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function attachScript(resp) {
|
||||
let xhr = resp.target;
|
||||
let mainScript = document.createElement('script');
|
||||
mainScript.type = 'application/javascript';
|
||||
if (xhr.status == 200) {
|
||||
mainScript.text = xhr.responseText;
|
||||
document.documentElement.appendChild(mainScript);
|
||||
}
|
||||
if (getBrowser() == "Firefox") {
|
||||
return chrome.storage.sync.get(opts);
|
||||
}
|
||||
else {
|
||||
return new Promise(resolve => {
|
||||
chrome.storage.sync.get(opts, resolve);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
chromeStorageGet({
|
||||
use6Channels: true,
|
||||
showAllTracks: true,
|
||||
setMaxBitrate: false,
|
||||
disableVP9: false,
|
||||
use6Channels: true,
|
||||
showAllTracks: true,
|
||||
setMaxBitrate: false,
|
||||
disableVP9: false,
|
||||
disableAV1: true,
|
||||
disableHPL: false,
|
||||
useDDPlus: false,
|
||||
preferredLocale: null,
|
||||
preferredTextLocale: null,
|
||||
}).then(items => {
|
||||
// very messy workaround for accessing chrome storage outside of background / content scripts
|
||||
let mainScript = document.createElement('script');
|
||||
mainScript.type = 'application/javascript';
|
||||
mainScript.text = `var globalOptions = JSON.parse('${JSON.stringify(items)}');`;
|
||||
document.documentElement.appendChild(mainScript);
|
||||
// very messy workaround for accessing chrome storage outside of background / content scripts
|
||||
let mainScript = document.createElement("script");
|
||||
mainScript.type = "application/json";
|
||||
mainScript.id = "netflix-intl-settings";
|
||||
mainScript.text = JSON.stringify(items);
|
||||
document.documentElement.appendChild(mainScript);
|
||||
}).then(() => {
|
||||
// attach and include additional scripts after we have loaded the main configuration
|
||||
for (let i = 0; i < script_urls.length; i++) {
|
||||
let script = document.createElement('script');
|
||||
script.src = script_urls[i];
|
||||
document.documentElement.appendChild(script);
|
||||
}
|
||||
// attach and include additional scripts after we have loaded the main configuration
|
||||
|
||||
for (let i = 0; i < urls.length; i++) {
|
||||
let mainScriptUrl = chrome.extension.getURL(urls[i]);
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', mainScriptUrl, true);
|
||||
xhr.onload = attachScript;
|
||||
xhr.send();
|
||||
}
|
||||
});
|
||||
for (let i = 0; i < urls.length; i++) {
|
||||
const mainScriptUrl = chrome.runtime.getURL(urls[i]);
|
||||
|
||||
const mainScript = document.createElement('script');
|
||||
mainScript.type = 'application/javascript';
|
||||
mainScript.src = mainScriptUrl;
|
||||
document.documentElement.appendChild(mainScript);
|
||||
}
|
||||
});
|
||||
|
|
BIN
img/icon128.png
BIN
img/icon128.png
Binary file not shown.
Before Width: | Height: | Size: 953 B After Width: | Height: | Size: 4.1 KiB |
BIN
img/icon48.png
BIN
img/icon48.png
Binary file not shown.
Before Width: | Height: | Size: 482 B After Width: | Height: | Size: 2.1 KiB |
|
@ -1,11 +1,12 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"manifest_version": 3,
|
||||
"name": "Netflix International",
|
||||
"description": "Displays all available Netflix audio tracks.",
|
||||
"version": "2.0.0",
|
||||
"description": "Displays all available Netflix audio and subtitle tracks.",
|
||||
"version": "2.0.23",
|
||||
"author": "shirt",
|
||||
"browser_action": {
|
||||
"default_icon": "img/icon128.png"
|
||||
"action": {
|
||||
"default_icon": "img/icon128.png",
|
||||
"default_popup": "pages/options.html"
|
||||
},
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
|
@ -18,32 +19,43 @@
|
|||
},
|
||||
"content_scripts": [{
|
||||
"matches": [
|
||||
"*://assets.nflxext.com/*/ffe/player/html/*",
|
||||
"*://www.assets.nflxext.com/*/ffe/player/html/*",
|
||||
"*://netflix.com/*",
|
||||
"*://www.netflix.com/*"
|
||||
],
|
||||
"all_frames": true,
|
||||
"css": ["netflix.css"],
|
||||
"js": ["content_script.js"],
|
||||
"run_at": "document_start"
|
||||
}],
|
||||
"background": {
|
||||
"scripts": ["background.js"]
|
||||
},
|
||||
"options_ui": {
|
||||
"page": "pages/options.html",
|
||||
"open_in_tab": false
|
||||
"open_in_tab": true
|
||||
},
|
||||
"web_accessible_resources": [{
|
||||
"resources": [
|
||||
"cadmium-playercore-shim.js",
|
||||
"netflix_max_bitrate.js",
|
||||
"netflix.css"
|
||||
],
|
||||
"matches": [
|
||||
"*://assets.nflxext.com/*",
|
||||
"*://netflix.com/*",
|
||||
"*://www.netflix.com/*"
|
||||
]
|
||||
}],
|
||||
"declarative_net_request" : {
|
||||
"rule_resources" : [{
|
||||
"id": "1",
|
||||
"enabled": true,
|
||||
"path": "rules.json"
|
||||
}]
|
||||
},
|
||||
"web_accessible_resources": [
|
||||
"cadmium-playercore-shim.js",
|
||||
"netflix_max_bitrate.js"
|
||||
],
|
||||
"permissions": [
|
||||
"storage",
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"*://assets.nflxext.com/*/ffe/player/html/*",
|
||||
"*://www.assets.nflxext.com/*/ffe/player/html/*",
|
||||
"declarativeNetRequestWithHostAccess"
|
||||
],
|
||||
"host_permissions": [
|
||||
"*://assets.nflxext.com/*",
|
||||
"*://netflix.com/*",
|
||||
"*://www.netflix.com/*"
|
||||
]
|
||||
|
|
29
netflix.css
Normal file
29
netflix.css
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* Fixes audio and subtitle picker scrolling */
|
||||
|
||||
.watch-video--selector-audio-subtitle {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
div[data-uia="selector-audio-subtitle"] {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
div[data-uia="selector-audio-subtitle"] > div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
div[data-uia="selector-audio-subtitle"] > div > ul {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
/* Make more tracks visible at once */
|
||||
|
||||
div[data-uia="selector-audio-subtitle"] > div > h3 {
|
||||
padding-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
div[data-uia="selector-audio-subtitle"] > div > ul > li {
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
|
@ -1,62 +1,84 @@
|
|||
/* eslint-disable no-undef */
|
||||
let getElementByXPath = function (xpath) {
|
||||
return document.evaluate(
|
||||
xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null
|
||||
).singleNodeValue;
|
||||
return document.evaluate(
|
||||
xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null
|
||||
).singleNodeValue;
|
||||
};
|
||||
|
||||
const fn = function () {
|
||||
window.dispatchEvent(new KeyboardEvent('keydown', {
|
||||
keyCode: 83,
|
||||
ctrlKey: true,
|
||||
altKey: true,
|
||||
shiftKey: true,
|
||||
}));
|
||||
let fn = function () {
|
||||
const VIDEO_SELECT = getElementByXPath("//div[text()='Video Bitrate']") || getElementByXPath("//div[text()='Video Bitrate / VMAF']");
|
||||
const AUDIO_SELECT = getElementByXPath("//div[text()='Audio Bitrate']");
|
||||
const BUTTON = getElementByXPath("//button[text()='Override']");
|
||||
|
||||
const VIDEO_SELECT = getElementByXPath("//div[text()='Video Bitrate']");
|
||||
const AUDIO_SELECT = getElementByXPath("//div[text()='Audio Bitrate']");
|
||||
const BUTTON = getElementByXPath("//button[text()='Override']");
|
||||
const videoPlayer = netflix.appContext.state.playerApp.getAPI().videoPlayer;
|
||||
if(!videoPlayer) {
|
||||
console.log("API Not Loading!");
|
||||
return false;
|
||||
}
|
||||
const player = videoPlayer.getVideoPlayerBySessionId(videoPlayer.getAllPlayerSessionIds()[0]);
|
||||
if(!player) {
|
||||
console.log("Video Not Loading!");
|
||||
return false;
|
||||
}
|
||||
if(!player.isPlaying()) {
|
||||
console.log("Video Not Playing!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(VIDEO_SELECT && AUDIO_SELECT && BUTTON)){
|
||||
return false;
|
||||
}
|
||||
window.dispatchEvent(new KeyboardEvent('keydown', {
|
||||
keyCode: 66,
|
||||
ctrlKey: true,
|
||||
altKey: true,
|
||||
shiftKey: true,
|
||||
}));
|
||||
|
||||
[VIDEO_SELECT, AUDIO_SELECT].forEach(function (el) {
|
||||
let parent = el.parentElement;
|
||||
if (!(VIDEO_SELECT && AUDIO_SELECT && BUTTON)){
|
||||
return false;
|
||||
}
|
||||
|
||||
let options = parent.querySelectorAll('select > option');
|
||||
[VIDEO_SELECT, AUDIO_SELECT].forEach(function (el) {
|
||||
let parent = el.parentElement;
|
||||
|
||||
for (var i = 0; i < options.length - 1; i++) {
|
||||
options[i].removeAttribute('selected');
|
||||
}
|
||||
let options = parent.querySelectorAll('select > option');
|
||||
|
||||
options[options.length - 1].setAttribute('selected', 'selected');
|
||||
});
|
||||
for (var i = 0; i < options.length - 1; i++) {
|
||||
options[i].removeAttribute('selected');
|
||||
}
|
||||
|
||||
BUTTON.click();
|
||||
options[options.length - 1].setAttribute('selected', 'selected');
|
||||
});
|
||||
|
||||
return true;
|
||||
console.log("Video Playing!");
|
||||
BUTTON.click();
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
let run = function () {
|
||||
if (!fn()) {
|
||||
setTimeout(run, 100);
|
||||
}
|
||||
fn() || setTimeout(run, 100)
|
||||
};
|
||||
|
||||
const WATCH_REGEXP = /netflix.com\/watch\/.*/;
|
||||
|
||||
let oldLocation;
|
||||
|
||||
if(globalOptions.setMaxBitrate) {
|
||||
console.log("netflix_max_bitrate.js enabled");
|
||||
setInterval(function () {
|
||||
let newLocation = window.location.toString();
|
||||
|
||||
if (newLocation !== oldLocation) {
|
||||
oldLocation = newLocation;
|
||||
if (WATCH_REGEXP.test(newLocation)) {
|
||||
run();
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
if (window.globalOptions === undefined) {
|
||||
try {
|
||||
window.globalOptions = JSON.parse(document.getElementById("netflix-intl-settings").innerText);
|
||||
} catch(e) {
|
||||
console.error("Could not load settings:", e);
|
||||
}
|
||||
}
|
||||
if(window.globalOptions.setMaxBitrate ) {
|
||||
console.log("netflix_max_bitrate.js enabled");
|
||||
//setInterval(test, 500);
|
||||
setInterval(function () {
|
||||
|
||||
let newLocation = window.location.toString();
|
||||
|
||||
if (newLocation !== oldLocation) {
|
||||
oldLocation = newLocation;
|
||||
WATCH_REGEXP.test(newLocation) && run();
|
||||
}
|
||||
}, 500);
|
||||
}
|
|
@ -3,6 +3,12 @@
|
|||
|
||||
<head>
|
||||
<title>Netflix International Options</title>
|
||||
<style>
|
||||
body {
|
||||
min-width: 300px;
|
||||
font-family: Sans-Serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -13,9 +19,59 @@
|
|||
<input type="checkbox" id="setMaxBitrate"><label for="setMaxBitrate">Automatically select best bitrate available</label>
|
||||
<br>
|
||||
<input type="checkbox" id="disableVP9"><label for="disableVP9">Disable VP9 codec</label>
|
||||
<br>
|
||||
<input type="checkbox" id="disableAV1"><label for="disableAV1">Disable AV1 codec</label>
|
||||
<br>
|
||||
<input type="checkbox" id="disableHPL"><label for="disableHPL">Disable H264 HPL profile</label>
|
||||
<br>
|
||||
<label for="preferredLocale">Preferred audio language</label>
|
||||
<input list="locales" id="preferredLocale" maxlength="5">
|
||||
<br>
|
||||
<label for="preferredTextLocale">Preferred subtitle language</label>
|
||||
<input list="locales" id="preferredTextLocale" maxlength="5">
|
||||
<br>
|
||||
|
||||
<datalist name="locales" id="locales">
|
||||
<option value="ar">
|
||||
<option value="cs">
|
||||
<option value="da">
|
||||
<option value="de">
|
||||
<option value="el">
|
||||
<option value="en">
|
||||
<option value="es">
|
||||
<option value="es-ES">
|
||||
<option value="fi">
|
||||
<option value="fr">
|
||||
<option value="he">
|
||||
<option value="hi">
|
||||
<option value="hr">
|
||||
<option value="hu">
|
||||
<option value="id">
|
||||
<option value="it">
|
||||
<option value="ja">
|
||||
<option value="ko">
|
||||
<option value="ms">
|
||||
<option value="nb">
|
||||
<option value="nl">
|
||||
<option value="pl">
|
||||
<option value="pt">
|
||||
<option value="pt-BR">
|
||||
<option value="ro">
|
||||
<option value="ru">
|
||||
<option value="sv">
|
||||
<option value="ta">
|
||||
<option value="te">
|
||||
<option value="th">
|
||||
<option value="tr">
|
||||
<option value="uk">
|
||||
<option value="vi">
|
||||
<option value="zh">
|
||||
</datalist>
|
||||
|
||||
<br>
|
||||
<div id="status"></div>
|
||||
<button id="save">Save</button>
|
||||
<button id="reset">Reset</button>
|
||||
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
|
|
104
pages/options.js
104
pages/options.js
|
@ -1,36 +1,82 @@
|
|||
/* eslint-disable no-undef */
|
||||
function save_options() {
|
||||
const use6Channels = document.getElementById("use51").checked;
|
||||
const showAllTracks = document.getElementById("showAllTracks").checked;
|
||||
const setMaxBitrate = document.getElementById("setMaxBitrate").checked;
|
||||
const disableVP9 = document.getElementById("disableVP9").checked;
|
||||
const use6Channels = document.getElementById("use51").checked;
|
||||
const showAllTracks = document.getElementById("showAllTracks").checked;
|
||||
const setMaxBitrate = document.getElementById("setMaxBitrate").checked;
|
||||
const disableVP9 = document.getElementById("disableVP9").checked;
|
||||
const disableAV1 = document.getElementById("disableAV1").checked;
|
||||
const disableHPL = document.getElementById("disableHPL").checked;
|
||||
const preferredLocale = document.getElementById("preferredLocale").value;
|
||||
const preferredTextLocale = document.getElementById("preferredTextLocale").value;
|
||||
|
||||
chrome.storage.sync.set({
|
||||
use6Channels,
|
||||
showAllTracks,
|
||||
setMaxBitrate,
|
||||
disableVP9,
|
||||
}, function() {
|
||||
var status = document.getElementById('status');
|
||||
status.textContent = 'Options saved.';
|
||||
setTimeout(function() {
|
||||
status.textContent = '';
|
||||
}, 750);
|
||||
});
|
||||
chrome.storage.sync.set({
|
||||
use6Channels: use6Channels,
|
||||
showAllTracks: showAllTracks,
|
||||
setMaxBitrate: setMaxBitrate,
|
||||
disableVP9: disableVP9,
|
||||
disableAV1: disableAV1,
|
||||
disableHPL: disableHPL,
|
||||
preferredLocale: preferredLocale,
|
||||
preferredTextLocale: preferredTextLocale,
|
||||
}, function() {
|
||||
var status = document.getElementById("status");
|
||||
status.textContent = "Options saved.";
|
||||
setTimeout(function() {
|
||||
status.textContent = "";
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
function reset_options() {
|
||||
document.getElementById("use51").checked = true;
|
||||
document.getElementById("showAllTracks").checked = true;
|
||||
document.getElementById("setMaxBitrate").checked = false;
|
||||
document.getElementById("disableVP9").checked = false;
|
||||
document.getElementById("disableAV1").checked = true;
|
||||
document.getElementById("disableHPL").checked = false;
|
||||
document.getElementById("preferredLocale").value = null;
|
||||
document.getElementById("preferredTextLocale").value = null;
|
||||
|
||||
chrome.storage.sync.set({
|
||||
use6Channels: true,
|
||||
showAllTracks: true,
|
||||
setMaxBitrate: false,
|
||||
disableVP9: false,
|
||||
disableAV1: true,
|
||||
disableHPL: false,
|
||||
preferredLocale: null,
|
||||
preferredTextLocale: null,
|
||||
}, function() {
|
||||
var status = document.getElementById("status");
|
||||
status.textContent = "Options reset.";
|
||||
setTimeout(function() {
|
||||
status.textContent = "";
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
function restore_options() {
|
||||
chrome.storage.sync.get({
|
||||
use6Channels: true,
|
||||
showAllTracks: true,
|
||||
setMaxBitrate: false,
|
||||
disableVP9: false,
|
||||
}, 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;
|
||||
});
|
||||
chrome.storage.sync.get({
|
||||
use6Channels: true,
|
||||
showAllTracks: true,
|
||||
setMaxBitrate: false,
|
||||
disableVP9: false,
|
||||
disableAV1: true,
|
||||
disableHPL: false,
|
||||
preferredLocale: null,
|
||||
preferredTextLocale: null,
|
||||
}, 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("disableAV1").checked = items.disableAV1;
|
||||
document.getElementById("disableHPL").checked = items.disableHPL;
|
||||
document.getElementById("preferredLocale").value = items.preferredLocale;
|
||||
document.getElementById("preferredTextLocale").value = items.preferredTextLocale;
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', restore_options);
|
||||
document.getElementById('save').addEventListener('click', save_options);
|
||||
document.addEventListener("DOMContentLoaded", restore_options);
|
||||
document.getElementById("save").addEventListener("click", save_options);
|
||||
document.getElementById("reset").addEventListener("click", reset_options);
|
||||
|
|
26
rules.json
Normal file
26
rules.json
Normal file
|
@ -0,0 +1,26 @@
|
|||
[
|
||||
{
|
||||
"id": 1,
|
||||
"priority": 1,
|
||||
"action": {
|
||||
"type": "redirect",
|
||||
"redirect": { "extensionPath": "/cadmium-playercore-shim.js" }
|
||||
},
|
||||
"condition": {
|
||||
"urlFilter": "*://assets.nflxext.com/*/ffe/player/html/*",
|
||||
"resourceTypes": ["script"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"priority": 1,
|
||||
"action": {
|
||||
"type": "redirect",
|
||||
"redirect": { "extensionPath": "/cadmium-playercore-shim.js" }
|
||||
},
|
||||
"condition": {
|
||||
"urlFilter": "*://assets.nflxext.com/player/html/ffe/*",
|
||||
"resourceTypes": ["script"]
|
||||
}
|
||||
}
|
||||
]
|
Loading…
Add table
Reference in a new issue