YouTube Player Layout Modifier

Move the top of the progress bar to the bottom of the YouTube player and keep buttons at the top

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         YouTube Player Layout Modifier
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Move the top of the progress bar to the bottom of the YouTube player and keep buttons at the top
// @author       Your Name
// @match        https://www.youtube.com/*
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // Function to rearrange player elements
    function rearrangePlayerElements() {
        const player = document.querySelector('.html5-video-player');
        const progressBar = document.querySelector('.ytp-progress-bar-container');
        const controls = document.querySelector('.ytp-chrome-bottom');

        if (player && progressBar && controls) {
            // Move controls (buttons) to the top of the player
            player.insertBefore(controls, player.firstChild);
            // Move progress bar to the bottom of the player
            player.appendChild(progressBar);
        }
    }

    // Mutation observer to rearrange elements when player is loaded or changed
    const observer = new MutationObserver(rearrangePlayerElements);
    
    // Observe changes in the body, specifically to the video player
    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

    // Call the function initially to rearrange elements if the player is already present
    rearrangePlayerElements();
})();