Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

swfdetect-debug.js 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. Copyright (c) 2010, Yahoo! Inc. All rights reserved.
  3. Code licensed under the BSD License:
  4. http://developer.yahoo.com/yui/license.html
  5. version: 3.4.0
  6. build: nightly
  7. */
  8. YUI.add('swfdetect', function(Y) {
  9. /**
  10. * Utility for Flash version detection
  11. * @module swfdetect
  12. */
  13. // shortcuts
  14. var version = 0,
  15. uA = Y.UA,
  16. lG = Y.Lang,
  17. sF = "ShockwaveFlash",
  18. mF, eP, vS, ax6, ax;
  19. function makeInt(n) {
  20. return parseInt(n, 10);
  21. }
  22. function parseFlashVersion (flashVer) {
  23. if (lG.isNumber(makeInt(flashVer[0]))) {
  24. uA.flashMajor = flashVer[0];
  25. }
  26. if (lG.isNumber(makeInt(flashVer[1]))) {
  27. uA.flashMinor = flashVer[1];
  28. }
  29. if (lG.isNumber(makeInt(flashVer[2]))) {
  30. uA.flashRev = flashVer[2];
  31. }
  32. }
  33. if (uA.gecko || uA.webkit || uA.opera) {
  34. if ((mF = navigator.mimeTypes['application/x-shockwave-flash'])) {
  35. if ((eP = mF.enabledPlugin)) {
  36. vS = eP.description.replace(/\s[rd]/g, '.').replace(/[A-Za-z\s]+/g, '').split('.');
  37. Y.log(vS[0]);
  38. parseFlashVersion(vS);
  39. }
  40. }
  41. }
  42. else if(uA.ie) {
  43. try
  44. {
  45. ax6 = new ActiveXObject(sF + "." + sF + ".6");
  46. ax6.AllowScriptAccess = "always";
  47. }
  48. catch (e)
  49. {
  50. if(ax6 !== null)
  51. {
  52. version = 6.0;
  53. }
  54. }
  55. if (version === 0) {
  56. try
  57. {
  58. ax = new ActiveXObject(sF + "." + sF);
  59. vS = ax.GetVariable("$version").replace(/[A-Za-z\s]+/g, '').split(',');
  60. parseFlashVersion(vS);
  61. } catch (e2) {}
  62. }
  63. }
  64. Y.SWFDetect = {
  65. /**
  66. * Returns the version of either the Flash Player plugin (in Mozilla/WebKit/Opera browsers),
  67. * or the Flash Player ActiveX control (in IE), as a String of the form "MM.mm.rr", where
  68. * MM is the major version, mm is the minor version, and rr is the revision.
  69. * @method getFlashVersion
  70. */
  71. getFlashVersion : function () {
  72. return (String(uA.flashMajor) + "." + String(uA.flashMinor) + "." + String(uA.flashRev));
  73. },
  74. /**
  75. * Checks whether the version of the Flash player installed on the user's machine is greater
  76. * than or equal to the one specified. If it is, this method returns true; it is false otherwise.
  77. * @method isFlashVersionAtLeast
  78. * @return {Boolean} Whether the Flash player version is greater than or equal to the one specified.
  79. * @param flashMajor {int} The Major version of the Flash player to compare against.
  80. * @param flashMinor {int} The Minor version of the Flash player to compare against.
  81. * @param flashRev {int} The Revision version of the Flash player to compare against.
  82. */
  83. isFlashVersionAtLeast : function (flashMajor, flashMinor, flashRev) {
  84. var uaMajor = makeInt(uA.flashMajor),
  85. uaMinor = makeInt(uA.flashMinor),
  86. uaRev = makeInt(uA.flashRev);
  87. flashMajor = makeInt(flashMajor || 0);
  88. flashMinor = makeInt(flashMinor || 0);
  89. flashRev = makeInt(flashRev || 0);
  90. if (flashMajor === uaMajor) {
  91. if (flashMinor === uaMinor) {
  92. return flashRev <= uaRev;
  93. }
  94. return flashMinor < uaMinor;
  95. }
  96. return flashMajor < uaMajor;
  97. }
  98. };
  99. }, '3.4.0' ,{requires:['yui-base']});