mirror of
https://github.com/shirt-dev/netflix-international.git
synced 2025-05-03 08:30:33 +00:00
v2.0.3
Cleaned up code, fixed CSS issues caused by Netflix update
This commit is contained in:
parent
4383594d23
commit
2380097d45
7 changed files with 100 additions and 65 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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
# netflix-international
|
# netflix-international
|
||||||
Extension to play Netflix with all dubs & subs, 1080p, and 5.1.
|
Extension to play Netflix with all dubs & subs, 1080p, and 5.1.
|
||||||
|
|
||||||
- Firefox: https://addons.mozilla.org/en-US/firefox/addon/netflix-international/
|
- Firefox: Removed by Mozilla
|
||||||
- Chrome: 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
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable no-undef */
|
||||||
// https://stackoverflow.com/a/45985333
|
// https://stackoverflow.com/a/45985333
|
||||||
function getBrowser() {
|
function getBrowser() {
|
||||||
if (typeof chrome !== "undefined") {
|
if (typeof chrome !== "undefined") {
|
||||||
|
@ -19,17 +20,15 @@ chrome.webRequest.onBeforeRequest.addListener(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getBrowser() == "Chrome") {
|
if (getBrowser() == "Chrome") {
|
||||||
return {
|
return { redirectUrl: chrome.runtime.getURL("cadmium-playercore-shim.js") };
|
||||||
redirectUrl: chrome.extension.getURL("cadmium-playercore-shim.js")
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Work around funky CORS behaviour on Firefox */
|
/* Work around funky CORS behaviour on Firefox */
|
||||||
else if (getBrowser() == "Firefox") {
|
else if (getBrowser() == "Firefox") {
|
||||||
let filter = browser.webRequest.filterResponseData(details.requestId);
|
let filter = browser.webRequest.filterResponseData(details.requestId);
|
||||||
let encoder = new TextEncoder();
|
let encoder = new TextEncoder();
|
||||||
filter.onstop = event => {
|
filter.onstop = () => {
|
||||||
fetch(browser.extension.getURL("cadmium-playercore-shim.js")).
|
fetch(browser.runtime.getURL("cadmium-playercore-shim.js")).
|
||||||
then(response => response.text()).
|
then(response => response.text()).
|
||||||
then(text => {
|
then(text => {
|
||||||
filter.write(encoder.encode(text));
|
filter.write(encoder.encode(text));
|
||||||
|
|
|
@ -1,18 +1,7 @@
|
||||||
|
/* eslint-disable no-undef */
|
||||||
// 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!");
|
||||||
|
|
||||||
// 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 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) {
|
||||||
|
@ -35,8 +24,9 @@ request.send();
|
||||||
|
|
||||||
var cadmium_src = request.responseText;
|
var cadmium_src = request.responseText;
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
function get_profile_list() {
|
function get_profile_list() {
|
||||||
custom_profiles = [
|
var custom_profiles = [
|
||||||
"playready-h264mpl30-dash",
|
"playready-h264mpl30-dash",
|
||||||
"playready-h264mpl31-dash",
|
"playready-h264mpl31-dash",
|
||||||
"playready-h264mpl40-dash",
|
"playready-h264mpl40-dash",
|
||||||
|
@ -82,11 +72,11 @@ do_patch(
|
||||||
"Custom profiles 2",
|
"Custom profiles 2",
|
||||||
/(name:"default",profiles:).}/,
|
/(name:"default",profiles:).}/,
|
||||||
"$1 get_profile_list()}"
|
"$1 get_profile_list()}"
|
||||||
)
|
);
|
||||||
|
|
||||||
do_patch(
|
do_patch(
|
||||||
"Re-enable Ctrl+Shift+Alt+S menu",
|
"Re-enable Ctrl+Shift+Alt+S menu",
|
||||||
/this\...\....\s*\&\&\s*this\.toggle\(\);/,
|
/this\...\....\s*&&\s*this\.toggle\(\);/,
|
||||||
"this.toggle();"
|
"this.toggle();"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -94,7 +84,7 @@ if (globalOptions.showAllTracks) {
|
||||||
do_patch("Show all audio tracks",
|
do_patch("Show all audio tracks",
|
||||||
/"showAllSubDubTracks",!1/,
|
/"showAllSubDubTracks",!1/,
|
||||||
"\"showAllSubDubTracks\",!0"
|
"\"showAllSubDubTracks\",!0"
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
/* eslint-disable no-undef */
|
||||||
|
|
||||||
script_urls = [];
|
var script_urls = [];
|
||||||
|
|
||||||
urls = [
|
var urls = [
|
||||||
'netflix_max_bitrate.js'
|
"netflix_max_bitrate.js"
|
||||||
];
|
];
|
||||||
|
|
||||||
// https://stackoverflow.com/a/45985333
|
// https://stackoverflow.com/a/45985333
|
||||||
|
@ -20,50 +21,50 @@ function getBrowser() {
|
||||||
|
|
||||||
// promisify chrome storage API for easier chaining
|
// promisify chrome storage API for easier chaining
|
||||||
function chromeStorageGet(opts) {
|
function chromeStorageGet(opts) {
|
||||||
if (getBrowser() == "Firefox") {
|
if (getBrowser() == "Firefox") {
|
||||||
return chrome.storage.sync.get(opts);
|
return chrome.storage.sync.get(opts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
chrome.storage.sync.get(opts, resolve);
|
chrome.storage.sync.get(opts, resolve);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function attachScript(resp) {
|
function attachScript(resp) {
|
||||||
let xhr = resp.target;
|
let xhr = resp.target;
|
||||||
let mainScript = document.createElement('script');
|
let mainScript = document.createElement("script");
|
||||||
mainScript.type = 'application/javascript';
|
mainScript.type = "application/javascript";
|
||||||
if (xhr.status == 200) {
|
if (xhr.status == 200) {
|
||||||
mainScript.text = xhr.responseText;
|
mainScript.text = xhr.responseText;
|
||||||
document.documentElement.appendChild(mainScript);
|
document.documentElement.appendChild(mainScript);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chromeStorageGet({
|
chromeStorageGet({
|
||||||
use6Channels: true,
|
use6Channels: true,
|
||||||
showAllTracks: true,
|
showAllTracks: true,
|
||||||
setMaxBitrate: false,
|
setMaxBitrate: false,
|
||||||
disableVP9: false,
|
disableVP9: false,
|
||||||
}).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/javascript';
|
mainScript.type = "application/javascript";
|
||||||
mainScript.text = `var globalOptions = JSON.parse('${JSON.stringify(items)}');`;
|
mainScript.text = `var globalOptions = JSON.parse('${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++) {
|
for (let i = 0; i < script_urls.length; i++) {
|
||||||
let script = document.createElement('script');
|
let script = document.createElement("script");
|
||||||
script.src = script_urls[i];
|
script.src = script_urls[i];
|
||||||
document.documentElement.appendChild(script);
|
document.documentElement.appendChild(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < urls.length; i++) {
|
for (let i = 0; i < urls.length; i++) {
|
||||||
let mainScriptUrl = chrome.extension.getURL(urls[i]);
|
let mainScriptUrl = chrome.extension.getURL(urls[i]);
|
||||||
let xhr = new XMLHttpRequest();
|
let xhr = new XMLHttpRequest();
|
||||||
xhr.open('GET', mainScriptUrl, true);
|
xhr.open("GET", mainScriptUrl, true);
|
||||||
xhr.onload = attachScript;
|
xhr.onload = attachScript;
|
||||||
xhr.send();
|
xhr.send();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -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.2",
|
"version": "2.0.3",
|
||||||
"author": "shirt",
|
"author": "shirt",
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
"default_icon": "img/icon128.png"
|
"default_icon": "img/icon128.png"
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
"*://www.netflix.com/*"
|
"*://www.netflix.com/*"
|
||||||
],
|
],
|
||||||
"all_frames": true,
|
"all_frames": true,
|
||||||
|
"css": ["netflix.css"],
|
||||||
"js": ["content_script.js"],
|
"js": ["content_script.js"],
|
||||||
"run_at": "document_start"
|
"run_at": "document_start"
|
||||||
}],
|
}],
|
||||||
|
@ -36,7 +37,8 @@
|
||||||
},
|
},
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [
|
||||||
"cadmium-playercore-shim.js",
|
"cadmium-playercore-shim.js",
|
||||||
"netflix_max_bitrate.js"
|
"netflix_max_bitrate.js",
|
||||||
|
"netflix.css"
|
||||||
],
|
],
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"storage",
|
"storage",
|
||||||
|
|
14
netflix.css
Normal file
14
netflix.css
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/* Fixes audio and subtitle picker scrolling */
|
||||||
|
|
||||||
|
.watch-video--selector-audio-subtitle {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
div[data-uia="selector-audio-subtitle"] > div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
div[data-uia="selector-audio-subtitle"] > div > ul {
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue