Guest User

Untitled

a guest
Jan 20th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.93 KB | None | 0 0
  1. //v1.7
  2. // Flash Player Version Detection
  3. // Detect Client Browser type
  4. // Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved.
  5. var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
  6. var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
  7. var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
  8.  
  9. function ControlVersion()
  10. {
  11. var version;
  12. var axo;
  13. var e;
  14.  
  15. // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
  16.  
  17. try {
  18. // version will be set for 7.X or greater players
  19. axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
  20. version = axo.GetVariable("$version");
  21. } catch (e) {
  22. }
  23.  
  24. if (!version)
  25. {
  26. try {
  27. // version will be set for 6.X players only
  28. axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
  29.  
  30. // installed player is some revision of 6.0
  31. // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
  32. // so we have to be careful.
  33.  
  34. // default to the first public version
  35. version = "WIN 6,0,21,0";
  36.  
  37. // throws if AllowScripAccess does not exist (introduced in 6.0r47)
  38. axo.AllowScriptAccess = "always";
  39.  
  40. // safe to call for 6.0r47 or greater
  41. version = axo.GetVariable("$version");
  42.  
  43. } catch (e) {
  44. }
  45. }
  46.  
  47. if (!version)
  48. {
  49. try {
  50. // version will be set for 4.X or 5.X player
  51. axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
  52. version = axo.GetVariable("$version");
  53. } catch (e) {
  54. }
  55. }
  56.  
  57. if (!version)
  58. {
  59. try {
  60. // version will be set for 3.X player
  61. axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
  62. version = "WIN 3,0,18,0";
  63. } catch (e) {
  64. }
  65. }
  66.  
  67. if (!version)
  68. {
  69. try {
  70. // version will be set for 2.X player
  71. axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
  72. version = "WIN 2,0,0,11";
  73. } catch (e) {
  74. version = -1;
  75. }
  76. }
  77.  
  78. return version;
  79. }
  80.  
  81. // JavaScript helper required to detect Flash Player PlugIn version information
  82. function GetSwfVer(){
  83. // NS/Opera version >= 3 check for Flash plugin in plugin array
  84. var flashVer = -1;
  85.  
  86. if (navigator.plugins != null && navigator.plugins.length > 0) {
  87. if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
  88. var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
  89. var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
  90. var descArray = flashDescription.split(" ");
  91. var tempArrayMajor = descArray[2].split(".");
  92. var versionMajor = tempArrayMajor[0];
  93. var versionMinor = tempArrayMajor[1];
  94. var versionRevision = descArray[3];
  95. if (versionRevision == "") {
  96. versionRevision = descArray[4];
  97. }
  98. if (versionRevision[0] == "d") {
  99. versionRevision = versionRevision.substring(1);
  100. } else if (versionRevision[0] == "r") {
  101. versionRevision = versionRevision.substring(1);
  102. if (versionRevision.indexOf("d") > 0) {
  103. versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
  104. }
  105. }
  106. var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
  107. }
  108. }
  109. // MSN/WebTV 2.6 supports Flash 4
  110. else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
  111. // WebTV 2.5 supports Flash 3
  112. else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
  113. // older WebTV supports Flash 2
  114. else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
  115. else if ( isIE && isWin && !isOpera ) {
  116. flashVer = ControlVersion();
  117. }
  118. return flashVer;
  119. }
  120.  
  121. // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
  122. function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
  123. {
  124. versionStr = GetSwfVer();
  125. if (versionStr == -1 ) {
  126. return false;
  127. } else if (versionStr != 0) {
  128. if(isIE && isWin && !isOpera) {
  129. // Given "WIN 2,0,0,11"
  130. tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
  131. tempString = tempArray[1]; // "2,0,0,11"
  132. versionArray = tempString.split(","); // ['2', '0', '0', '11']
  133. } else {
  134. versionArray = versionStr.split(".");
  135. }
  136. var versionMajor = versionArray[0];
  137. var versionMinor = versionArray[1];
  138. var versionRevision = versionArray[2];
  139.  
  140. // is the major.revision >= requested major.revision AND the minor version >= requested minor
  141. if (versionMajor > parseFloat(reqMajorVer)) {
  142. return true;
  143. } else if (versionMajor == parseFloat(reqMajorVer)) {
  144. if (versionMinor > parseFloat(reqMinorVer))
  145. return true;
  146. else if (versionMinor == parseFloat(reqMinorVer)) {
  147. if (versionRevision >= parseFloat(reqRevision))
  148. return true;
  149. }
  150. }
  151. return false;
  152. }
  153. }
  154.  
  155. function AC_AddExtension(src, ext)
  156. {
  157. if (src.indexOf('?') != -1)
  158. return src.replace(/\?/, ext+'?');
  159. else
  160. return src + ext;
  161. }
  162.  
  163. function AC_Generateobj(objAttrs, params, embedAttrs)
  164. {
  165. var str = '';
  166. if (isIE && isWin && !isOpera)
  167. {
  168. str += '<object ';
  169. for (var i in objAttrs)
  170. {
  171. str += i + '="' + objAttrs[i] + '" ';
  172. }
  173. str += '>';
  174. for (var i in params)
  175. {
  176. str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  177. }
  178. str += '</object>';
  179. }
  180. else
  181. {
  182. str += '<embed ';
  183. for (var i in embedAttrs)
  184. {
  185. str += i + '="' + embedAttrs[i] + '" ';
  186. }
  187. str += '> </embed>';
  188. }
  189.  
  190. document.write(str);
  191. }
  192.  
  193. function AC_FL_RunContent(){
  194. var ret =
  195. AC_GetArgs
  196. ( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
  197. , "application/x-shockwave-flash"
  198. );
  199. AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
  200. }
  201.  
  202. function AC_SW_RunContent(){
  203. var ret =
  204. AC_GetArgs
  205. ( arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
  206. , null
  207. );
  208. AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
  209. }
Add Comment
Please, Sign In to add comment