Youtube disable lightsaber sound

Removes the annoying youtube lightsaber sound

目前为 2016-01-06 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube disable lightsaber sound
  3. // @namespace https://github.com/MiJyn/youtube-no-lightsaber
  4. // @version 1.0.3
  5. // @description Removes the annoying youtube lightsaber sound
  6. // @author Anonymous Meerkat
  7. // @include https://www.youtube.com/*
  8. // @grant none
  9. // @run-at document-end
  10. // ==/UserScript==
  11. /* jshint -W097 */
  12. if (window.location.href.match(".youtube.com") !== null)
  13. {
  14. light_main();
  15. }
  16.  
  17. function light_main() {
  18. light_load_els();
  19. var loadinter = window.setInterval(function() {
  20. light_load_els();
  21. }, 10);
  22.  
  23. var volume;
  24. var vchildren;
  25. var removeinter;
  26. function light_load_els() {
  27. volume = document.getElementsByClassName("ytp-volume-panel")[0];
  28. if (!volume)
  29. return;
  30. window.clearInterval(loadinter);
  31. vchildren = volume.children;
  32. light_remove_els();
  33. removeinter = window.setInterval(function() {
  34. light_remove_els();
  35. }, 100);
  36. }
  37.  
  38. function light_remove_els() {
  39. if (vchildren.length < 2)
  40. return;
  41. for (var i = 1; i < vchildren.length; i++)
  42. {
  43. vchildren[i].pause();
  44. vchildren[i].src = "";
  45. vchildren[i].load();
  46. vchildren[i].remove();
  47. }
  48. }
  49. }