jsmethods.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Globals
  2. // Major version of Flash required
  3. var requiredMajorVersion = 7;
  4. // Minor version of Flash required
  5. var requiredMinorVersion = 0;
  6. // Minor version of Flash required
  7. var requiredRevision = 0;
  8. // the version of javascript supported
  9. var jsVersion = 1.0;
  10. //
  11. var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
  12. var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
  13. var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
  14. jsVersion = 1.1;
  15. // JavaScript helper required to detect Flash Player PlugIn version information
  16. function JSGetSwfVer(i){
  17. // NS/Opera version >= 3 check for Flash plugin in plugin array
  18. if (navigator.plugins != null && navigator.plugins.length > 0) {
  19. if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
  20. var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
  21. var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
  22. descArray = flashDescription.split(" ");
  23. tempArrayMajor = descArray[2].split(".");
  24. versionMajor = tempArrayMajor[0];
  25. versionMinor = tempArrayMajor[1];
  26. if ( descArray[3] != "" ) {
  27. tempArrayMinor = descArray[3].split("r");
  28. } else {
  29. tempArrayMinor = descArray[4].split("r");
  30. }
  31. versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
  32. flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
  33. } else {
  34. flashVer = -1;
  35. }
  36. }
  37. // MSN/WebTV 2.6 supports Flash 4
  38. else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
  39. // WebTV 2.5 supports Flash 3
  40. else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
  41. // older WebTV supports Flash 2
  42. else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
  43. // Can\'t detect in all other cases
  44. else {
  45. flashVer = -1;
  46. }
  47. return flashVer;
  48. }
  49. // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
  50. function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
  51. {
  52. reqVer = parseFloat(reqMajorVer + "." + reqRevision);
  53. // loop backwards through the versions until we find the newest version
  54. for (i=25;i>0;i--) {
  55. if (isIE && isWin && !isOpera) {
  56. versionStr = VBGetSwfVer(i);
  57. } else {
  58. versionStr = JSGetSwfVer(i);
  59. }
  60. if (versionStr == -1 ) {
  61. return false;
  62. } else if (versionStr != 0) {
  63. if(isIE && isWin && !isOpera) {
  64. tempArray = versionStr.split(" ");
  65. tempString = tempArray[1];
  66. versionArray = tempString .split(",");
  67. } else {
  68. versionArray = versionStr.split(".");
  69. }
  70. versionMajor = versionArray[0];
  71. versionMinor = versionArray[1];
  72. versionRevision = versionArray[2];
  73. versionString = versionMajor + "." + versionRevision; // 7.0r24 == 7.24
  74. versionNum = parseFloat(versionString);
  75. // is the major.revision >= requested major.revision AND the minor version >= requested minor
  76. if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
  77. return true;
  78. } else {
  79. return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );
  80. }
  81. }
  82. }
  83. }