// ==UserScript==
// @name Disney Plus Enchantments
// @namespace http://tampermonkey.net/
// @version 0.6.1
// @description Enhancements for Disney Plus video player: auto fullscreen, skip intro, skip credits, and more.
// @author JJJ
// @match https://www.disneyplus.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=disneyplus.com
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_registerMenuCommand
// @license MIT
// @downloadURL https://update.greasyfork.icu/scripts/494964/Disney%20Plus%20Enchantments.user.js
// @updateURL https://update.greasyfork.icu/scripts/494964/Disney%20Plus%20Enchantments.meta.js
// ==/UserScript==
(function () {
'use strict';
const CONFIG = {
enableAutoFullscreen: GM_getValue('enableAutoFullscreen', true),
enableSkipIntro: GM_getValue('enableSkipIntro', true),
enableAutoPlayNext: GM_getValue('enableAutoPlayNext', false)
};
const SELECTORS = {
skipIntroButton: 'button.skip__button:not([class*="overlay_upnextlite"])',
autoPlayButton: '.overlay_upnextlite_button-container button, *[data-testid="up-next-play-button"]',
fullscreenButton: 'button.fullscreen-icon'
};
const CONSTANTS = {
CLICK_DELAY: 5000,
BUTTON_TRACKING_TIMEOUT: 30000
};
let lastSkipClickTime = 0;
const clickedButtons = new Set();
function createSettingsDialog() {
const dialogHTML = `
Disney Plus Enchantments
${createToggle('enableAutoFullscreen', 'Auto Fullscreen', 'Automatically enter fullscreen mode')}
${createToggle('enableSkipIntro', 'Skip Intro', 'Automatically skip the intro of episodes')}
${createToggle('enableAutoPlayNext', 'Auto Play Next Episode', 'Automatically play the next episode')}