Youtube - description on the right side above related videos

Description on the right side with avatar and channel name

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name            Youtube - description on the right side above related videos
// @description     Description on the right side with avatar and channel name
// @namespace       https://greasyfork.org/en/users/758587-barn852
// @author          barn852
// @license         MIT
// @version         1.3
// @match           *://*.youtube.com/*
// @include         *://*.youtube.com/watch*
// @grant           none
// @require         https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @run-at          document-end
// @noframes
// ==/UserScript==


(function(){
    'use strict';

    const insert_right = () => document.querySelector('#secondary-inner').insertBefore(document.getElementById('meta-contents'),document.getElementById('related'));
 
    const observer = new MutationObserver(function(mutations){
        mutations.forEach(function(mutation){
            if (mutation.type === 'childList'){
                mutation.addedNodes.forEach(function(node){ 

                  if (document.querySelector("#secondary-inner > #meta-contents")) { return } else { insert_right() };               

                });
            }
        });
    });

    observer.observe(document.body, {'childList': true, 'subtree' : true});

/*
// auto expand description   
  
    window.addEventListener('yt-page-data-updated', function () {

        var checkExist = setInterval(function() {
            var ytMeta = document.querySelector('#secondary-inner #more .more-button.ytd-video-secondary-info-renderer');
            if(ytMeta){
                (ytMeta).click();
                clearInterval(checkExist);
            }
        }, 500);

    });  
*/  
  
})()