Youtube Hide Watched

Hides viewed videos from your subscriptions.

  1. // ==UserScript==
  2. // @name Youtube Hide Watched
  3. // @namespace https://github.com/ToostInc/userscripts
  4. // @description Hides viewed videos from your subscriptions.
  5. // @include https://www.youtube.com/feed/subscriptions
  6. // @author Joost Bremmer < toost dot b at gmail dot com >
  7. // @copyright 2014, Joost Bremmer
  8. // @license MIT
  9. // @version 1.1.3
  10. // @date 13-06-2015
  11. // @require http://code.jquery.com/jquery-latest.min.js
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15.  
  16. // The MIT License
  17. //
  18. // Copyright (c) 2014 Joost Bremmer
  19. //
  20. // Permission is hereby granted, free of charge, to any person obtaining a
  21. // copy of this software and associated documentation files
  22. // (the "Software"), to deal in the Software without restriction,
  23. // including without limitation the rights to use, copy, modify, merge,
  24. // publish, distribute, sublicense, and/or sell copies of the Software, and
  25. // to permit persons to whom the Software is furnished to do so, subject to
  26. // the following conditions:
  27. //
  28. // The above copyright notice and this permission notice shall be included
  29. // in all copies or substantial portions of the Software.
  30. //
  31. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  32. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  33. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  34. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  35. // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  36. // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  37. // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  38.  
  39. $(document).ready (function () {
  40. //Add mutation observer, checks for changes in DOM
  41. if (MutationObserver) {
  42. var myObserver = new MutationObserver(hideWatched);
  43. }
  44. else {
  45. var myObserver = new WebKitMutationObserver(hideWatched);
  46. }
  47. myObserver.observe(document, { childList : true, subtree : true });
  48. hideWatched();
  49.  
  50. // Add checkbox
  51. var checker = '<li>\n'+
  52. '\t<label id="checker-container">\n'+
  53. '\t\t<input type="checkbox" id="hide-videos" checked="" />'+
  54. '\t\tHide watched videos'+
  55. '\t</label>\n'+
  56. '</li>';
  57. $("#appbar-nav .appbar-nav-menu").prepend(checker);
  58. $("#checker-container").css({
  59. 'color': "#666",
  60. "vertical-align" : "middle",
  61. "text-align" : "center"
  62. });
  63. //checkbox event
  64. $("#hide-videos").change(function() {
  65. if ( $(this).is(":not(:checked)") ) {
  66. showWatched();
  67. }
  68.  
  69. else {
  70. hideWatched();
  71. };
  72.  
  73. });
  74.  
  75. //BONUS: always enable load more button.
  76. $("button.load-more-button").removeProp("disabled");
  77.  
  78. hideWatched();
  79.  
  80.  
  81. });
  82.  
  83.  
  84. function hideWatched () {
  85.  
  86. if ( $("#hide-videos").is(":checked") ) {
  87. $("div.watched-badge").each(function() {
  88. $(this).closest("ol.item-section").hide("200");
  89.  
  90. });
  91.  
  92. }
  93. };
  94.  
  95. function showWatched() {
  96. $("div.watched-badge").each(function() {
  97. $(this).closest("ol.item-section").show("300");
  98.  
  99. });
  100. }

QingJ © 2025

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