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. // @version 1.3
  9. // ==/UserScript==
  10.  
  11. // reload script on page change using spf events (normal youtube)
  12. window.addEventListener("spfdone", function() {
  13. main();
  14. });
  15.  
  16. // reload script on page change using youtube polymer fire events (material youtube)
  17. window.addEventListener("yt-page-data-updated", function() {
  18. main();
  19. });
  20.  
  21. main();
  22.  
  23. function main() {
  24. if (isPlayerAvailable()) {
  25. if (document.URL.indexOf("&gl=CA") === -1) {
  26. window.location = document.URL + "&gl=CA";
  27. }
  28. }
  29. }
  30.  
  31. function isPlayerAvailable() { // true if a youtube video is available ( false if live video)
  32. return /https:\/\/www\.youtube\.com\/watch\?v=.*/.test(document.location.href) && document.getElementById('live-chat-iframe') === null;
  33. }