OSDN Git Service

Version 0.6.173, add OS detection to X.UA, fix X.Timer @Chrome & X.Audio.
[pettanr/clientJs.git] / 0.6.x / js / 03_plugin / 00_XPlugin.js
index 7bd7e97..ed4619e 100644 (file)
@@ -17,8 +17,7 @@
  * flash player 11.1, Win2k, Android 2.x-4.x
  */
 var X_Pulgin_FLASH_VERSION =
-               !X_UA[ 'IE' ] && navigator.plugins[ 'Shockwave Flash' ] ?
-                       parseFloat( navigator.plugins[ 'Shockwave Flash' ].version ) :
+               !X_UA[ 'IE' ] || !X_UA[ 'ActiveX' ] ? parseFloat( X_Object_find( navigator, 'plugins>Shockwave Flash>version' ) || 0 ) :
                !X_UA[ 'IE4' ] && !X_UA[ 'IE5' ] && X_UA[ 'ActiveX' ] ? (function(){
                            var obj = eval( 'var a,e;try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}a' ),
                                ver = obj && obj[ 'GetVariable' ]( '$version' ).split( ' ' ).join( '.' );
@@ -28,16 +27,13 @@ var X_Pulgin_FLASH_VERSION =
 
        X_Pulgin_FLASH_ENABLED =
                X_UA[ 'ActiveX' ] ? !!X_Pulgin_FLASH_VERSION :
-                       navigator.mimeTypes &&
-                       navigator.mimeTypes[ 'application/x-shockwave-flash' ] &&
-                       navigator.mimeTypes[ 'application/x-shockwave-flash' ].enabledPlugin,
+                       X_Object_find( navigator, 'mimeTypes>application/x-shockwave-flash>enabledPlugin' ),
 
 /*
- * ie11 の 互換モード(8,7)では、Silverlight が動作しない?
+ * ie11 の 互換モード(8,7)では、Silverlight が動作しない?
  */
        X_Pulgin_SILVER_LIGHT_VERSION = 
-               !X_UA[ 'IE' ] && navigator.plugins[ 'Silverlight Plug-In' ] ?
-                       parseFloat( navigator.plugins[ 'Silverlight Plug-In' ].version ) :
+               !X_UA[ 'IE' ] || !X_UA[ 'ActiveX' ] ? parseFloat( X_Object_find( navigator, 'plugins>Silverlight Plug-In>version' ) || 0 ) :
                X_UA[ 'ActiveX' ] && 6 <= X_UA[ 'IE' ] ? (function(){
                            return eval( 'var a,i=0;try{a=new ActiveXObject("AgControl.AgControl");for(i=5;i;--i)if(a.IsVersionSupported(i+".0"))break;}catch(e){i=0}i' );
                        })() :
@@ -45,14 +41,12 @@ var X_Pulgin_FLASH_VERSION =
 
        X_Pulgin_SILVER_LIGHT_ENABLED =
                X_UA[ 'ActiveX' ] ? !!X_Pulgin_SILVER_LIGHT_VERSION :
-                       navigator.mimeTypes &&
-                       navigator.mimeTypes[ 'application/x-silverlight' ] &&
-                       navigator.mimeTypes[ 'application/x-silverlight' ].enabledPlugin,
+                       X_Object_find( navigator, 'mimeTypes>application/x-silverlight>enabledPlugin' ),
 
 //http://docs.unity3d.ru/Manual/Detecting%20the%20Unity%20Web%20Player%20using%20browser%20scripting.html
        X_Pulgin_UNITY_VERSION =        
-               !X_UA[ 'IE' ] && navigator.plugins[ 'Unity Player' ] ?
-                       parseFloat( navigator.plugins[ 'Unity Player' ].version ) :
+               !X_UA[ 'IE' ] || !X_UA[ 'ActiveX' ] ?
+                       parseFloat( X_Object_find( navigator, 'plugins>Unity Player>version' ) || 0 ) :
                !X_UA[ 'IE4' ] && !X_UA[ 'IE5' ] && X_UA[ 'ActiveX' ] ? (function(){
                            var obj = eval( 'var a,e;try{a=new ActiveXObject("UnityWebPlayer.UnityWebPlayer.1")}catch(e){}a' );
                            return obj ? parseFloat( obj[ 'GetPluginVersion' ]() ) : 0;
@@ -61,9 +55,7 @@ var X_Pulgin_FLASH_VERSION =
 
        X_Pulgin_UNITY_ENABLED =
                X_UA[ 'ActiveX' ] ? !!X_Pulgin_UNITY_VERSION :
-                       navigator.mimeTypes &&
-                       navigator.mimeTypes[ 'application/vnd.unity' ] &&
-                       navigator.mimeTypes[ 'application/vnd.unity' ].enabledPlugin,
+                       X_Object_find( navigator, 'mimeTypes>application/vnd.unity>enabledPlugin' ),
 
        X_Pulgin_GEARS_ENABLED =
                window.GearsFactory ||
@@ -71,11 +63,26 @@ var X_Pulgin_FLASH_VERSION =
                        (function(){
                            return eval( 'var a,e;try{a=new ActiveXObject("Gears.Factory")}catch(e){}!!a' );
                        })() :
-                       navigator.mimeTypes &&
-                       navigator.mimeTypes[ 'application/x-googlegears' ] &&
-                       navigator.mimeTypes[ 'application/x-googlegears' ].enabledPlugin
+                       X_Object_find( navigator, 'mimeTypes>application/x-googlegears>enabledPlugin' )
                ),
        
+       // QuickTime Plug-in 7.7.6
+       /*
+       X_Pulgin_QUICKTIME_VERSION =
+                       !X_UA[ 'IE' ] || !X_UA[ 'ActiveX' ] ? (function( plugins, k ){
+                               for( k in plugins ){
+                                       if( k.indexOf( 'QuickTime' ) === 0 ) return parseFloat( k.substr( 18 ) ) || 0;
+                               };
+                               return 0;
+                       })( navigator.plugins ) :
+                       !X_UA[ 'IE4' ] && !X_UA[ 'IE5' ] && X_UA[ 'ActiveX' ] ? (function(){
+                                   var obj = eval( 'var a,e;try{a=new ActiveXObject("QuickTimeCheckObject.QuickTimeCheck.1")}catch(e){}a' ),
+                                       ver = obj && obj[ 'QuickTimeVersion' ].toString( 16 );
+
+                                       return ver ? parseFloat( ver.substr( 0, 3 ) ) / 100 : 0;
+                               })() :
+                               0, */
+       
        X_Pulgin_VBS_ENABLED =
                X_UA[ 'Windows' ] && !X_UA[ 'WinCE' ] && X_UA[ 'IE' ] < 11;
 
@@ -87,17 +94,19 @@ X[ 'Pulgin' ] = {
        
        'Flash'              : X_Pulgin_FLASH_VERSION,
 
-       'FlashEnabled'       : !!X_Pulgin_FLASH_ENABLED,
+       'FlashEnabled'       : X_Pulgin_FLASH_ENABLED,
 
        'Silverlight'        : X_Pulgin_SILVER_LIGHT_VERSION,
        
-       'SilverlightEnabled' : !!X_Pulgin_SILVER_LIGHT_ENABLED,
+       'SilverlightEnabled' : X_Pulgin_SILVER_LIGHT_ENABLED,
        
        'Unity'              : X_Pulgin_UNITY_VERSION,
        
-       'UnityEnabled'       : !!X_Pulgin_UNITY_ENABLED,
+       'UnityEnabled'       : X_Pulgin_UNITY_ENABLED,
+       
+       'QuickTime'          : X_Pulgin_QUICKTIME_VERSION,
        
-       'GearsEnabled'       : X_Pulgin_GEARS_ENABLED
+       'GearsEnabled'       : !!X_Pulgin_GEARS_ENABLED
        
 };