mirror of
https://github.com/shirt-dev/netflix-international.git
synced 2025-05-06 17:00:34 +00:00
Compare commits
No commits in common. "main" and "v2.0.12" have entirely different histories.
12 changed files with 202 additions and 202 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1 @@
|
||||||
*.zip
|
*.zip
|
||||||
_metadata
|
|
||||||
|
|
|
@ -9,4 +9,3 @@ Contact me on discord: shirt#1337
|
||||||
# Based on the following extensions
|
# Based on the following extensions
|
||||||
- https://github.com/DavidBuchanan314/Turbo-Recadmiumator
|
- https://github.com/DavidBuchanan314/Turbo-Recadmiumator
|
||||||
- https://github.com/truedread/netflix-1080p
|
- https://github.com/truedread/netflix-1080p
|
||||||
- https://github.com/lkmvip/netflix-4K-DDplus
|
|
||||||
|
|
51
background.js
Normal file
51
background.js
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/* 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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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.runtime.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 = () => {
|
||||||
|
fetch(browser.runtime.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"]
|
||||||
|
);
|
|
@ -2,28 +2,6 @@
|
||||||
// This script runs as a drop-in replacement of the original cadmium-playercore. This is not a content script.
|
// 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!");
|
console.log("Netflix International script active!");
|
||||||
|
|
||||||
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) {
|
function do_patch(desc, needle, replacement) {
|
||||||
var match = cadmium_src.match(needle);
|
var match = cadmium_src.match(needle);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
|
@ -41,73 +19,100 @@ function do_patch(desc, needle, replacement) {
|
||||||
the response before the body of this script finishes executing */
|
the response before the body of this script finishes executing */
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
var cadmium_url = document.getElementById("player-core-js").src;
|
var cadmium_url = document.getElementById("player-core-js").src;
|
||||||
request.open("GET", cadmium_url, false); // synchronous
|
request.open("GET", cadmium_url + "?no_filter", false); // synchronous
|
||||||
request.send();
|
request.send();
|
||||||
|
|
||||||
var cadmium_src = request.responseText;
|
var cadmium_src = request.responseText;
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
function get_profile_list(original_profiles) {
|
function get_profile_list() {
|
||||||
var profiles = original_profiles;
|
|
||||||
// Always add h264 main profiles
|
// Always add h264 main profiles
|
||||||
if (original_profiles.includes("playready-h264mpl30-dash")) {
|
var custom_profiles = [
|
||||||
profiles = profiles.concat([
|
|
||||||
"playready-h264mpl30-dash",
|
"playready-h264mpl30-dash",
|
||||||
"playready-h264mpl31-dash",
|
"playready-h264mpl31-dash",
|
||||||
"playready-h264mpl40-dash",
|
"playready-h264mpl40-dash",
|
||||||
"h264mpl30-dash-playready-prk-qc",
|
];
|
||||||
"h264mpl31-dash-playready-prk-qc",
|
|
||||||
"h264mpl40-dash-playready-prk-qc",
|
if (window.MSMediaKeys) {
|
||||||
|
// PlayReady Specific
|
||||||
|
|
||||||
|
// Always add 2.0 AAC profiles, some manifests fail without them
|
||||||
|
custom_profiles = custom_profiles.concat([
|
||||||
|
"heaac-2-dash",
|
||||||
|
"heaac-2hq-dash",
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (globalOptions.useDDPlus) {
|
||||||
|
// Dolby Digital
|
||||||
|
custom_profiles = custom_profiles.concat([
|
||||||
|
"ddplus-2.0-dash",
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (globalOptions.use6Channels) {
|
||||||
|
custom_profiles = custom_profiles.concat([
|
||||||
|
"ddplus-5.1-dash",
|
||||||
|
"ddplus-5.1hq-dash",
|
||||||
|
"ddplus-atmos-dash",
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// No Dolby Digital
|
||||||
|
if (globalOptions.use6Channels) {
|
||||||
|
custom_profiles = custom_profiles.concat([
|
||||||
|
"heaac-5.1-dash",
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!globalOptions.disableHPL) {
|
|
||||||
if (original_profiles.includes("playready-h264hpl30-dash")) {
|
} else {
|
||||||
profiles = profiles.concat([
|
// Widevine Specific
|
||||||
|
custom_profiles = custom_profiles.concat([
|
||||||
"playready-h264hpl30-dash",
|
"playready-h264hpl30-dash",
|
||||||
"playready-h264hpl31-dash",
|
"playready-h264hpl31-dash",
|
||||||
"playready-h264hpl40-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")) {
|
if (!globalOptions.disableVP9) {
|
||||||
profiles = profiles.concat([
|
// Add VP9 Profiles if wanted
|
||||||
|
custom_profiles = custom_profiles.concat([
|
||||||
"vp9-profile0-L30-dash-cenc",
|
"vp9-profile0-L30-dash-cenc",
|
||||||
"vp9-profile0-L31-dash-cenc",
|
"vp9-profile0-L31-dash-cenc",
|
||||||
"vp9-profile0-L40-dash-cenc",
|
"vp9-profile0-L40-dash-cenc",
|
||||||
]);
|
]);
|
||||||
} else {
|
|
||||||
profiles = profiles.filter(val => !val.includes("vp9-"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!globalOptions.disableAV1 && original_profiles.includes("av1-main-L30-dash-cbcs-prk")) {
|
custom_profiles = custom_profiles.concat([
|
||||||
profiles = profiles.concat([
|
"heaac-2-dash",
|
||||||
"av1-main-L30-dash-cbcs-prk",
|
"heaac-2hq-dash",
|
||||||
"av1-main-L31-dash-cbcs-prk",
|
|
||||||
"av1-main-L40-dash-cbcs-prk",
|
|
||||||
]);
|
]);
|
||||||
} else {
|
|
||||||
profiles = profiles.filter(val => !val.includes("av1-"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (globalOptions.use6Channels) {
|
if (globalOptions.use6Channels) {
|
||||||
profiles = profiles.concat([
|
custom_profiles = custom_profiles.concat([
|
||||||
"heaac-5.1-dash",
|
"heaac-5.1-dash",
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
profiles = [...new Set(profiles)].sort();
|
// Always add subtitles
|
||||||
return profiles;
|
custom_profiles = custom_profiles.concat([
|
||||||
|
"simplesdh",
|
||||||
|
"nflx-cmisc",
|
||||||
|
"BIF240",
|
||||||
|
"BIF320",
|
||||||
|
]);
|
||||||
|
|
||||||
|
return custom_profiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function get_preferred_locale() {
|
||||||
|
return globalOptions.preferredLocale;
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function get_preferred_text_locale() {
|
||||||
|
return globalOptions.preferredTextLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
do_patch(
|
do_patch(
|
||||||
|
@ -118,18 +123,18 @@ do_patch(
|
||||||
|
|
||||||
do_patch(
|
do_patch(
|
||||||
"Custom profiles",
|
"Custom profiles",
|
||||||
/(viewableId:.,profiles:)(.),/,
|
/(viewableId:.,profiles:).,/,
|
||||||
"$1 get_profile_list($2),"
|
"$1 get_profile_list(),"
|
||||||
);
|
);
|
||||||
|
|
||||||
do_patch(
|
do_patch(
|
||||||
"Custom profiles 2",
|
"Custom profiles 2",
|
||||||
/(name:"default",profiles:)(.)}/,
|
/(name:"default",profiles:).}/,
|
||||||
"$1 get_profile_list($2)}"
|
"$1 get_profile_list()}"
|
||||||
);
|
);
|
||||||
|
|
||||||
do_patch(
|
do_patch(
|
||||||
"Re-enable Ctrl+Shift+Alt+B menu",
|
"Re-enable Ctrl+Shift+Alt+S menu",
|
||||||
/this\...\....\s*&&\s*this\.toggle\(\);/,
|
/this\...\....\s*&&\s*this\.toggle\(\);/,
|
||||||
"this.toggle();"
|
"this.toggle();"
|
||||||
);
|
);
|
||||||
|
@ -144,13 +149,13 @@ if (globalOptions.showAllTracks) {
|
||||||
do_patch(
|
do_patch(
|
||||||
"Set preferred audio locale",
|
"Set preferred audio locale",
|
||||||
/preferredAudioLocale:.\.preferredAudioLocale/,
|
/preferredAudioLocale:.\.preferredAudioLocale/,
|
||||||
"preferredAudioLocale: globalOptions.preferredLocale"
|
"preferredAudioLocale: get_preferred_locale()"
|
||||||
);
|
);
|
||||||
|
|
||||||
do_patch(
|
do_patch(
|
||||||
"Set preferred text locale",
|
"Set preferred text locale",
|
||||||
/preferredTextLocale:.\.preferredTextLocale/,
|
/preferredTextLocale:.\.preferredTextLocale/,
|
||||||
"preferredTextLocale: globalOptions.preferredTextLocale"
|
"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
|
||||||
|
|
|
@ -31,32 +31,43 @@ function chromeStorageGet(opts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
chromeStorageGet({
|
chromeStorageGet({
|
||||||
use6Channels: true,
|
use6Channels: true,
|
||||||
showAllTracks: true,
|
showAllTracks: true,
|
||||||
setMaxBitrate: false,
|
setMaxBitrate: false,
|
||||||
disableVP9: false,
|
disableVP9: false,
|
||||||
disableAV1: true,
|
|
||||||
disableHPL: false,
|
|
||||||
useDDPlus: false,
|
useDDPlus: false,
|
||||||
preferredLocale: null,
|
preferredLocale: null,
|
||||||
preferredTextLocale: 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");
|
||||||
mainScript.type = "application/json";
|
mainScript.type = "application/javascript";
|
||||||
mainScript.id = "netflix-intl-settings";
|
mainScript.text = `var globalOptions = JSON.parse('${JSON.stringify(items)}');`;
|
||||||
mainScript.text = JSON.stringify(items);
|
|
||||||
document.documentElement.appendChild(mainScript);
|
document.documentElement.appendChild(mainScript);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
// attach and include additional scripts after we have loaded the main configuration
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < urls.length; i++) {
|
for (let i = 0; i < urls.length; i++) {
|
||||||
const mainScriptUrl = chrome.runtime.getURL(urls[i]);
|
let mainScriptUrl = chrome.extension.getURL(urls[i]);
|
||||||
|
let xhr = new XMLHttpRequest();
|
||||||
const mainScript = document.createElement('script');
|
xhr.open("GET", mainScriptUrl, true);
|
||||||
mainScript.type = 'application/javascript';
|
xhr.onload = attachScript;
|
||||||
mainScript.src = mainScriptUrl;
|
xhr.send();
|
||||||
document.documentElement.appendChild(mainScript);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
BIN
img/icon128.png
BIN
img/icon128.png
Binary file not shown.
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 953 B |
BIN
img/icon48.png
BIN
img/icon48.png
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 482 B |
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 2,
|
||||||
"name": "Netflix International",
|
"name": "Netflix International",
|
||||||
"description": "Displays all available Netflix audio and subtitle tracks.",
|
"description": "Displays all available Netflix audio and subtitle tracks.",
|
||||||
"version": "2.0.23",
|
"version": "2.0.12",
|
||||||
"author": "shirt",
|
"author": "shirt",
|
||||||
"action": {
|
"browser_action": {
|
||||||
"default_icon": "img/icon128.png",
|
"default_icon": "img/icon128.png",
|
||||||
"default_popup": "pages/options.html"
|
"default_popup": "pages/options.html"
|
||||||
},
|
},
|
||||||
|
@ -19,6 +19,8 @@
|
||||||
},
|
},
|
||||||
"content_scripts": [{
|
"content_scripts": [{
|
||||||
"matches": [
|
"matches": [
|
||||||
|
"*://assets.nflxext.com/*/ffe/player/html/*",
|
||||||
|
"*://www.assets.nflxext.com/*/ffe/player/html/*",
|
||||||
"*://netflix.com/*",
|
"*://netflix.com/*",
|
||||||
"*://www.netflix.com/*"
|
"*://www.netflix.com/*"
|
||||||
],
|
],
|
||||||
|
@ -27,35 +29,24 @@
|
||||||
"js": ["content_script.js"],
|
"js": ["content_script.js"],
|
||||||
"run_at": "document_start"
|
"run_at": "document_start"
|
||||||
}],
|
}],
|
||||||
|
"background": {
|
||||||
|
"scripts": ["background.js"]
|
||||||
|
},
|
||||||
"options_ui": {
|
"options_ui": {
|
||||||
"page": "pages/options.html",
|
"page": "pages/options.html",
|
||||||
"open_in_tab": true
|
"open_in_tab": true
|
||||||
},
|
},
|
||||||
"web_accessible_resources": [{
|
"web_accessible_resources": [
|
||||||
"resources": [
|
|
||||||
"cadmium-playercore-shim.js",
|
"cadmium-playercore-shim.js",
|
||||||
"netflix_max_bitrate.js",
|
"netflix_max_bitrate.js",
|
||||||
"netflix.css"
|
"netflix.css"
|
||||||
],
|
],
|
||||||
"matches": [
|
|
||||||
"*://assets.nflxext.com/*",
|
|
||||||
"*://netflix.com/*",
|
|
||||||
"*://www.netflix.com/*"
|
|
||||||
]
|
|
||||||
}],
|
|
||||||
"declarative_net_request" : {
|
|
||||||
"rule_resources" : [{
|
|
||||||
"id": "1",
|
|
||||||
"enabled": true,
|
|
||||||
"path": "rules.json"
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"storage",
|
"storage",
|
||||||
"declarativeNetRequestWithHostAccess"
|
"webRequest",
|
||||||
],
|
"webRequestBlocking",
|
||||||
"host_permissions": [
|
"*://assets.nflxext.com/*/ffe/player/html/*",
|
||||||
"*://assets.nflxext.com/*",
|
"*://www.assets.nflxext.com/*/ffe/player/html/*",
|
||||||
"*://netflix.com/*",
|
"*://netflix.com/*",
|
||||||
"*://www.netflix.com/*"
|
"*://www.netflix.com/*"
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,33 +5,18 @@ let getElementByXPath = function (xpath) {
|
||||||
).singleNodeValue;
|
).singleNodeValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let fn = function () {
|
const fn = function () {
|
||||||
const VIDEO_SELECT = getElementByXPath("//div[text()='Video Bitrate']") || getElementByXPath("//div[text()='Video Bitrate / VMAF']");
|
window.dispatchEvent(new KeyboardEvent("keydown", {
|
||||||
const AUDIO_SELECT = getElementByXPath("//div[text()='Audio Bitrate']");
|
keyCode: 83,
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.dispatchEvent(new KeyboardEvent('keydown', {
|
|
||||||
keyCode: 66,
|
|
||||||
ctrlKey: true,
|
ctrlKey: true,
|
||||||
altKey: true,
|
altKey: true,
|
||||||
shiftKey: true,
|
shiftKey: true,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const VIDEO_SELECT = getElementByXPath("//div[text()='Video Bitrate']");
|
||||||
|
const AUDIO_SELECT = getElementByXPath("//div[text()='Audio Bitrate']");
|
||||||
|
const BUTTON = getElementByXPath("//button[text()='Override']");
|
||||||
|
|
||||||
if (!(VIDEO_SELECT && AUDIO_SELECT && BUTTON)){
|
if (!(VIDEO_SELECT && AUDIO_SELECT && BUTTON)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -39,46 +24,40 @@ let fn = function () {
|
||||||
[VIDEO_SELECT, AUDIO_SELECT].forEach(function (el) {
|
[VIDEO_SELECT, AUDIO_SELECT].forEach(function (el) {
|
||||||
let parent = el.parentElement;
|
let parent = el.parentElement;
|
||||||
|
|
||||||
let options = parent.querySelectorAll('select > option');
|
let options = parent.querySelectorAll("select > option");
|
||||||
|
|
||||||
for (var i = 0; i < options.length - 1; i++) {
|
for (var i = 0; i < options.length - 1; i++) {
|
||||||
options[i].removeAttribute('selected');
|
options[i].removeAttribute("selected");
|
||||||
}
|
}
|
||||||
|
|
||||||
options[options.length - 1].setAttribute('selected', 'selected');
|
options[options.length - 1].setAttribute("selected", "selected");
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Video Playing!");
|
|
||||||
BUTTON.click();
|
BUTTON.click();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
let run = function () {
|
let run = function () {
|
||||||
fn() || setTimeout(run, 100)
|
if (!fn()) {
|
||||||
|
setTimeout(run, 100);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const WATCH_REGEXP = /netflix.com\/watch\/.*/;
|
const WATCH_REGEXP = /netflix.com\/watch\/.*/;
|
||||||
|
|
||||||
let oldLocation;
|
let oldLocation;
|
||||||
|
|
||||||
if (window.globalOptions === undefined) {
|
if(globalOptions.setMaxBitrate) {
|
||||||
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");
|
console.log("netflix_max_bitrate.js enabled");
|
||||||
//setInterval(test, 500);
|
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
|
|
||||||
let newLocation = window.location.toString();
|
let newLocation = window.location.toString();
|
||||||
|
|
||||||
if (newLocation !== oldLocation) {
|
if (newLocation !== oldLocation) {
|
||||||
oldLocation = newLocation;
|
oldLocation = newLocation;
|
||||||
WATCH_REGEXP.test(newLocation) && run();
|
if (WATCH_REGEXP.test(newLocation)) {
|
||||||
|
run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
|
@ -6,7 +6,6 @@
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
font-family: Sans-Serif;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
@ -18,11 +17,9 @@
|
||||||
<br>
|
<br>
|
||||||
<input type="checkbox" id="setMaxBitrate"><label for="setMaxBitrate">Automatically select best bitrate available</label>
|
<input type="checkbox" id="setMaxBitrate"><label for="setMaxBitrate">Automatically select best bitrate available</label>
|
||||||
<br>
|
<br>
|
||||||
<input type="checkbox" id="disableVP9"><label for="disableVP9">Disable VP9 codec</label>
|
<input type="checkbox" id="disableVP9"><label for="disableVP9">Disable VP9 codec (Chrome / Firefox)</label>
|
||||||
<br>
|
<br>
|
||||||
<input type="checkbox" id="disableAV1"><label for="disableAV1">Disable AV1 codec</label>
|
<input type="checkbox" id="useDDPlus"><label for="useDDPlus">Use Dolby Digital Plus (Chromium Edge)</label>
|
||||||
<br>
|
|
||||||
<input type="checkbox" id="disableHPL"><label for="disableHPL">Disable H264 HPL profile</label>
|
|
||||||
<br>
|
<br>
|
||||||
<label for="preferredLocale">Preferred audio language</label>
|
<label for="preferredLocale">Preferred audio language</label>
|
||||||
<input list="locales" id="preferredLocale" maxlength="5">
|
<input list="locales" id="preferredLocale" maxlength="5">
|
||||||
|
|
|
@ -4,8 +4,7 @@ function save_options() {
|
||||||
const showAllTracks = document.getElementById("showAllTracks").checked;
|
const showAllTracks = document.getElementById("showAllTracks").checked;
|
||||||
const setMaxBitrate = document.getElementById("setMaxBitrate").checked;
|
const setMaxBitrate = document.getElementById("setMaxBitrate").checked;
|
||||||
const disableVP9 = document.getElementById("disableVP9").checked;
|
const disableVP9 = document.getElementById("disableVP9").checked;
|
||||||
const disableAV1 = document.getElementById("disableAV1").checked;
|
const useDDPlus = document.getElementById("useDDPlus").checked;
|
||||||
const disableHPL = document.getElementById("disableHPL").checked;
|
|
||||||
const preferredLocale = document.getElementById("preferredLocale").value;
|
const preferredLocale = document.getElementById("preferredLocale").value;
|
||||||
const preferredTextLocale = document.getElementById("preferredTextLocale").value;
|
const preferredTextLocale = document.getElementById("preferredTextLocale").value;
|
||||||
|
|
||||||
|
@ -14,8 +13,7 @@ function save_options() {
|
||||||
showAllTracks: showAllTracks,
|
showAllTracks: showAllTracks,
|
||||||
setMaxBitrate: setMaxBitrate,
|
setMaxBitrate: setMaxBitrate,
|
||||||
disableVP9: disableVP9,
|
disableVP9: disableVP9,
|
||||||
disableAV1: disableAV1,
|
useDDPlus: useDDPlus,
|
||||||
disableHPL: disableHPL,
|
|
||||||
preferredLocale: preferredLocale,
|
preferredLocale: preferredLocale,
|
||||||
preferredTextLocale: preferredTextLocale,
|
preferredTextLocale: preferredTextLocale,
|
||||||
}, function() {
|
}, function() {
|
||||||
|
@ -32,8 +30,7 @@ function reset_options() {
|
||||||
document.getElementById("showAllTracks").checked = true;
|
document.getElementById("showAllTracks").checked = true;
|
||||||
document.getElementById("setMaxBitrate").checked = false;
|
document.getElementById("setMaxBitrate").checked = false;
|
||||||
document.getElementById("disableVP9").checked = false;
|
document.getElementById("disableVP9").checked = false;
|
||||||
document.getElementById("disableAV1").checked = true;
|
document.getElementById("useDDPlus").checked = false;
|
||||||
document.getElementById("disableHPL").checked = false;
|
|
||||||
document.getElementById("preferredLocale").value = null;
|
document.getElementById("preferredLocale").value = null;
|
||||||
document.getElementById("preferredTextLocale").value = null;
|
document.getElementById("preferredTextLocale").value = null;
|
||||||
|
|
||||||
|
@ -42,8 +39,7 @@ function reset_options() {
|
||||||
showAllTracks: true,
|
showAllTracks: true,
|
||||||
setMaxBitrate: false,
|
setMaxBitrate: false,
|
||||||
disableVP9: false,
|
disableVP9: false,
|
||||||
disableAV1: true,
|
useDDPlus: false,
|
||||||
disableHPL: false,
|
|
||||||
preferredLocale: null,
|
preferredLocale: null,
|
||||||
preferredTextLocale: null,
|
preferredTextLocale: null,
|
||||||
}, function() {
|
}, function() {
|
||||||
|
@ -61,8 +57,7 @@ function restore_options() {
|
||||||
showAllTracks: true,
|
showAllTracks: true,
|
||||||
setMaxBitrate: false,
|
setMaxBitrate: false,
|
||||||
disableVP9: false,
|
disableVP9: false,
|
||||||
disableAV1: true,
|
useDDPlus: false,
|
||||||
disableHPL: false,
|
|
||||||
preferredLocale: null,
|
preferredLocale: null,
|
||||||
preferredTextLocale: null,
|
preferredTextLocale: null,
|
||||||
}, function(items) {
|
}, function(items) {
|
||||||
|
@ -70,8 +65,7 @@ function restore_options() {
|
||||||
document.getElementById("showAllTracks").checked = items.showAllTracks;
|
document.getElementById("showAllTracks").checked = items.showAllTracks;
|
||||||
document.getElementById("setMaxBitrate").checked = items.setMaxBitrate;
|
document.getElementById("setMaxBitrate").checked = items.setMaxBitrate;
|
||||||
document.getElementById("disableVP9").checked = items.disableVP9;
|
document.getElementById("disableVP9").checked = items.disableVP9;
|
||||||
document.getElementById("disableAV1").checked = items.disableAV1;
|
document.getElementById("useDDPlus").checked = items.useDDPlus;
|
||||||
document.getElementById("disableHPL").checked = items.disableHPL;
|
|
||||||
document.getElementById("preferredLocale").value = items.preferredLocale;
|
document.getElementById("preferredLocale").value = items.preferredLocale;
|
||||||
document.getElementById("preferredTextLocale").value = items.preferredTextLocale;
|
document.getElementById("preferredTextLocale").value = items.preferredTextLocale;
|
||||||
});
|
});
|
||||||
|
|
26
rules.json
26
rules.json
|
@ -1,26 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"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