root / trunk / web / dojo / dojox / embed / Quicktime.js @ 12
History | View | Annotate | Download (3.57 KB)
1 |
/*
|
---|---|
2 |
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
3 |
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
4 |
see: http://dojotoolkit.org/license for details
|
5 |
*/
|
6 |
|
7 |
|
8 |
if(!dojo._hasResource["dojox.embed.Quicktime"]){ |
9 |
dojo._hasResource["dojox.embed.Quicktime"]=true; |
10 |
dojo.provide("dojox.embed.Quicktime");
|
11 |
(function(d){
|
12 |
var _1,_2={major:0,minor:0,rev:0},_3,_4={width:320,height:240,redirect:null},_5="dojox-embed-quicktime-",_6=0,_7="This content requires the <a href=\"http://www.apple.com/quicktime/download/\" title=\"Download and install QuickTime.\">QuickTime plugin</a>."; |
13 |
function _8(_9){ |
14 |
_9=d.mixin(d.clone(_4),_9||{}); |
15 |
if(!("path" in _9)&&!_9.testing){ |
16 |
console.error("dojox.embed.Quicktime(ctor):: no path reference to a QuickTime movie was provided.");
|
17 |
return null; |
18 |
} |
19 |
if(_9.testing){
|
20 |
_9.path="";
|
21 |
} |
22 |
if(!("id" in _9)){ |
23 |
_9.id=_5+_6++; |
24 |
} |
25 |
return _9;
|
26 |
}; |
27 |
if(d.isIE){
|
28 |
_3=(function(){
|
29 |
try{
|
30 |
var o=new ActiveXObject("QuickTimeCheckObject.QuickTimeCheck.1"); |
31 |
if(o!==undefined){ |
32 |
var v=o.QuickTimeVersion.toString(16); |
33 |
function p(i){ |
34 |
return (v.substring(i,i+1)-0)||0; |
35 |
}; |
36 |
_2={major:p(0),minor:p(1),rev:p(2)}; |
37 |
return o.IsQuickTimeAvailable(0); |
38 |
} |
39 |
} |
40 |
catch(e){
|
41 |
} |
42 |
return false; |
43 |
})(); |
44 |
_1=function(_a){ |
45 |
if(!_3){
|
46 |
return {id:null,markup:_7}; |
47 |
} |
48 |
_a=_8(_a); |
49 |
if(!_a){
|
50 |
return null; |
51 |
} |
52 |
var s="<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" "+"codebase=\"http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0\" "+"id=\""+_a.id+"\" "+"width=\""+_a.width+"\" "+"height=\""+_a.height+"\">"+"<param name=\"src\" value=\""+_a.path+"\"/>"; |
53 |
for(var p in _a.params||{}){ |
54 |
s+="<param name=\""+p+"\" value=\""+_a.params[p]+"\"/>"; |
55 |
} |
56 |
s+="</object>";
|
57 |
return {id:_a.id,markup:s}; |
58 |
}; |
59 |
}else{
|
60 |
_3=(function(){
|
61 |
for(var i=0,p=navigator.plugins,l=p.length;i<l;i++){ |
62 |
if(p[i].name.indexOf("QuickTime")>-1){ |
63 |
return true; |
64 |
} |
65 |
} |
66 |
return false; |
67 |
})(); |
68 |
_1=function(_b){ |
69 |
if(!_3){
|
70 |
return {id:null,markup:_7}; |
71 |
} |
72 |
_b=_8(_b); |
73 |
if(!_b){
|
74 |
return null; |
75 |
} |
76 |
var s="<embed type=\"video/quicktime\" src=\""+_b.path+"\" "+"id=\""+_b.id+"\" "+"name=\""+_b.id+"\" "+"pluginspage=\"www.apple.com/quicktime/download\" "+"enablejavascript=\"true\" "+"width=\""+_b.width+"\" "+"height=\""+_b.height+"\""; |
77 |
for(var p in _b.params||{}){ |
78 |
s+=" "+p+"=\""+_b.params[p]+"\""; |
79 |
} |
80 |
s+="></embed>";
|
81 |
return {id:_b.id,markup:s}; |
82 |
}; |
83 |
} |
84 |
dojox.embed.Quicktime=function(_c,_d){ |
85 |
return dojox.embed.Quicktime.place(_c,_d);
|
86 |
}; |
87 |
d.mixin(dojox.embed.Quicktime,{minSupported:6,available:_3,supported:_3,version:_2,initialized:false,onInitialize:function(){ |
88 |
dojox.embed.Quicktime.initialized=true;
|
89 |
},place:function(_e,_f){ |
90 |
var o=_1(_e);
|
91 |
if(!(_f=d.byId(_f))){
|
92 |
_f=d.create("div",{id:o.id+"-container"},d.body()); |
93 |
} |
94 |
if(o){
|
95 |
_f.innerHTML=o.markup; |
96 |
if(o.id){
|
97 |
return d.isIE?d.byId(o.id):document[o.id];
|
98 |
} |
99 |
} |
100 |
return null; |
101 |
}}); |
102 |
if(!d.isIE){
|
103 |
var id="-qt-version-test",o=_1({testing:true,width:4,height:4}),c=10,top="-1000px",_10="1px"; |
104 |
function _11(){ |
105 |
setTimeout(function(){
|
106 |
var qt=document[o.id],n=d.byId(id);
|
107 |
if(qt){
|
108 |
try{
|
109 |
var v=qt.GetQuickTimeVersion().split("."); |
110 |
dojox.embed.Quicktime.version={major:parseInt(v[0]||0),minor:parseInt(v[1]||0),rev:parseInt(v[2]||0)}; |
111 |
if(dojox.embed.Quicktime.supported=v[0]){ |
112 |
dojox.embed.Quicktime.onInitialize(); |
113 |
} |
114 |
c=0;
|
115 |
} |
116 |
catch(e){
|
117 |
if(c--){
|
118 |
_11(); |
119 |
} |
120 |
} |
121 |
} |
122 |
if(!c&&n){
|
123 |
d.destroy(n); |
124 |
} |
125 |
},20);
|
126 |
}; |
127 |
if(d._initFired){
|
128 |
d.create("div",{innerHTML:o.markup,id:id,style:{top:top,left:0,width:_10,height:_10,overflow:"hidden",position:"absolute"}},d.body()); |
129 |
}else{
|
130 |
document.write("<div style=\"top:"+top+";left:0;width:"+_10+";height:"+_10+";overflow:hidden;position:absolute\" id=\""+id+"\">"+o.markup+"</div>"); |
131 |
} |
132 |
_11(); |
133 |
}else{
|
134 |
if(d.isIE&&_3){
|
135 |
dojox.embed.Quicktime.onInitialize(); |
136 |
} |
137 |
} |
138 |
})(dojo); |
139 |
} |