Peacock Compact UI

Slims the Peacock desktop UI to be a little more compact and take up less screenspace.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Peacock Compact UI
// @namespace    http://tampermonkey-userscripts/example
// @version      1.1
// @description  Slims the Peacock desktop UI to be a little more compact and take up less screenspace.
// @match        https://www.peacocktv.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function removePlaybackStyles() {
        const playbackElements = document.querySelectorAll('.playback-overlay__container.clip, .playback-overlay__container.live, .playback-overlay__container.preview, .playback-overlay__container.singleliveevent, .playback-overlay__container.vod');
        playbackElements.forEach(element => {
            element.style.background = 'none';
            element.style.paddingBottom = '0.5rem';
        });

        const playbackHeader = document.querySelector('.playback-header__container');
        playbackHeader.style.backgroundColor = 'transparent';

        const metadataText = document.querySelector('.playback-metadata__container.singleliveevent');
        if (metadataText) {
            metadataText.remove();
        }

        const playbackTimeElapsed = document.querySelector('.playback-time-elapsed__container');
        playbackTimeElapsed.style.marginBottom = '0.70rem';
        playbackTimeElapsed.style.marginLeft = '1rem';
        const languageSettings = document.querySelector('[data-testid~="language-settings-button"]').parentElement;
        if (languageSettings.parentElement != playbackTimeElapsed.parentElement) {
            languageSettings.parentNode.insertBefore(playbackTimeElapsed, languageSettings.nextSibling);
        }

        const statusIndicator = document.querySelector('.asset-status-indicator');
        if (statusIndicator) {
            statusIndicator.remove();
        }

        const scrubber = document.querySelector('.playback-scrubber-bar');
        scrubber.style.opacity = .33;

    }

    // Create a MutationObserver to watch for DOM changes
    const observer = new MutationObserver((mutationsList, observer) => {
        for (const mutation of mutationsList) {
            if (mutation.type === 'childList' && mutation.addedNodes.length) {
                removePlaybackStyles();
            }
        }
    });

    // Start observing the entire document with the observer
    observer.observe(document, { childList: true, subtree: true });
})();