~kris/dots

srice

srice/.local/share/qutebrowser/greasemonkey/youtube-minimal.user.js -rw-r--r-- 2.4 KiB
e98f3b03 — Kris Yotam chore: sync local state after restore (push updates, no pull) a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// ==UserScript==
// @name         Minimal YouTube
// @namespace    krisyotam
// @version      1.0
// @description  Hide recommendations, sidebar, comments, shorts
// @match        *://www.youtube.com/*
// @match        *://youtube.com/*
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    const css = `
        /* Hide sidebar, recommendations, related videos */
        #secondary,
        #secondary-inner,
        #related,
        ytd-watch-next-secondary-results-renderer {
            display: none !important;
        }

        /* Hide mini guide (left sidebar) */
        ytd-mini-guide-renderer,
        tp-yt-app-drawer,
        #guide-button {
            display: none !important;
        }

        /* Hide voice search and extra buttons */
        #top-level-buttons-computed,
        #voice-search-button,
        .ytd-masthead #buttons {
            display: none !important;
        }

        /* Hide comments */
        ytd-comments#comments {
            display: none !important;
        }

        /* Hide shorts */
        ytd-rich-section-renderer,
        ytd-reel-shelf-renderer,
        [is-shorts],
        ytd-grid-video-renderer:has(ytd-thumbnail-overlay-time-status-renderer[overlay-style="SHORTS"]),
        ytd-item-section-renderer:has(ytd-thumbnail-overlay-time-status-renderer[overlay-style="SHORTS"]) {
            display: none !important;
        }

        /* Remove left margin from page */
        #page-manager {
            margin-left: 0 !important;
        }

        ytd-app[mini-guide-visible] ytd-page-manager.ytd-app {
            margin-left: 0 !important;
        }

        /* Center and expand video player */
        #columns {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        #columns #primary {
            max-width: fit-content;
        }

        /* Full width video */
        ytd-watch-flexy:not([theatre]):not([fullscreen]) .html5-video-container,
        ytd-watch-flexy:not([theatre]):not([fullscreen]) video {
            width: 100% !important;
            height: 100% !important;
            left: 0 !important;
        }

        /* Widen progress bar */
        .ytp-chrome-bottom {
            width: calc(98%) !important;
        }
    `;

    const style = document.createElement('style');
    style.textContent = css;
    document.documentElement.appendChild(style);
})();