root / trunk / web / dojo / dojox / widget / rotator / ThumbnailController.js
History | View | Annotate | Download (1.33 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.widget.rotator.ThumbnailController"]){ |
||
| 9 | dojo._hasResource["dojox.widget.rotator.ThumbnailController"]=true; |
||
| 10 | dojo.provide("dojox.widget.rotator.ThumbnailController");
|
||
| 11 | (function(d){
|
||
| 12 | var _1="dojoxRotatorThumb",_2=_1+"Selected"; |
||
| 13 | d.declare("dojox.widget.rotator.ThumbnailController",null,{rotator:null,constructor:function(_3,_4){ |
||
| 14 | d.mixin(this,_3);
|
||
| 15 | this._domNode=_4;
|
||
| 16 | var r=this.rotator; |
||
| 17 | if(r){
|
||
| 18 | while(_4.firstChild){
|
||
| 19 | _4.removeChild(_4.firstChild); |
||
| 20 | } |
||
| 21 | for(var i=0;i<r.panes.length;i++){ |
||
| 22 | var n=r.panes[i].node,s=d.attr(n,"thumbsrc")||d.attr(n,"src"),t=d.attr(n,"alt")||""; |
||
| 23 | if(/img/i.test(n.tagName)){ |
||
| 24 | (function(j){
|
||
| 25 | d.create("a",{classname:_1+" "+_1+j+" "+(j==r.idx?_2:""),href:s,onclick:function(e){ |
||
| 26 | d.stopEvent(e); |
||
| 27 | if(r){
|
||
| 28 | r.control.apply(r,["go",j]);
|
||
| 29 | } |
||
| 30 | },title:t,innerHTML:"<img src=\""+s+"\" alt=\""+t+"\"/>"},_4); |
||
| 31 | })(i); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | this._con=d.connect(r,"onUpdate",this,"_onUpdate"); |
||
| 35 | } |
||
| 36 | },destroy:function(){ |
||
| 37 | d.disconnect(this._con);
|
||
| 38 | d.destroy(this._domNode);
|
||
| 39 | },_onUpdate:function(_5){ |
||
| 40 | var r=this.rotator; |
||
| 41 | if(_5=="onAfterTransition"){ |
||
| 42 | var n=d.query("."+_1,this._domNode).removeClass(_2); |
||
| 43 | if(r.idx<n.length){
|
||
| 44 | d.addClass(n[r.idx],_2); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | }}); |
||
| 48 | })(dojo); |
||
| 49 | } |