From 88aea581654a8a60ea37702c4547dfeea8099f4f Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 3 May 2015 21:28:34 +0200 Subject: [PATCH] Y_VLC.js fix VLC detection without var plugin.version (linux) --- src/nhttpd/web/Y_VLC.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/nhttpd/web/Y_VLC.js b/src/nhttpd/web/Y_VLC.js index 5f93d4794..7f35785e0 100644 --- a/src/nhttpd/web/Y_VLC.js +++ b/src/nhttpd/web/Y_VLC.js @@ -52,6 +52,7 @@ CyVLC.prototype = { } else if (navigator.plugins && (navigator.plugins.length > 0)) { var numPlugins = navigator.plugins.length; + var plug_version = "0.0.0"; for(var i = 0; i < numPlugins; i++) { var plugin = navigator.plugins[i]; var numTypes = plugin.length; @@ -60,12 +61,32 @@ CyVLC.prototype = { var mimetype = plugin[j]; if (mimetype) { if (mimetype.type.indexOf("application/x-vlc-plugin") != -1) { - return plugin.version; + if(plugin.version != 0){ + plug_version = plugin.version; + break; + } + else + { + var Suche = /(PLUGIN)/gi; + var Ergebnis = Suche.test(plugin.description); + if (Ergebnis == true){ + var ex = /^.*[pP]lugin [\"]*([^ \"]*)[\"]*.*$/; + var ve = ex.exec(plugin.description); + }else{ + var ex = /^.*[vV]ersion [\"]*([^ \"]*)[\"]*.*$/; + var ve = ex.exec(plugin.description); + } + var Suche = /([0-9])/g; + var Ergebnis = Suche.test(ve); + if (Ergebnis == true) + plug_version = ve[1]; + break; + } } } } } - return "0.0.0"; + return plug_version; } else return "0.0.0";