root / trunk / web / dojo / dojox / embed / Object.js @ 13
History | View | Annotate | Download (1.34 KB)
| 1 | 9 | andrej.cim | /*
 | 
|---|---|---|---|
| 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.Object"]){ | ||
| 9 | dojo._hasResource["dojox.embed.Object"]=true; | ||
| 10 | dojo.provide("dojox.embed.Object");
 | ||
| 11 | dojo.experimental("dojox.embed.Object");
 | ||
| 12 | dojo.require("dijit._Widget");
 | ||
| 13 | dojo.require("dojox.embed.Flash");
 | ||
| 14 | dojo.require("dojox.embed.Quicktime");
 | ||
| 15 | dojo.declare("dojox.embed.Object",dijit._Widget,{width:0,height:0,src:"",movie:null,params:null,reFlash:/\.swf|\.flv/gi,reQtMovie:/\.3gp|\.avi|\.m4v|\.mov|\.mp4|\.mpg|\.mpeg|\.qt/gi,reQtAudio:/\.aiff|\.aif|\.m4a|\.m4b|\.m4p|\.midi|\.mid|\.mp3|\.mpa|\.wav/gi,postCreate:function(){ | ||
| 16 | if(!this.width||!this.height){ | ||
| 17 | var _1=dojo.marginBox(this.domNode); | ||
| 18 | this.width=_1.w,this.height=_1.h; | ||
| 19 | } | ||
| 20 | var em=dojox.embed.Flash;
 | ||
| 21 | if(this.src.match(this.reQtMovie)||this.src.match(this.reQtAudio)){ | ||
| 22 | em=dojox.embed.Quicktime; | ||
| 23 | } | ||
| 24 | if(!this.params){ | ||
| 25 | this.params={};
 | ||
| 26 | if(this.domNode.hasAttributes()){ | ||
| 27 | var _2={dojoType:"",width:"",height:"","class":"",style:"",id:"",src:""}; | ||
| 28 | var _3=this.domNode.attributes; | ||
| 29 | for(var i=0,l=_3.length;i<l;i++){ | ||
| 30 | if(!_2[_3[i].name]){
 | ||
| 31 | this.params[_3[i].name]=_3[i].value;
 | ||
| 32 | } | ||
| 33 | } | ||
| 34 | } | ||
| 35 | } | ||
| 36 | var _4={path:this.src,width:this.width,height:this.height,params:this.params}; | ||
| 37 | this.movie=new (em)(_4,this.domNode); | ||
| 38 | }}); | ||
| 39 | } |