OSDN Git Service

aa9daf99abd09b7dd2522288f513ca7dabbe76b4
[pettanr/clientJs.git] / 0.6.x / js / 03_plugin / 00_XPlugin.js
1 /*
2  * VBS
3  */
4
5 if( false && 5 <= X_UA[ 'IE' ] && X_UA[ 'IE' ] < 11 ){
6         (function(){
7
8                 var script = document.createElement( "script" ) ;
9                 script[ "type" ] = "text/vbscript" ;
10                 script.text = [
11                     "Function vba_IEBinaryToArrayBytes()\n" ,
12                     "  vba_IEBinaryToArrayBytes = 1\n" ,
13                     "End Function\n"
14                     ].join( "" ) ;
15                 document.getElementsByTagName("head")[ 0 ].appendChild( script ) ;
16                 
17                 // alert( vba_IEBinaryToArrayBytes() );
18         })();
19         
20 };
21
22
23 /*
24  * Flash Player 10 バージョン判別チェックリスト
25  * http://www.adobe.com/jp/devnet/flashplayer/articles/ver_check_flp10.html
26  * 
27  * IE7でswfobjectが動作しない件
28  * https://web.archive.org/web/20130317163030/http://mtl.recruit.co.jp/blog/2008/02/ie7swfobject.html
29  * 
30  * flash player 10, ie6+, ff2+, safari3, opera9.5
31  * flash player 11, ie7+, ff4(?), safari5, opera11
32  * flash player 12, ie8+, ff17, opera11
33  * 
34  * http://helpx.adobe.com/jp/flash-player/kb/228683.html
35  * flash player  9, Mac 10.1-10.3, 98, ME
36  * flash player 10.1, Mac 10.4
37  * flash player 10.3, Mac 10.5
38  * flash player 11.1, Win2k, Android 2.x-4.x
39  */
40 var X_Pulgin_FLASH_VERSION =
41                 !X_UA[ 'IE' ] && navigator.plugins[ 'Shockwave Flash' ] ?
42                         parseFloat( navigator.plugins[ 'Shockwave Flash' ].version ) :
43                 !X_UA[ 'IE4' ] && !X_UA[ 'IE5' ] && X_UA[ 'ActiveX' ] ? (function(){
44                             var obj = eval( 'var a,e;try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}a' ),
45                                 ver = obj && obj[ 'GetVariable' ]( '$version' ).split( ' ' ).join( '.' );
46                                 return parseFloat( ver ) || 0;
47                         })() :
48                         0,
49
50         X_Pulgin_FLASH_ENABLED =
51                 X_UA[ 'ActiveX' ] ? !!X_Pulgin_FLASH_VERSION :
52                         navigator.mimeTypes &&
53                         navigator.mimeTypes[ 'application/x-shockwave-flash' ] &&
54                         navigator.mimeTypes[ 'application/x-shockwave-flash' ].enabledPlugin,
55
56 /*
57  * ie11 の 互換モード(8,7)では、Silverlight が動作しない?
58  */
59         X_Pulgin_SILVER_LIGHT_VERSION = 
60                 !X_UA[ 'IE' ] && navigator.plugins[ 'Silverlight Plug-In' ] ?
61                         parseFloat( navigator.plugins[ 'Silverlight Plug-In' ].version ) :
62                 X_UA[ 'ActiveX' ] && 6 <= X_UA[ 'IE' ] ? (function(){
63                             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' );
64                         })() :
65                         0,
66
67         X_Pulgin_SILVER_LIGHT_ENABLED =
68                 X_UA[ 'ActiveX' ] ? !!X_Pulgin_SILVER_LIGHT_VERSION :
69                         navigator.mimeTypes &&
70                         navigator.mimeTypes[ 'application/x-silverlight' ] &&
71                         navigator.mimeTypes[ 'application/x-silverlight' ].enabledPlugin,
72
73 //http://docs.unity3d.ru/Manual/Detecting%20the%20Unity%20Web%20Player%20using%20browser%20scripting.html
74         X_Pulgin_UNITY_VERSION =        
75                 !X_UA[ 'IE' ] && navigator.plugins[ 'Unity Player' ] ?
76                         parseFloat( navigator.plugins[ 'Unity Player' ].version ) :
77                 !X_UA[ 'IE4' ] && !X_UA[ 'IE5' ] && X_UA[ 'ActiveX' ] ? (function(){
78                             var obj = eval( 'var a,e;try{a=new ActiveXObject("UnityWebPlayer.UnityWebPlayer.1")}catch(e){}a' );
79                             return obj ? parseFloat( obj[ 'GetPluginVersion' ]() ) : 0;
80                         })() :
81                         0,
82
83         X_Pulgin_UNITY_ENABLED =
84                 X_UA[ 'ActiveX' ] ? !!X_Pulgin_UNITY_VERSION :
85                         navigator.mimeTypes &&
86                         navigator.mimeTypes[ 'application/vnd.unity' ] &&
87                         navigator.mimeTypes[ 'application/vnd.unity' ].enabledPlugin,
88
89         X_Pulgin_GEARS_ENABLED =
90                 window.GearsFactory ||
91                 ( X_UA[ 'ActiveX' ] && 6 <= X_UA[ 'IE' ] ?
92                         (function(){
93                             return eval( 'var a,e;try{a=new ActiveXObject("Gears.Factory")}catch(e){}!!a' );
94                         })() :
95                         navigator.mimeTypes &&
96                         navigator.mimeTypes[ 'application/x-googlegears' ] &&
97                         navigator.mimeTypes[ 'application/x-googlegears' ].enabledPlugin
98                 );
99
100 /**
101  * @namespace X.Pulgin
102  */
103 X[ 'Pulgin' ] = {
104         
105         'Flash'              : X_Pulgin_FLASH_VERSION,
106
107         'FlashEnabled'       : !!X_Pulgin_FLASH_ENABLED,
108
109         'Silverlight'        : X_Pulgin_SILVER_LIGHT_VERSION,
110         
111         'SilverlightEnabled' : !!X_Pulgin_SILVER_LIGHT_ENABLED,
112         
113         'Unity'              : X_Pulgin_UNITY_VERSION,
114         
115         'UnityEnabled'       : !!X_Pulgin_UNITY_ENABLED,
116         
117         'GearsEnabled'       : X_Pulgin_GEARS_ENABLED
118         
119 };
120
121 //if( X_Pulgin_GEARS_ENABLED ) alert( 'X_Pulgin_GEARS_ENABLED' );
122