Youtube - Auto Expand Video Description

Youtube Auto Expand Video Description! YT自动展开视频描述详细!

目前为 2024-07-24 提交的版本。查看 最新版本

// ==UserScript==
// @name         Youtube - Auto Expand Video Description
// @namespace    http://tampermonkey.net/
// @version      2.3
// @description  Youtube Auto Expand Video Description! YT自动展开视频描述详细!
// @author       Martin______X
// @match        https://www.youtube.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant        none
// @license      MIT
// ==/UserScript==

let $videoId = "";
let $clicked = false;
let $times = 0;

/*ASYNC*/
const simpleClick = (async (obj) => {
    obj.click();
    $clicked = true;
});

/*LOOP*/
const videoIdCheckDesInterval = setInterval(() => {
    try{
        let video_des = document.getElementsByClassName("watch-active-metadata style-scope ytd-watch-flexy style-scope ytd-watch-flexy")[0];
        let videoId = video_des.getAttribute("video-id");
        let expand = video_des.querySelector("#expand");
        let collapse = video_des.querySelector("#collapse");
        if ($videoId != videoId) {
            /**/
            window.onscroll = (()=> {window.scrollTo(0, 0);});
            /**/
            simpleClick(expand);
            /**/
            if (collapse.checkVisibility()) {
                console.warn("Description Expanded!");
                $videoId = videoId;
            }
        }

        if ($clicked) {
            /**/
            if($times > 10){
                window.onscroll = null;
                document.html.focus();
                $times = 0;
                $clicked = false;
            }else{
                $times++;
            }
        }
    }catch(error){
        //console.warn(error);
    }
}, 1);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址