YouTube watch page - no icon labels

show icons without text on YouTube watch page

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         YouTube watch page - no icon labels
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  show icons without text on YouTube watch page
// @author       Sigi_cz
// @match        https://www.youtube.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

//20220423
//0.5 fix the script double start
//20220310
//0.4 YT >> YouTube
//20220217
//0.3 all buttons, change style
//20220202
//0.2 added ytd-download-button-renderer
//20210221
//0.1 first version

(function() {
    'use strict';

// select elements by 'byTagname' '?byName' '#byID' '.byClass' './xpath' '//xpath'
function $(q, root, single) {
  if (root && typeof root === 'string') {
    root = $(root, null, true);
    if (!root) { return null; }
  }
  root = root || document;
  if (q[0]==='/' || (q[0]==='.' && q[1]==='/')) {
    if (single) { return document.evaluate(q, root, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; }
    return document.evaluate(q, root, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  }
  else if (q[0]==='#') { return root.getElementById(q.substr(1)); }
  else if (q[0]==='.') { return root.getElementsByClassName(q.substr(1)); }
  else if (q[0]==='?') { return root.getElementsByName(q.substr(1)); }
  return root.getElementsByTagName(q);
}

// -----------------------------------------------------------------------------

function start_script() {
    setTimeout(function (){
        delayed_start();
    }, 1000);
}

function delayed_start() {

    //alert("YT transitionend");
    var addr = window.location.href;

    if (addr.match("/watch?")) {
        //console.log("YT watch !")

        try {
            var menu = $('//ytd-video-primary-info-renderer/div/div/div[3]/div/ytd-menu-renderer/div//yt-formatted-string');
            for (var i = 1; i < menu.snapshotLength; i++) {
                menu.snapshotItem(i).style.display = 'none';
                menu.snapshotItem(i).parentNode.style.padding = "0px";
                //menu.snapshotItem(i).parentNode.firstChild.style.padding = "0px";
                menu.snapshotItem(i).parentNode.parentNode.style.marginLeft = '0px';
            }
        } catch(x) { console.log("YT err mod btn: " + i); }

    }

}

    //document.addEventListener('DOMContentLoaded', start_script());
    //document.onload = start_script();
    document.body.addEventListener("yt-navigate-finish", function (event) {
        //console.log('Youtube page Change');
        start_script();
    });

})();