Compare commits

...

5 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
Victor Westerlund
f99e92037c
Remove unused permission and add new PIP icon (#3)
* feat: remove unused permission and new pip icon

* Update README.md
2022-05-06 06:42:37 -08:00
4 changed files with 17 additions and 13 deletions

View file

@ -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+
![demo](https://user-images.githubusercontent.com/35688133/159330808-299d1175-1f89-4fcb-b153-707d2befaee8.png)
![image](https://user-images.githubusercontent.com/35688133/167155676-ad4ae36c-66a7-416b-9085-a90bb514d5de.png)
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!
![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.
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/
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 });

View file

@ -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"]
}]
}
}

View file

@ -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]) {