Twitch Player Plus

Various tweaks to the Twitch HTML5 player UI

当前为 2015-10-03 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Twitch Player Plus
  3. // @namespace http://ehsankia.com
  4. // @version 0.1
  5. // @description Various tweaks to the Twitch HTML5 player UI
  6. // @match http://www.twitch.tv/**
  7. // @copyright 2015+, Ehsan Kia
  8. // ==/UserScript==
  9.  
  10. var id = setInterval(function() {
  11. var html5Player = $('div.player');
  12. if (html5Player.length > 0) {
  13. setTimeout(applyFixes, 3000);
  14. clearInterval(id);
  15. }
  16. }, 1000);
  17.  
  18. function applyFixes() {
  19. // Sticky volume slider
  20. $('.js-volume-container').css('width', '13em');
  21.  
  22. // Move quality option to main bar
  23. $(".js-quality").insertAfter($('.js-quality-display-contain'));
  24. $(".js-quality").css({float: "left", margin: "5px"});
  25. document.addEventListener("keypress", function(e){
  26. if(e.which === 102) {
  27. // enterFS($('div.player')[0]);
  28. }
  29. });
  30. }
  31.  
  32. function enterFS(elem) {
  33. if (elem.requestFullscreen) {
  34. elem.requestFullscreen();
  35. } else if (elem.msRequestFullscreen) {
  36. elem.msRequestFullscreen();
  37. } else if (elem.mozRequestFullScreen) {
  38. elem.mozRequestFullScreen();
  39. } else if (elem.webkitRequestFullscreen) {
  40. elem.webkitRequestFullscreen();
  41. }
  42. }