Mercurial > kallithea
comparison rhodecode/public/js/yui/swfdetect/swfdetect.js @ 547:1e757ac98988
renamed project to rhodecode
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 06 Oct 2010 03:18:16 +0200 |
parents | pylons_app/public/js/yui/swfdetect/swfdetect.js@564e40829f80 |
children | 289ff43cc190 |
comparison
equal
deleted
inserted
replaced
546:7c2f5e4d7bbf | 547:1e757ac98988 |
---|---|
1 /* | |
2 Copyright (c) 2009, Yahoo! Inc. All rights reserved. | |
3 Code licensed under the BSD License: | |
4 http://developer.yahoo.net/yui/license.txt | |
5 version: 2.8.0r4 | |
6 */ | |
7 /** | |
8 * Utility for Flash version detection | |
9 * @namespace YAHOO.util | |
10 * @module swfdetect | |
11 */ | |
12 YAHOO.namespace("util"); | |
13 | |
14 /** | |
15 * Flafh detection utility. | |
16 * @class SWFDetect | |
17 * @static | |
18 */ | |
19 (function () { | |
20 | |
21 var version = 0; | |
22 var uA = YAHOO.env.ua; | |
23 var sF = "ShockwaveFlash"; | |
24 | |
25 if (uA.gecko || uA.webkit || uA.opera) { | |
26 if ((mF = navigator.mimeTypes['application/x-shockwave-flash'])) { | |
27 if ((eP = mF.enabledPlugin)) { | |
28 var vS = []; | |
29 vS = eP.description.replace(/\s[rd]/g, '.').replace(/[A-Za-z\s]+/g, '').split('.'); | |
30 version = vS[0] + '.'; | |
31 switch((vS[2].toString()).length) | |
32 { | |
33 case 1: | |
34 version += "00"; | |
35 break; | |
36 case 2: | |
37 version += "0"; | |
38 break; | |
39 } | |
40 version += vS[2]; | |
41 version = parseFloat(version); | |
42 } | |
43 } | |
44 } | |
45 else if(uA.ie) { | |
46 try | |
47 { | |
48 var ax6 = new ActiveXObject(sF + "." + sF + ".6"); | |
49 ax6.AllowScriptAccess = "always"; | |
50 } | |
51 catch(e) | |
52 { | |
53 if(ax6 != null) | |
54 { | |
55 version = 6.0; | |
56 } | |
57 } | |
58 if (version == 0) { | |
59 try | |
60 { | |
61 var ax = new ActiveXObject(sF + "." + sF); | |
62 var vS = []; | |
63 vS = ax.GetVariable("$version").replace(/[A-Za-z\s]+/g, '').split(','); | |
64 version = vS[0] + '.'; | |
65 switch((vS[2].toString()).length) | |
66 { | |
67 case 1: | |
68 version += "00"; | |
69 break; | |
70 case 2: | |
71 version += "0"; | |
72 break; | |
73 } | |
74 version += vS[2]; | |
75 version = parseFloat(version); | |
76 | |
77 } catch (e) {} | |
78 } | |
79 } | |
80 | |
81 uA.flash = version; | |
82 | |
83 YAHOO.util.SWFDetect = { | |
84 getFlashVersion : function () { | |
85 return version; | |
86 }, | |
87 | |
88 isFlashVersionAtLeast : function (ver) { | |
89 return version >= ver; | |
90 } | |
91 }; | |
92 })(); | |
93 YAHOO.register("swfdetect", YAHOO.util.SWFDetect, {version: "2.8.0r4", build: "2449"}); |