Greasy Fork is available in English.

YCS Minimize

minimize the YCS add on

  1. // ==UserScript==
  2. // @name YCS Minimize
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description minimize the YCS add on
  6. // @author JuliSharow
  7. // @match https://www.youtube.com/watch?*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. "use strict";
  15. const waitTime = 1000;
  16. const buttonId = "ycs_minimize";
  17.  
  18. function addMinimizeButton() {
  19. const ycs_app = document.querySelector(".ycs-app");
  20.  
  21. if (!ycs_app) {
  22. setTimeout(addMinimizeButton, waitTime);
  23. console.debug(
  24. `can not find ycs_app, trying again in ${waitTime} miliseconds`
  25. );
  26. return;
  27. }
  28.  
  29. const button = document.getElementById("ycs_load_stop")?.cloneNode(true);
  30. const newButton = document.getElementById(buttonId);
  31.  
  32. if (ycs_app === null || button === null || newButton !== null) {
  33. return;
  34. }
  35. button.id = buttonId;
  36. button.textContent = "minimize app";
  37. button.style = "position: relative";
  38. button.addEventListener("click", () => {
  39. const main = ycs_app.querySelector(".ycs-app-main");
  40. if (main.style.display !== "none") {
  41. main.style = "display: none";
  42. } else {
  43. main.style = "display: block";
  44. }
  45. });
  46. ycs_app.insertBefore(button, ycs_app.firstChild);
  47. }
  48. addMinimizeButton();
  49. })();