JWPlayer Force HTML5

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        JWPlayer Force HTML5
// @namespace   DoomTay
// @description Makes JWPlayer think that you don't have the Flash plugin, thus forcing HTML5 mode
// @version     1.0.1
// @grant       none
// @include     *
// @exclude     http://roosterteeth.com/*
// @run-at      document-start
// @noframes
// ==/UserScript==

var observer = new MutationObserver(function(mutations) {
	mutations.forEach(function(mutation) {
		for(var i = 0; i < mutation.addedNodes.length; i++)
		{
			findJWPScript(mutation.addedNodes[i]);
			if(typeof window.jwplayer !== 'undefined') break;
		}
	});
});

for(var i = 0; i < document.scripts.length; i++)
{
	findJWPScript(document.scripts[i]);
	if(typeof window.jwplayer !== 'undefined') break;
}

function findJWPScript(start)
{
	if(start.nodeName == "SCRIPT" && start.src && typeof window.jwplayer === 'undefined')
	{
		start.addEventListener("load",function()
		{
			if(typeof window.jwplayer !== 'undefined')
			{
				observer.disconnect();

				if(window.jwplayer.utils.hasFlash) window.jwplayer.utils.hasFlash = function (){return!1};
				if(window.jwplayer.utils.isFlashSupported) window.jwplayer.utils.isFlashSupported = function (){return!1};
				if(window.jwplayer.utils.flashVersion) window.jwplayer.utils.flashVersion = function (){return 0};
			}
		});
	}
	else if(typeof window.jwplayer === 'undefined')
	{
		for(var i = 0; i < start.childNodes.length; i++)
		{
			findJWPScript(start.childNodes[i]);
		}
	}
}

var config = { childList: true, subtree: true };
if(typeof window.jwplayer == 'undefined') observer.observe(document, config);