Youtube 隐藏评分栏

隐藏 喜欢/不喜欢 的评分栏。

  1. // ==UserScript==
  2. // @name Youtube: Hide Rating Bar
  3. // @name:zh-TW Youtube 隱藏評價欄
  4. // @name:zh-CN Youtube 隐藏评分栏
  5. // @name:ja Youtube 評価バーを非表示
  6. // @name:ko Youtube 등급 표시 줄 숨기기
  7. // @name:ru Youtube Скрыть панель рейтинга
  8. // @version 1.0.0
  9. // @description Hide the Like/Dislike bar.
  10. // @description:zh-TW 隱藏 喜歡/不喜歡 的評價欄。
  11. // @description:zh-CN 隐藏 喜欢/不喜欢 的评分栏。
  12. // @description:ja 高評価/低評価 バーを非表示にします。
  13. // @description:ko 좋아요 / 싫어요 표시 줄을 숨 깁니다.
  14. // @description:ru Скрыть панель «Мне нравится / не нравится».
  15. // @author Hayao-Gai
  16. // @namespace https://github.com/HayaoGai
  17. // @icon https://upload.wikimedia.org/wikipedia/commons/4/4c/YouTube_icon.png
  18. // @match https://www.youtube.com/*
  19. // @grant none
  20. // ==/UserScript==
  21.  
  22. /* jshint esversion: 6 */
  23.  
  24. (function() {
  25. 'use strict';
  26.  
  27. const targets = [
  28. //"ytd-toggle-button-renderer", // button
  29. "yt-formatted-string.style-scope.ytd-toggle-button-renderer", // number
  30. //"paper-tooltip.style-scope.ytd-toggle-button-renderer", // tooltip
  31. "#sentiment" // bar
  32. ];
  33.  
  34. let href = document.location.href;
  35.  
  36. init(10);
  37.  
  38. observation();
  39.  
  40. function init(times) {
  41. for (let i = 0; i < times; i++) {
  42. for (const target of targets) {
  43. setTimeout(() => hideTarget(target), 500 * i);
  44. }
  45. }
  46. }
  47.  
  48. function hideTarget(target) {
  49. document.querySelectorAll(target).forEach(t => t.remove());
  50. }
  51.  
  52. function observation() {
  53. const observer = new MutationObserver(mutations => {
  54. mutations.forEach(() => {
  55. if (href != document.location.href) {
  56. href = document.location.href;
  57. init(10);
  58. }
  59. });
  60. });
  61. const target = document.querySelector("body");
  62. const config = { childList: true, subtree: true };
  63. observer.observe(target, config);
  64. }
  65.  
  66. })();

QingJ © 2025

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