Youtube Auto Quick Buffer

Quickens the bufferer on all Youtube videos

目前为 2017-05-31 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube Auto Quick Buffer
  3. // @namespace https://greasyfork.org/en/users/8935-daniel-jochem?sort=ratings
  4. // @description Quickens the bufferer on all Youtube videos
  5. // @match https://www.youtube.com
  6. // @include https://www.youtube.com/*
  7. // @grant none
  8. // @run-at document-end
  9. // @version 1.3
  10. // ==/UserScript==
  11.  
  12. // reload script on page change using spf events (normal youtube)
  13. window.addEventListener("spfdone", function() {
  14. main();
  15. });
  16.  
  17. // reload script on page change using youtube polymer fire events (material youtube)
  18. window.addEventListener("yt-page-data-updated", function() {
  19. main();
  20. });
  21.  
  22. main();
  23.  
  24. function main() {
  25. if (isPlayerAvailable()) {
  26. if (document.URL.indexOf("&gl=CA") === -1) {
  27. window.location = document.URL + "&gl=CA";
  28. }
  29. }
  30. }
  31.  
  32. function isPlayerAvailable() { // true if a youtube video is available ( false if live video)
  33. return /https:\/\/www\.youtube\.com\/watch\?v=.*/.test(document.location.href) && document.getElementById('live-chat-iframe') === null;
  34. }