Greasy Fork 支持简体中文。

Youtube helper

Removes "thanks", "download", "clip" and "description" buttons, also removes "Do you want to continue?" popup in the playlist

目前為 2022-06-20 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Youtube helper
  3. // @icon https://www.youtube.com/s/desktop/a14aba22/img/favicon_144x144.png
  4. // @description Removes "thanks", "download", "clip" and "description" buttons, also removes "Do you want to continue?" popup in the playlist
  5. // @author Murka
  6. // @version 0.2
  7. // @match *://www.youtube.com/*
  8. // @run-at document-start
  9. // @grant none
  10. // @license MIT
  11. // @namespace https://greasyfork.org/users/919633
  12. // ==/UserScript==
  13. /* jshint esversion:6 */
  14.  
  15. (function() {
  16.  
  17. Object.defineProperty(window, "_lact", {
  18. get() {
  19. return Date.now();
  20. }
  21. })
  22.  
  23. function createObserver(target, callback) {
  24. const observer = new MutationObserver(function(mutations) {
  25. for (const mutation of mutations) {
  26. for (const node of mutation.addedNodes) {
  27. callback(node);
  28. }
  29. }
  30. })
  31. observer.observe(target, { childList: true, subtree: true });
  32. return observer;
  33. }
  34.  
  35. const exclude = ["OFFLINE_DOWNLOAD", "MONEY_HEART", "CONTENT_CUT", "INFO"];
  36. const observer = createObserver(document, function(node) {
  37. if (node.id !== "top-level-buttons-computed") return;
  38. observer.disconnect();
  39.  
  40. for (const child of node.children) {
  41.  
  42. const data = child.__data && child.__data.data;
  43. const iconType = data && (data.defaultIcon && data.defaultIcon.iconType || data.icon && data.icon.iconType);
  44. if (iconType && exclude.includes(iconType)) {
  45. child.style.display = "none";
  46. }
  47. child.style.fontSize = "1em";
  48. }
  49. })
  50.  
  51. })();