Some Changes

This commit is contained in:
TheBrokenRail 2022-03-26 14:45:18 -04:00
parent aa9dcf5adf
commit b4fab3498b
2 changed files with 11 additions and 9 deletions

View File

@ -3,7 +3,7 @@
"name": "Force High-Resolution DisneyNOW", "name": "Force High-Resolution DisneyNOW",
"author": "TheBrokenRail", "author": "TheBrokenRail",
"version": "1.2", "version": "1.2",
"description": "This browser extension forces DisneyNOW to use their higher-resolution video stream by imitating the Android app. (It also blocks DisneyNOW ads.)", "description": "This browser extension forces DisneyNOW to use their higher-resolution video stream by imitating the Android app. (It also blocks some DisneyNOW ads.)",
"homepage_url": "https://gitea.thebrokenrail.com/TheBrokenRail/force-high-resolution-disneynow", "homepage_url": "https://gitea.thebrokenrail.com/TheBrokenRail/force-high-resolution-disneynow",
"content_scripts": [ "content_scripts": [
{ {

View File

@ -45,18 +45,20 @@ Object.defineProperty(XMLHttpRequest.prototype, 'setRequestHeader', {
// Add resolution info to video player. // Add resolution info to video player.
function addResolutionInfo(player) { function addResolutionInfo(player) {
// Create (or find existing) <p> element. // Remove existing <p> element (if possible).
const id = '__disneynow_resolution_info__'; const id = '__disneynow_resolution_info__';
let p = document.getElementById(id); let p = document.getElementById(id);
if (!p) { if (p) {
// Create p.remove();
p = document.createElement('P');
p.id = id;
// Add <p> element to DOM.
player.parentElement.insertBefore(p, player);
} }
// Create <p> element
p = document.createElement('P');
p.id = id;
// Add <p> element to DOM.
player.parentElement.insertBefore(p, player);
// Set initial resolution text. // Set initial resolution text.
function setResolutionText(resolution) { function setResolutionText(resolution) {
p.innerText = `Video Quality: ${resolution}`; p.innerText = `Video Quality: ${resolution}`;