mirror of
https://codeberg.org/vlw/disneyplus-pip.git
synced 2025-09-13 18:33:40 +02:00
Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
6328655a56 | |||
![]() |
8e59f7a414 | ||
![]() |
f3f8fe9ff4 | ||
![]() |
4f822b2a69 | ||
![]() |
f99e92037c |
4 changed files with 17 additions and 13 deletions
12
README.md
12
README.md
|
@ -1,12 +1,15 @@
|
|||
> [!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+
|
||||
|
||||

|
||||

|
||||
|
||||
Add Picture-in-Picture support on Disney+ in the browser.
|
||||
|
||||
## 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
|
||||
|
||||
|
@ -23,10 +26,13 @@ Add Picture-in-Picture support on Disney+ in the browser.
|
|||
|
||||
## 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!
|
||||
|
||||

|
||||
|
||||
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/)).
|
||||
|
||||
**[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
|
||||
|
|
|
@ -18,9 +18,9 @@ class PIPController {
|
|||
// Returns true if the page is /video/
|
||||
isPlayerPage() {
|
||||
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
|
||||
|
@ -45,7 +45,7 @@ class PIPController {
|
|||
pip.tabindex = "0";
|
||||
pip.classList = "control-icon-btn fullscreen-icon";
|
||||
|
||||
pip.innerHTML = `<div class="focus-hack-div " tabindex="-1"><svg tabindex="-1" focusable="false"><use xlink:href="#067--arrow-down" style="transform: rotate(180deg) scale(0.6);transform-origin: 50% 50%;"></use><use xlink:href="#014--fullscreen"></use></svg></div>`;
|
||||
pip.innerHTML = `<div class="focus-hack-div " tabindex="-1"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 -1 27 27" tabindex="-1" focusable="false"><path fill="#ffffff" d="M19 11h-8v6h8v-6zm4 8V4.98C23 3.88 22.1 3 21 3H3c-1.1 0-2 .88-2 1.98V19c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H3V4.97h18v14.05z"/></svg></div>`;
|
||||
|
||||
pip.addEventListener("click", () => this.togglePictureInPicture());
|
||||
|
||||
|
@ -77,4 +77,4 @@ class PIPController {
|
|||
}
|
||||
}
|
||||
|
||||
window.addEventListener("load", () => new PIPController(), { once: true });
|
||||
window.addEventListener("load", () => new PIPController(), { once: true });
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
{
|
||||
"name": "Disney+ PIP",
|
||||
"description": "Adds Picture-in-Picture (PIP) support for Disney+",
|
||||
"version": "1.1",
|
||||
"version": "1.3",
|
||||
"manifest_version": 3,
|
||||
"permissions": [
|
||||
"activeTab"
|
||||
],
|
||||
"content_scripts": [{
|
||||
"matches": ["https://*.disneyplus.com/*"],
|
||||
"js": ["assets/js/script.js"]
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,8 @@
|
|||
// Poll document tree until video element is loaded
|
||||
const init = (mutations, observer) => {
|
||||
clearTimeout(timeout);
|
||||
if(!window.location.href.includes("/video/")) {
|
||||
const pattern = /^\/?([A-Za-z-]*)?\/video\//i;
|
||||
if(!pattern.test(window.location.pathname)) {
|
||||
return false;
|
||||
}
|
||||
if(document.getElementsByTagName("video")[0]) {
|
||||
|
|
Loading…
Add table
Reference in a new issue