JWPlayer Force HTML5

Makes JWPlayer think that you don't have the Flash plugin, thus forcing HTML5 mode

当前为 2017-02-07 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name JWPlayer Force HTML5
  3. // @namespace DoomTay
  4. // @description Makes JWPlayer think that you don't have the Flash plugin, thus forcing HTML5 mode
  5. // @version 1.0.0
  6. // @grant none
  7. // @exclude http://roosterteeth.com/*
  8. // @run-at document-start
  9. // @noframes
  10. // ==/UserScript==
  11.  
  12. var observer = new MutationObserver(function(mutations) {
  13. mutations.forEach(function(mutation) {
  14. for(var i = 0; i < mutation.addedNodes.length; i++)
  15. {
  16. findJWPScript(mutation.addedNodes[i]);
  17. if(typeof window.jwplayer !== 'undefined') break;
  18. }
  19. });
  20. });
  21.  
  22. for(var i = 0; i < document.scripts.length; i++)
  23. {
  24. findJWPScript(document.scripts[i]);
  25. if(typeof window.jwplayer !== 'undefined') break;
  26. }
  27.  
  28. function findJWPScript(start)
  29. {
  30. if(start.nodeName == "SCRIPT" && start.src && typeof window.jwplayer === 'undefined')
  31. {
  32. start.addEventListener("load",function()
  33. {
  34. if(typeof window.jwplayer !== 'undefined')
  35. {
  36. observer.disconnect();
  37. if(window.jwplayer.utils.hasFlash) window.jwplayer.utils.hasFlash = function (){return!1};
  38. if(window.jwplayer.utils.isFlashSupported) window.jwplayer.utils.isFlashSupported = function (){return!1};
  39. if(window.jwplayer.utils.flashVersion) window.jwplayer.utils.flashVersion = function (){return 0};
  40. }
  41. });
  42. }
  43. else if(typeof window.jwplayer === 'undefined')
  44. {
  45. for(var i = 0; i < start.childNodes.length; i++)
  46. {
  47. findJWPScript(start.childNodes[i]);
  48. }
  49. }
  50. }
  51.  
  52. var config = { childList: true, subtree: true };
  53. if(typeof window.jwplayer == 'undefined') observer.observe(document, config);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址