Toggle Youtube Styles

Adds toggles to enable/disable some styles that change Youtube

2024-07-04 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        Toggle Youtube Styles
// @license     MIT
// @namespace   rtonne
// @match       https://www.youtube.com/*
// @icon        https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @version     1.7
// @author      Rtonne
// @description Adds toggles to enable/disable some styles that change Youtube
// @require     https://update.greasyfork.org/scripts/498119/1395863/setupToggleCommands.js
// @grant       GM.addStyle
// @grant       GM.registerMenuCommand
// @grant       GM.unregisterMenuCommand
// @grant       GM.getValue
// @grant       GM.setValue
// ==/UserScript==

const commands = [
  {
    id: "guide_sections",
    default_value: true,
    on_text: "🞕 Guide Sections",
    off_text: "🞎 Guide Sections",
    toggleOnFunction: () =>
      GM.addStyle(`
      #sections.ytd-guide-renderer > ytd-guide-section-renderer:nth-child(n+3) {
        display: unset;
      }
    `),
    toggleOffFunction: () =>
      GM.addStyle(`
      #sections.ytd-guide-renderer > ytd-guide-section-renderer:nth-child(n+3) {
        display: none;
      }
    `),
  },
  {
    id: "comments",
    default_value: true,
    on_text: "🞕 Comments",
    off_text: "🞎 Comments",
    toggleOnFunction: () =>
      GM.addStyle(`
      ytd-comments#comments {
        display: unset;
      }
    `),
    toggleOffFunction: () =>
      GM.addStyle(`
      ytd-comments#comments {
        display: none;
      }
    `),
  },
  {
    id: "related_videos",
    default_value: true,
    on_text: "🞕 Related Videos",
    off_text: "🞎 Related Videos",
    toggleOnFunction: () =>
      GM.addStyle(`
      #secondary.ytd-watch-flexy > #secondary-inner > #related {
        display: unset;
      }
    `),
    toggleOffFunction: () =>
      GM.addStyle(`
      #secondary.ytd-watch-flexy > #secondary-inner > #related {
        display: none;
      }
    `),
  },
  {
    id: "shorts",
    default_value: true,
    on_text: "🞕 Shorts",
    off_text: "🞎 Shorts",
    toggleOnFunction: () =>
      GM.addStyle(`
      ytd-rich-section-renderer:has(> div > [is-shorts]) {
        display: unset;
      }
    `),
    toggleOffFunction: () =>
      GM.addStyle(`
      ytd-rich-section-renderer:has(> div > [is-shorts]) {
        display: none;
      }
    `),
  },
  {
    id: "community",
    default_value: true,
    on_text: "🞕 Community Posts",
    off_text: "🞎 Community Posts",
    toggleOnFunction: () =>
      GM.addStyle(`
      ytd-rich-section-renderer:has(> div > :not([is-shorts]):not([thumbnail-style])) {
        display: unset;
      }
    `),
    toggleOffFunction: () =>
      GM.addStyle(`
      ytd-rich-section-renderer:has(> div > :not([is-shorts]):not([thumbnail-style])) {
        display: none;
      }
    `),
  },
  {
    id: "description_shorts",
    default_value: true,
    on_text: "🞕 Remix Shorts in Description",
    off_text: "🞎 Remix Shorts in Description",
    toggleOnFunction: () =>
      GM.addStyle(`
      #description ytd-reel-shelf-renderer {
        display: unset;
      }
    `),
    toggleOffFunction: () =>
      GM.addStyle(`
      #description ytd-reel-shelf-renderer {
        display: none;
      }
    `),
  },
];

setupToggleCommands(commands);