Cleaned up code, fixed CSS issues caused by Netflix update
This commit is contained in:
shirtjs 2021-09-07 21:54:41 -04:00
parent 4383594d23
commit 2380097d45
7 changed files with 100 additions and 65 deletions

View file

@ -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