Youtube disable lightsaber sound

Removes the annoying youtube lightsaber sound

目前为 2015-12-07 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube disable lightsaber sound
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  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. 'use strict';
  13.  
  14. if (window.location.href.match("watch") !== null)
  15. light_main();
  16.  
  17. function light_main() {
  18. light_load_els();
  19. var loadinter = window.setInterval(light_load_els, 10);
  20.  
  21. var volume;
  22. var vchildren;
  23. var removeinter;
  24. function light_load_els() {
  25. volume = document.getElementsByClassName("ytp-volume-control")[0];
  26. if (!volume)
  27. return;
  28. window.clearInterval(loadinter);
  29. vchildren = volume.children;
  30. light_remove_els();
  31. removeinter = window.setInterval(light_remove_els, 100);
  32. }
  33.  
  34. function light_remove_els() {
  35. if (vchildren.length < 3)
  36. return;
  37. for (var i = 2; i < vchildren.length; i++)
  38. {
  39. vchildren[i].pause();
  40. vchildren[i].src = "";
  41. vchildren[i].load();
  42. vchildren[i].remove();
  43. }
  44. }
  45. }