Compare commits

...

4 commits

Author SHA1 Message Date
6328655a56
doc: add deprecation notice to README (#7) 2024-05-15 08:07:47 +00:00
Victor Westerlund
8e59f7a414
fix(versioning): Chrome extension version 1.3 2022-06-18 17:19:22 +02:00
Alperen Çetin
f3f8fe9ff4 Update script.js 2022-06-18 18:17:17 +03:00
Alperen Çetin
4f822b2a69 Update userscript.js 2022-06-18 18:17:17 +03:00
4 changed files with 15 additions and 8 deletions

View file

@ -1,3 +1,6 @@
> [!IMPORTANT]
> **This extension is deprecated and no longer maintained.** ([#6](https://github.com/VictorWesterlund/disneyplus-pip/issues/6)) Feel free to fork the code and make any changes you want!
## Picture in Picture for Disney+ ## Picture in Picture for Disney+
![image](https://user-images.githubusercontent.com/35688133/167155676-ad4ae36c-66a7-416b-9085-a90bb514d5de.png) ![image](https://user-images.githubusercontent.com/35688133/167155676-ad4ae36c-66a7-416b-9085-a90bb514d5de.png)
@ -6,7 +9,7 @@ Add Picture-in-Picture support on Disney+ in the browser.
## Install from the Chrome Web Store ## Install from the Chrome Web Store
[**Install from the Chrome Web Store**](https://chrome.google.com/webstore/detail/disney%20-pip/mjncaeojcjldpplapjioikobkgedockm) [~**Install from the Chrome Web Store**~](https://chrome.google.com/webstore/detail/disney%20-pip/mjncaeojcjldpplapjioikobkgedockm) ⚠️ Deprecated
## Install Chrome Extension ## Install Chrome Extension
@ -23,10 +26,13 @@ Add Picture-in-Picture support on Disney+ in the browser.
## Install UserScript ## Install UserScript
> [!IMPORTANT]
> **This userscript is deprecated and no longer maintained.** ([#6](https://github.com/VictorWesterlund/disneyplus-pip/issues/6)) Feel free to fork the code and make any changes you want!
![stats](https://img.shields.io/badge/dynamic/json?color=%23990000&label=GreasyFork&query=total_installs&suffix=%20installs&url=https://greasyfork.org/en/scripts/420964-disney-picture-in-picture) ![stats](https://img.shields.io/badge/dynamic/json?color=%23990000&label=GreasyFork&query=total_installs&suffix=%20installs&url=https://greasyfork.org/en/scripts/420964-disney-picture-in-picture)
You can also find an older UserScript of this on [GreasyFork](https://greasyfork.org/en/scripts/420964-disney-picture-in-picture). Please note that this version is no longer maintained so support is not guaranteed. You can also find an older UserScript of this on [GreasyFork](https://greasyfork.org/en/scripts/420964-disney-picture-in-picture). Please note that this version is no longer maintained so support is not guaranteed.
It should work with extensions like Tampermonkey ([Chrome](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en), [Firefox](https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/)) and Greasemonkey ([Firefox](https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/)). It should work with extensions like Tampermonkey ([Chrome](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en), [Firefox](https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/)) and Greasemonkey ([Firefox](https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/)).
**[Install from GreasyFork](https://greasyfork.org/en/scripts/420964-disney-picture-in-picture)** [~**Install from GreasyFork**~](https://greasyfork.org/en/scripts/420964-disney-picture-in-picture) ⚠️ Deprecated

View file

@ -18,9 +18,9 @@ class PIPController {
// Returns true if the page is /video/ // Returns true if the page is /video/
isPlayerPage() { isPlayerPage() {
const url = new URL(window.location); const url = new URL(window.location);
const pathname = url.pathname.split("/"); const pattern = /^\/?([A-Za-z-]*)?\/video\//i;
return pathname[1] === "video" ? true : false; return pattern.test(url.pathname) ? true : false;
} }
// Enter/exit PIP mode // Enter/exit PIP mode
@ -77,4 +77,4 @@ class PIPController {
} }
} }
window.addEventListener("load", () => new PIPController(), { once: true }); window.addEventListener("load", () => new PIPController(), { once: true });

View file

@ -1,10 +1,10 @@
{ {
"name": "Disney+ PIP", "name": "Disney+ PIP",
"description": "Adds Picture-in-Picture (PIP) support for Disney+", "description": "Adds Picture-in-Picture (PIP) support for Disney+",
"version": "1.2", "version": "1.3",
"manifest_version": 3, "manifest_version": 3,
"content_scripts": [{ "content_scripts": [{
"matches": ["https://*.disneyplus.com/*"], "matches": ["https://*.disneyplus.com/*"],
"js": ["assets/js/script.js"] "js": ["assets/js/script.js"]
}] }]
} }

View file

@ -58,7 +58,8 @@
// Poll document tree until video element is loaded // Poll document tree until video element is loaded
const init = (mutations, observer) => { const init = (mutations, observer) => {
clearTimeout(timeout); clearTimeout(timeout);
if(!window.location.href.includes("/video/")) { const pattern = /^\/?([A-Za-z-]*)?\/video\//i;
if(!pattern.test(window.location.pathname)) {
return false; return false;
} }
if(document.getElementsByTagName("video")[0]) { if(document.getElementsByTagName("video")[0]) {