PageRenderTime 42ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/player/swfobject.js

http://bitstopdev-hostedqueuesys.googlecode.com/
JavaScript | 367 lines | 356 code | 4 blank | 7 comment | 41 complexity | 969e0d841f3aed16506c308fe6074f14 MD5 | raw file
Possible License(s): Unlicense
  1. /**
  2. * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
  3. *
  4. * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
  5. * http://www.opensource.org/licenses/mit-license.php
  6. *
  7. */
  8. if(typeof deconcept=="undefined")
  9. {
  10. var deconcept=new Object();
  11. }
  12. if(typeof deconcept.util=="undefined")
  13. {
  14. deconcept.util=new Object();
  15. }
  16. if(typeof deconcept.SWFObjectUtil=="undefined")
  17. {
  18. deconcept.SWFObjectUtil=new Object();
  19. }
  20. deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a)
  21. {
  22. if(!document.getElementById)
  23. {
  24. return;
  25. }
  26. this.DETECT_KEY=_a?_a:"detectflash";
  27. this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
  28. this.params=new Object();
  29. this.variables=new Object();
  30. this.attributes=new Array();
  31. if(_1)
  32. {
  33. this.setAttribute("swf",_1);
  34. }
  35. if(id)
  36. {
  37. this.setAttribute("id",id);
  38. }
  39. if(w)
  40. {
  41. this.setAttribute("width",w);
  42. }
  43. if(h)
  44. {
  45. this.setAttribute("height",h);
  46. }
  47. if(_5)
  48. {
  49. this.setAttribute("version",
  50. new deconcept.PlayerVersion(_5.toString().split(".")));
  51. }
  52. this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
  53. if(!window.opera&&document.all&&this.installedVer.major>7)
  54. {
  55. deconcept.SWFObject.doPrepUnload=true;
  56. }
  57. if(c)
  58. {
  59. this.addParam("bgcolor",c);
  60. }
  61. var q=_7?_7:"high";
  62. this.addParam("quality",q);
  63. this.setAttribute("useExpressInstall",false);
  64. this.setAttribute("doExpressInstall",false);
  65. var _c=(_8)?_8:window.location;
  66. this.setAttribute("xiRedirectUrl",_c);
  67. this.setAttribute("redirectUrl","");
  68. if(_9)
  69. {
  70. this.setAttribute("redirectUrl",_9);
  71. }
  72. };
  73. deconcept.SWFObject.prototype=
  74. {
  75. useExpressInstall:function(_d)
  76. {
  77. this.xiSWFPath=!_d?"expressinstall.swf":_d;
  78. this.setAttribute("useExpressInstall",true);
  79. }
  80. ,setAttribute:function(_e,_f)
  81. {
  82. this.attributes[_e]=_f;
  83. }
  84. ,getAttribute:function(_10)
  85. {
  86. return this.attributes[_10];
  87. }
  88. ,addParam:function(_11,_12)
  89. {
  90. this.params[_11]=_12;
  91. }
  92. ,getParams:function()
  93. {
  94. return this.params;
  95. }
  96. ,addVariable:function(_13,_14)
  97. {
  98. this.variables[_13]=_14;
  99. }
  100. ,getVariable:function(_15)
  101. {
  102. return this.variables[_15];
  103. }
  104. ,getVariables:function()
  105. {
  106. return this.variables;
  107. }
  108. ,getVariablePairs:function()
  109. {
  110. var _16=new Array();
  111. var key;
  112. var _18=this.getVariables();
  113. for(key in _18){
  114. _16[_16.length]=key+"="+_18[key];
  115. }
  116. return _16;
  117. }
  118. ,getSWFHTML:function(){
  119. var _19="";
  120. if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
  121. if(this.getAttribute("doExpressInstall"))
  122. {
  123. this.addVariable("MMplayerType","PlugIn");
  124. this.setAttribute("swf",this.xiSWFPath);
  125. }
  126. _19="<embed type=\"application/x-shockwave-flash\" src=\""
  127. +this.getAttribute("swf")
  128. +"\" width=\""+this.getAttribute("width")
  129. +"\" height=\""
  130. +this.getAttribute("height")
  131. +"\" style=\""
  132. +this.getAttribute("style")
  133. +"\"";
  134. _19+=" id=\""+this.getAttribute("id")
  135. +"\" name=\""
  136. +this.getAttribute("id")
  137. +"\" ";
  138. var _1a=this.getParams();
  139. for(var key in _1a)
  140. {
  141. _19+=[key]
  142. +"=\""
  143. +_1a[key]
  144. +"\" ";
  145. }
  146. var _1c=this.getVariablePairs().join("&");
  147. if(_1c.length>0)
  148. {
  149. _19+="flashvars=\""
  150. +_1c
  151. +"\"";
  152. }
  153. _19+="/>";
  154. }
  155. else{
  156. if(this.getAttribute("doExpressInstall"))
  157. {
  158. this.addVariable("MMplayerType","ActiveX");
  159. this.setAttribute("swf",this.xiSWFPath);
  160. }
  161. _19="<object id=\""
  162. +this.getAttribute("id")
  163. +"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""
  164. +this.getAttribute("width")
  165. +"\" height=\""+this.getAttribute("height")
  166. +"\" style=\""+this.getAttribute("style")
  167. +"\">";
  168. _19+="<param name=\"movie\" value=\""
  169. +this.getAttribute("swf")
  170. +"\" />";
  171. var _1d=this.getParams();
  172. for(var key in _1d)
  173. {
  174. _19+="<param name=\""
  175. +key
  176. +"\" value=\""
  177. +_1d[key]
  178. +"\" />";
  179. }
  180. var _1f=this.getVariablePairs().join("&");
  181. if(_1f.length>0)
  182. {
  183. _19+="<param name=\"flashvars\" value=\""+
  184. _1f+
  185. "\" />";
  186. }
  187. _19+="</object>";
  188. }
  189. return _19;
  190. }
  191. ,write:function(_20)
  192. {
  193. if(this.getAttribute("useExpressInstall"))
  194. {
  195. var _21=new deconcept.PlayerVersion([6,0,65]);
  196. if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version")))
  197. {
  198. this.setAttribute("doExpressInstall",true);
  199. this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
  200. document.title=document.title.slice(0,47)+" - Flash Player Installation";
  201. this.addVariable("MMdoctitle",document.title);
  202. }
  203. }
  204. if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version")))
  205. {
  206. var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();
  207. return true;
  208. }
  209. else{
  210. if(this.getAttribute("redirectUrl")!="")
  211. {
  212. document.location.replace(this.getAttribute("redirectUrl"));
  213. }
  214. }
  215. return false;
  216. }
  217. };deconcept.SWFObjectUtil.getPlayerVersion=function()
  218. {
  219. var _23=new deconcept.PlayerVersion([0,0,0]);
  220. if(navigator.plugins&&navigator.mimeTypes.length)
  221. {
  222. var x=navigator.plugins["Shockwave Flash"];
  223. if(x&&x.description)
  224. {
  225. _23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));
  226. }
  227. }
  228. else
  229. {
  230. if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){
  231. var axo=1
  232. var _26=3;
  233. while(axo)
  234. {
  235. try
  236. {
  237. _26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);
  238. _23=new deconcept.PlayerVersion([_26,0,0]);
  239. }
  240. catch(e)
  241. {
  242. axo=null;
  243. }
  244. }
  245. }
  246. else
  247. {
  248. try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
  249. }
  250. catch(e)
  251. {
  252. try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
  253. _23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";
  254. }
  255. catch(e)
  256. {
  257. if(_23.major==6)
  258. {
  259. return _23;
  260. }
  261. }try{
  262. axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
  263. }catch(e){
  264. }
  265. }if(axo!=null)
  266. {
  267. _23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
  268. }
  269. }
  270. }
  271. return _23;
  272. };
  273. deconcept.PlayerVersion=function(_29){
  274. this.major=_29[0]!=null?parseInt(_29[0]):0;
  275. this.minor=_29[1]!=null?parseInt(_29[1]):0;
  276. this.rev=_29[2]!=null?parseInt(_29[2]):0;
  277. };
  278. deconcept.PlayerVersion.prototype.versionIsValid=function(fv)
  279. {
  280. if(this.major<fv.major)
  281. {
  282. return false;
  283. }
  284. if(this.major>fv.major)
  285. {
  286. return true;
  287. }
  288. if(this.minor<fv.minor)
  289. {
  290. return false;
  291. }
  292. if(this.minor>fv.minor)
  293. {
  294. return true;
  295. }
  296. if(this.rev<fv.rev)
  297. {
  298. return false;
  299. }
  300. return true;
  301. };
  302. deconcept.util={
  303. getRequestParameter:function(_2b)
  304. {
  305. var q=document.location.search||document.location.hash;
  306. if(_2b==null)
  307. {
  308. return q;
  309. }if(q){
  310. var _2d=q.substring(1).split("&");
  311. for(var i=0;i<_2d.length;i++)
  312. {
  313. if(_2d[i].substring(0,
  314. _2d[i].indexOf("="))==_2b){
  315. return _2d[i].substring((_2d[i].indexOf("=")+1));
  316. }
  317. }
  318. }
  319. return "";
  320. }
  321. };
  322. deconcept.SWFObjectUtil.cleanupSWFs=function(){
  323. var _2f=document.getElementsByTagName("OBJECT");
  324. for(var i=_2f.length-1;i>=0;i--)
  325. {
  326. _2f[i].style.display="none";
  327. for(var x in _2f[i])
  328. {
  329. if(typeof _2f[i][x]=="function")
  330. {
  331. _2f[i][x]=function()
  332. {};
  333. }
  334. }
  335. }
  336. };
  337. if(deconcept.SWFObject.doPrepUnload)
  338. {
  339. if(!deconcept.unloadSet)
  340. {
  341. deconcept.SWFObjectUtil.prepUnload=function()
  342. {
  343. __flash_unloadHandler=function()
  344. {
  345. };
  346. __flash_savedUnloadHandler=function()
  347. {
  348. };
  349. window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);
  350. };
  351. window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);
  352. deconcept.unloadSet=true
  353. }
  354. }if(!document.getElementById&&document.all)
  355. {
  356. document.getElementById=function(id)
  357. {
  358. return document.all[id];
  359. };
  360. }
  361. var getQueryParamValue=deconcept.util.getRequestParameter;
  362. var FlashObject=deconcept.SWFObject;
  363. var SWFObject=deconcept.SWFObject;