OSDN Git Service

Version 0.6.134, add comments for closure compiler.
[pettanr/clientJs.git] / 0.6.x / js / 03_plugin / 00_XPlugin.js
index 863ebc3..1a65f93 100644 (file)
@@ -5,19 +5,29 @@
  * 
  * IE7でswfobjectが動作しない件
  * https://web.archive.org/web/20130317163030/http://mtl.recruit.co.jp/blog/2008/02/ie7swfobject.html
+ * 
+ * flash player 10, ie6+, ff2+, safari3, opera9.5
+ * flash player 11, ie7+, ff4(?), safari5, opera11
+ * flash player 12, ie8+, ff17, opera11
+ * 
+ * http://helpx.adobe.com/jp/flash-player/kb/228683.html
+ * flash player  9, Mac 10.1-10.3, 98, ME
+ * flash player 10.1, Mac 10.4
+ * flash player 10.3, Mac 10.5
+ * flash player 11.1, Win2k, Android 2.x-4.x
  */
 var X_Pulgin_FLASH_VERSION =
-               !X.UA.IE && navigator.plugins[ 'Shockwave Flash' ] ?
+               !X_UA[ 'IE' ] && navigator.plugins[ 'Shockwave Flash' ] ?
                        parseFloat( navigator.plugins[ 'Shockwave Flash' ].version ) :
-               !X.UA.IE4 && !X.UA.IE5 && X.UA.ActiveX ? (function(){
-                           var obj = eval( 'var a;try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}a' ),
+               !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( '.' );
                                return parseFloat( ver ) || 0;
                        })() :
                        0,
 
        X_Pulgin_FLASH_ENABLED =
-               X.UA.ActiveX ? !!X_Pulgin_FLASH_VERSION :
+               X_UA[ 'ActiveX' ] ? !!X_Pulgin_FLASH_VERSION :
                        navigator.mimeTypes &&
                        navigator.mimeTypes[ 'application/x-shockwave-flash' ] &&
                        navigator.mimeTypes[ 'application/x-shockwave-flash' ].enabledPlugin,
@@ -26,47 +36,66 @@ var X_Pulgin_FLASH_VERSION =
  * ie11 の 互換モード(8,7)では、Silverlight が動作しない?
  */
        X_Pulgin_SILVER_LIGHT_VERSION = 
-               !X.UA.IE && navigator.plugins[ 'Silverlight Plug-In' ] ?
+               !X_UA[ 'IE' ] && navigator.plugins[ 'Silverlight Plug-In' ] ?
                        parseFloat( navigator.plugins[ 'Silverlight Plug-In' ].version ) :
-               X.UA.ActiveX && 6 <= X.UA.IE && !X.UA.IECompat ? (function(){
+               X_UA[ 'ActiveX' ] && 6 <= X_UA[ 'IE' ] && !X_UA[ 'IECompat' ] ? (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' );
                        })() :
                        0,
 
        X_Pulgin_SILVER_LIGHT_ENABLED =
-               X.UA.ActiveX ? !!X_Pulgin_SILVER_LIGHT_VERSION :
+               X_UA[ 'ActiveX' ] ? !!X_Pulgin_SILVER_LIGHT_VERSION :
                        navigator.mimeTypes &&
                        navigator.mimeTypes[ 'application/x-silverlight' ] &&
                        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' ] ?
+               !X_UA[ 'IE' ] && navigator.plugins[ 'Unity Player' ] ?
                        parseFloat( navigator.plugins[ 'Unity Player' ].version ) :
-               !X.UA.IE4 && !X.UA.IE5 && X.UA.ActiveX ? (function(){
-                           var obj = eval( 'var a;try{a=new ActiveXObject("UnityWebPlayer.UnityWebPlayer.1")}catch(e){}a' );
+               !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;
                        })() :
                        0,
 
        X_Pulgin_UNITY_ENABLED =
-               X.UA.ActiveX ? !!X_Pulgin_UNITY_VERSION :
+               X_UA[ 'ActiveX' ] ? !!X_Pulgin_UNITY_VERSION :
                        navigator.mimeTypes &&
                        navigator.mimeTypes[ 'application/vnd.unity' ] &&
-                       navigator.mimeTypes[ 'application/vnd.unity' ].enabledPlugin;
+                       navigator.mimeTypes[ 'application/vnd.unity' ].enabledPlugin,
+
+       X_Pulgin_GEARS_ENABLED =
+               window.GearsFactory ||
+               ( X_UA[ 'ActiveX' ] && 6 <= X_UA[ 'IE' ] ?
+                       (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.Pulgin = {
+/**
+ * @namespace X.Pulgin
+ */
+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,
+       
+       GearsEnabled       : X_Pulgin_GEARS_ENABLED
        
 };
+
+if( X_Pulgin_GEARS_ENABLED ) alert( 'X_Pulgin_GEARS_ENABLED' );
+