YouTube Web Tweaks Lite

This script is based on YouTube Web Tweaks (but with minimal tweaks into it)

// ==UserScript==
// @name         YouTube Web Tweaks Lite
// @version      1.6.0
// @description  This script is based on YouTube Web Tweaks (but with minimal tweaks into it)
// @author       Magma_Craft
// @license MIT
// @match        *://www.youtube.com/*
// @namespace    https://gf.qytechs.cn/en/users/933798
// @icon         https://www.youtube.com/favicon.ico
// @unwrap
// @run-at       document-start
// @unwrap
// @grant        none
// ==/UserScript==

(function() {
let css = `
/* Remove filter categories on search results and playlists to make the UI less usable on low-entry machines */
ytd-item-section-renderer.style-scope.ytd-section-list-renderer[page-subtype="playlist"] > #header.ytd-item-section-renderer > ytd-feed-filter-chip-bar-renderer {
display: none !important;
}
 
div#chip-bar.style-scope.ytd-search-header-renderer > yt-chip-cloud-renderer.style-scope.ytd-search-header-renderer > div#container.style-scope.yt-chip-cloud-renderer {
display: none !important;
}
 
/* Remove minimal annoyances */
ytd-ad-slot-renderer, div#sparkles-container.style-scope.ytd-promoted-sparkles-web-renderer, ytm-promoted-sparkles-web-renderer, ytd-video-quality-promo-renderer, ytd-merch-shelf-renderer, ytd-enforcement-message-view-model, div[is-shared-heimdall], tp-yt-iron-overlay-backdrop.opened, ytd-promoted-sparkles-web-renderer, ytd-text-image-no-button-layout-renderer, #cinematics.ytd-watch-flexy {
display: none !important
}

/* Disable infinite scrolling (partially broken when YouTube changes their backend) */
#related ytd-compact-video-renderer, #related ytd-compact-playlist-renderer, #related ytd-compact-radio-renderer, #related ytd-compact-movie-renderer, #related yt-lockup-view-model, #related ytd-channel-renderer, #related ytd-continuation-item-renderer, #related #continuations {
display: none !important
}

#related ytd-compact-video-renderer:nth-of-type(1), #related yt-lockup-view-model:nth-of-type(1), #related ytd-compact-video-renderer:nth-of-type(2), #related yt-lockup-view-model:nth-of-type(2), #related ytd-compact-video-renderer:nth-of-type(3), #related yt-lockup-view-model:nth-of-type(3), #related ytd-compact-video-renderer:nth-of-type(4), #related yt-lockup-view-model:nth-of-type(4), #related ytd-compact-video-renderer:nth-of-type(5), #related yt-lockup-view-model:nth-of-type(5), #related ytd-compact-video-renderer:nth-of-type(6), #related yt-lockup-view-model:nth-of-type(6), #secondary #related ytd-compact-video-renderer:nth-of-type(7), #secondary #related yt-lockup-view-model:nth-of-type(7), #secondary #related ytd-compact-video-renderer:nth-of-type(8), #secondary #related yt-lockup-view-model:nth-of-type(8), #secondary #related ytd-compact-video-renderer:nth-of-type(9), #secondary #related yt-lockup-view-model:nth-of-type(9), #secondary #related ytd-compact-video-renderer:nth-of-type(10), #secondary #related yt-lockup-view-model:nth-of-type(10) {
display: flex !important
}

/* More tweaks to the UI (this was meant for older browsers without uBlock Origin) */
#secondary.ytd-watch-grid {
width: 402px !important;
min-width: 300px !important
}

ytd-watch-flexy[default-layout][reduced-top-margin] #primary.ytd-watch-flexy, ytd-watch-flexy[default-layout][reduced-top-margin] #secondary.ytd-watch-flexy {
padding-top: var(--ytd-margin-6x) !important
}

ytd-watch-metadata[title-headline-xs] h1.ytd-watch-metadata, ytd-watch-metadata[title-headline-m] h1.ytd-watch-metadata {
font-size: 2rem !important;
line-height: 2.8rem !important
}

ytd-search ytd-video-renderer, ytd-search ytd-channel-renderer, ytd-search ytd-playlist-renderer, ytd-search ytd-radio-renderer, ytd-search ytd-movie-renderer, ytd-video-renderer.style-scope.ytd-item-section-renderer, ytd-playlist-renderer.style-scope.ytd-item-section-renderer, ytd-search .lockup.ytd-item-section-renderer {
margin-top: 16px !important
}

ytd-compact-video-renderer.style-scope.ytd-item-section-renderer, #related .lockup.ytd-item-section-renderer {
margin-top: 8px !important
}`;
if (typeof GM_addStyle !== "undefined") {
  GM_addStyle(css);
} else {
  let styleNode = document.createElement("style");
  styleNode.appendChild(document.createTextNode(css));
  (document.querySelector("head") || document.documentElement).appendChild(styleNode);
}
})();
 
//
// What is this userscript trying to address?
// When playing a video, only a small part of the video loads, and the subsequent
// parts do not load afterward.

(function () {
  "use strict";

  const originalGetContext = HTMLCanvasElement.prototype.getContext;
  HTMLCanvasElement.prototype.getContext = function (contextType) {
    if (contextType === "webgl" || contextType === "webgl2") {
      console.log("WebGL is disabled by Tampermonkey");
      return null;
    }
    return originalGetContext.apply(this, arguments);
  };
})();

QingJ © 2025

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