JWPlayer Force HTML5

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

  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.1
  6. // @grant none
  7. // @include *
  8. // @exclude http://roosterteeth.com/*
  9. // @run-at document-start
  10. // @noframes
  11. // ==/UserScript==
  12.  
  13. var observer = new MutationObserver(function(mutations) {
  14. mutations.forEach(function(mutation) {
  15. for(var i = 0; i < mutation.addedNodes.length; i++)
  16. {
  17. findJWPScript(mutation.addedNodes[i]);
  18. if(typeof window.jwplayer !== 'undefined') break;
  19. }
  20. });
  21. });
  22.  
  23. for(var i = 0; i < document.scripts.length; i++)
  24. {
  25. findJWPScript(document.scripts[i]);
  26. if(typeof window.jwplayer !== 'undefined') break;
  27. }
  28.  
  29. function findJWPScript(start)
  30. {
  31. if(start.nodeName == "SCRIPT" && start.src && typeof window.jwplayer === 'undefined')
  32. {
  33. start.addEventListener("load",function()
  34. {
  35. if(typeof window.jwplayer !== 'undefined')
  36. {
  37. observer.disconnect();
  38.  
  39. if(window.jwplayer.utils.hasFlash) window.jwplayer.utils.hasFlash = function (){return!1};
  40. if(window.jwplayer.utils.isFlashSupported) window.jwplayer.utils.isFlashSupported = function (){return!1};
  41. if(window.jwplayer.utils.flashVersion) window.jwplayer.utils.flashVersion = function (){return 0};
  42. }
  43. });
  44. }
  45. else if(typeof window.jwplayer === 'undefined')
  46. {
  47. for(var i = 0; i < start.childNodes.length; i++)
  48. {
  49. findJWPScript(start.childNodes[i]);
  50. }
  51. }
  52. }
  53.  
  54. var config = { childList: true, subtree: true };
  55. if(typeof window.jwplayer == 'undefined') observer.observe(document, config);

QingJ © 2025

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