Youtube Hide Watched

Hides viewed videos from your subscriptions.

当前为 2014-08-04 提交的版本,查看 最新版本

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

QingJ © 2025

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