Skip to content

Instantly share code, notes, and snippets.

@PJnes
Last active Apr 20, 2021
Embed
What would you like to do?
Disney+ Enable PiP Userscript
// ==UserScript==
// @name Disney+ PiP
// @namespace pauljones.io
// @version 0.1
// @description Enable PiP on Disney+ videos.
// @author Paul Jones
// @match https://www.disneyplus.com/*
// @grant none
// ==/UserScript==
'use strict';
(function() {
const targetNode = document.getElementById('app_index');
const observer = new MutationObserver((mutationsList, observer) => {
mutationsList.forEach((item) => {
if (item.type === 'attributes' && item.attributeName === 'autoplay') {
item.target.disablePictureInPicture = false;
}
});
});
observer.observe(targetNode, { attributes: true, childList: true, subtree: true });
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment