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
|
||||
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
|
||||
|
||||
Contact me on discord: shirt#1337
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable no-undef */
|
||||
// https://stackoverflow.com/a/45985333
|
||||
function getBrowser() {
|
||||
if (typeof chrome !== "undefined") {
|
||||
|
@ -19,17 +20,15 @@ chrome.webRequest.onBeforeRequest.addListener(
|
|||
}
|
||||
|
||||
if (getBrowser() == "Chrome") {
|
||||
return {
|
||||
redirectUrl: chrome.extension.getURL("cadmium-playercore-shim.js")
|
||||
};
|
||||
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 = event => {
|
||||
fetch(browser.extension.getURL("cadmium-playercore-shim.js")).
|
||||
filter.onstop = () => {
|
||||
fetch(browser.runtime.getURL("cadmium-playercore-shim.js")).
|
||||
then(response => response.text()).
|
||||
then(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.
|
||||
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) {
|
||||
var match = cadmium_src.match(needle);
|
||||
if (!match) {
|
||||
|
@ -35,8 +24,9 @@ request.send();
|
|||
|
||||
var cadmium_src = request.responseText;
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function get_profile_list() {
|
||||
custom_profiles = [
|
||||
var custom_profiles = [
|
||||
"playready-h264mpl30-dash",
|
||||
"playready-h264mpl31-dash",
|
||||
"playready-h264mpl40-dash",
|
||||
|
@ -82,11 +72,11 @@ 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\...\....\s*&&\s*this\.toggle\(\);/,
|
||||
"this.toggle();"
|
||||
);
|
||||
|
||||
|
@ -94,7 +84,7 @@ if (globalOptions.showAllTracks) {
|
|||
do_patch("Show all audio tracks",
|
||||
/"showAllSubDubTracks",!1/,
|
||||
"\"showAllSubDubTracks\",!0"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// 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 = [
|
||||
'netflix_max_bitrate.js'
|
||||
var urls = [
|
||||
"netflix_max_bitrate.js"
|
||||
];
|
||||
|
||||
// https://stackoverflow.com/a/45985333
|
||||
|
@ -32,8 +33,8 @@ function chromeStorageGet(opts) {
|
|||
|
||||
function attachScript(resp) {
|
||||
let xhr = resp.target;
|
||||
let mainScript = document.createElement('script');
|
||||
mainScript.type = 'application/javascript';
|
||||
let mainScript = document.createElement("script");
|
||||
mainScript.type = "application/javascript";
|
||||
if (xhr.status == 200) {
|
||||
mainScript.text = xhr.responseText;
|
||||
document.documentElement.appendChild(mainScript);
|
||||
|
@ -47,14 +48,14 @@ chromeStorageGet({
|
|||
disableVP9: false,
|
||||
}).then(items => {
|
||||
// very messy workaround for accessing chrome storage outside of background / content scripts
|
||||
let mainScript = document.createElement('script');
|
||||
mainScript.type = 'application/javascript';
|
||||
let mainScript = document.createElement("script");
|
||||
mainScript.type = "application/javascript";
|
||||
mainScript.text = `var globalOptions = JSON.parse('${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');
|
||||
let script = document.createElement("script");
|
||||
script.src = script_urls[i];
|
||||
document.documentElement.appendChild(script);
|
||||
}
|
||||
|
@ -62,7 +63,7 @@ chromeStorageGet({
|
|||
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.open("GET", mainScriptUrl, true);
|
||||
xhr.onload = attachScript;
|
||||
xhr.send();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"manifest_version": 2,
|
||||
"name": "Netflix International",
|
||||
"description": "Displays all available Netflix audio tracks.",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.3",
|
||||
"author": "shirt",
|
||||
"browser_action": {
|
||||
"default_icon": "img/icon128.png"
|
||||
|
@ -24,6 +24,7 @@
|
|||
"*://www.netflix.com/*"
|
||||
],
|
||||
"all_frames": true,
|
||||
"css": ["netflix.css"],
|
||||
"js": ["content_script.js"],
|
||||
"run_at": "document_start"
|
||||
}],
|
||||
|
@ -36,7 +37,8 @@
|
|||
},
|
||||
"web_accessible_resources": [
|
||||
"cadmium-playercore-shim.js",
|
||||
"netflix_max_bitrate.js"
|
||||
"netflix_max_bitrate.js",
|
||||
"netflix.css"
|
||||
],
|
||||
"permissions": [
|
||||
"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