136
|
1 |
/** |
|
2 |
* SWFObject v1.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/ |
|
3 |
* |
|
4 |
* SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License: |
|
5 |
* http://www.opensource.org/licenses/mit-license.php |
|
6 |
* |
|
7 |
* **SWFObject is the SWF embed script formarly known as FlashObject. The name was changed for |
|
8 |
* legal reasons. |
|
9 |
*/ |
|
10 |
if(typeof deconcept=="undefined"){var deconcept=new Object();} |
|
11 |
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();} |
|
12 |
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();} |
|
13 |
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){ |
|
14 |
if(!document.createElement||!document.getElementById){return;} |
|
15 |
this.DETECT_KEY=_b?_b:"detectflash"; |
|
16 |
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY); |
|
17 |
this.params=new Object(); |
|
18 |
this.variables=new Object(); |
|
19 |
this.attributes=new Array(); |
|
20 |
if(_1){this.setAttribute("swf",_1);} |
|
21 |
if(id){this.setAttribute("id",id);} |
|
22 |
if(w){this.setAttribute("width",w);} |
|
23 |
if(h){this.setAttribute("height",h);} |
|
24 |
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));} |
|
25 |
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute("version"),_7); |
|
26 |
if(c){this.addParam("bgcolor",c);} |
|
27 |
var q=_8?_8:"high"; |
|
28 |
this.addParam("quality",q); |
|
29 |
this.setAttribute("useExpressInstall",_7); |
|
30 |
this.setAttribute("doExpressInstall",false); |
|
31 |
var _d=(_9)?_9:window.location; |
|
32 |
this.setAttribute("xiRedirectUrl",_d); |
|
33 |
this.setAttribute("redirectUrl",""); |
|
34 |
if(_a){this.setAttribute("redirectUrl",_a);}}; |
|
35 |
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){ |
|
36 |
this.attributes[_e]=_f; |
|
37 |
},getAttribute:function(_10){ |
|
38 |
return this.attributes[_10]; |
|
39 |
},addParam:function(_11,_12){ |
|
40 |
this.params[_11]=_12; |
|
41 |
},getParams:function(){ |
|
42 |
return this.params; |
|
43 |
},addVariable:function(_13,_14){ |
|
44 |
this.variables[_13]=_14; |
|
45 |
},getVariable:function(_15){ |
|
46 |
return this.variables[_15]; |
|
47 |
},getVariables:function(){ |
|
48 |
return this.variables; |
|
49 |
},getVariablePairs:function(){ |
|
50 |
var _16=new Array(); |
|
51 |
var key; |
|
52 |
var _18=this.getVariables(); |
|
53 |
for(key in _18){ |
|
54 |
_16.push(key+"="+_18[key]);} |
|
55 |
return _16; |
|
56 |
},getSWFHTML:function(){ |
|
57 |
var _19=""; |
|
58 |
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){ |
|
59 |
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");} |
|
60 |
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\""; |
|
61 |
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" "; |
|
62 |
var _1a=this.getParams(); |
|
63 |
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";} |
|
64 |
var _1c=this.getVariablePairs().join("&"); |
|
65 |
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";} |
|
66 |
_19+="/>"; |
|
67 |
}else{ |
|
68 |
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");} |
|
69 |
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">"; |
|
70 |
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />"; |
|
71 |
var _1d=this.getParams(); |
|
72 |
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";} |
|
73 |
var _1f=this.getVariablePairs().join("&"); |
|
74 |
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";} |
|
75 |
_19+="</object>";} |
|
76 |
return _19; |
|
77 |
},write:function(_20){ |
|
78 |
if(this.getAttribute("useExpressInstall")){ |
|
79 |
var _21=new deconcept.PlayerVersion([6,0,65]); |
|
80 |
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){ |
|
81 |
this.setAttribute("doExpressInstall",true); |
|
82 |
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl"))); |
|
83 |
document.title=document.title.slice(0,47)+" - Flash Player Installation"; |
|
84 |
this.addVariable("MMdoctitle",document.title);}} |
|
85 |
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){ |
|
86 |
var n=(typeof _20=="string")?document.getElementById(_20):_20; |
|
87 |
n.innerHTML=this.getSWFHTML(); |
|
88 |
return true; |
|
89 |
}else{ |
|
90 |
if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}} |
|
91 |
return false;}}; |
|
92 |
deconcept.SWFObjectUtil.getPlayerVersion=function(_23,_24){ |
|
93 |
var _25=new deconcept.PlayerVersion([0,0,0]); |
|
94 |
if(navigator.plugins&&navigator.mimeTypes.length){ |
|
95 |
var x=navigator.plugins["Shockwave Flash"]; |
|
96 |
if(x&&x.description){_25=new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));} |
|
97 |
}else{try{ |
|
98 |
var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); |
|
99 |
for(var i=3;axo!=null;i++){ |
|
100 |
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i); |
|
101 |
_25=new deconcept.PlayerVersion([i,0,0]);}} |
|
102 |
catch(e){} |
|
103 |
if(_23&&_25.major>_23.major){return _25;} |
|
104 |
if(!_23||((_23.minor!=0||_23.rev!=0)&&_25.major==_23.major)||_25.major!=6||_24){ |
|
105 |
try{_25=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));} |
|
106 |
catch(e){}}} |
|
107 |
return _25;}; |
|
108 |
deconcept.PlayerVersion=function(_29){ |
|
109 |
this.major=parseInt(_29[0])!=null?parseInt(_29[0]):0; |
|
110 |
this.minor=parseInt(_29[1])||0; |
|
111 |
this.rev=parseInt(_29[2])||0;}; |
|
112 |
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){ |
|
113 |
if(this.major<fv.major){return false;} |
|
114 |
if(this.major>fv.major){return true;} |
|
115 |
if(this.minor<fv.minor){return false;} |
|
116 |
if(this.minor>fv.minor){return true;} |
|
117 |
if(this.rev<fv.rev){return false;}return true;}; |
|
118 |
deconcept.util={getRequestParameter:function(_2b){ |
|
119 |
var q=document.location.search||document.location.hash; |
|
120 |
if(q){ |
|
121 |
var _2d=q.indexOf(_2b+"="); |
|
122 |
var _2e=(q.indexOf("&",_2d)>-1)?q.indexOf("&",_2d):q.length; |
|
123 |
if(q.length>1&&_2d>-1){ |
|
124 |
return q.substring(q.indexOf("=",_2d)+1,_2e); |
|
125 |
}}return "";}}; |
|
126 |
if(Array.prototype.push==null){ |
|
127 |
Array.prototype.push=function(_2f){ |
|
128 |
this[this.length]=_2f; |
|
129 |
return this.length;};} |
|
130 |
var getQueryParamValue=deconcept.util.getRequestParameter; |
|
131 |
var FlashObject=deconcept.SWFObject; // for backwards compatibility |
|
132 |
var SWFObject=deconcept.SWFObject; |
|
133 |
|