css - YouTube 隱藏「更多影片」

css-YouTube 隱藏「更多影片」

当前为 2019-10-11 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name          css - YouTube 隱藏「更多影片」
// @namespace     hbl917070
// @description	  css-YouTube 隱藏「更多影片」
// @author        hbl917070(深海異音)
// @homepage      https://home.gamer.com.tw/homeindex.php?owner=hbl917070
// @include       https://www.youtube.com/embed/*
// @run-at        document-start
// @version       0.1
// ==/UserScript==



/**
 * 
 * 最後更新日期:2019/10/11
 * 
 * YouTube嵌入到其他網站上後,只要暫停影片,下面就會跳出一排「更多影片」的視窗,非常的擾人
 * 安裝這個腳本後,就不會出現這個視窗
 * 
 */


(function () {
   
    var css = `   
    /*更多影片*/
    .ytp-pause-overlay{
        display: block !important;
        overflow:  hidden !important;
        width:0px !important;
        height: 0px !important;
        pointer-events: none !important;
        opacity: 0 !important;
    }
    /*廣告*/
    .ytp-ad-image-overlay, .ytp-ad-image-overlay *{
        display: block !important;
        overflow:  hidden !important;
        width:0px !important;
        height: 0px !important;
        pointer-events: none !important;
        opacity: 0 !important;
    }
    `;



    /* 插入 CSS */
    if (typeof GM_addStyle != "undefined") {
        GM_addStyle(css);
    } else if (typeof PRO_addStyle != "undefined") {
        PRO_addStyle(css);
    } else if (typeof addStyle != "undefined") {
        addStyle(css);
    } else {
        var node = document.createElement("style");
        node.type = "text/css";
        node.appendChild(document.createTextNode(css));
        var heads = document.getElementsByTagName("html");
        if (heads.length > 0) {
            heads[0].appendChild(node);
        } else {
            document.documentElement.appendChild(node);
        }
    }



})();