123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- if(!dojo._hasResource["dojox.widget.AutoRotator"]){
- dojo._hasResource["dojox.widget.AutoRotator"] = true;
- dojo.provide("dojox.widget.AutoRotator");
- dojo.require("dojox.widget.Rotator");
- (function(d){
- d.declare("dojox.widget.AutoRotator", dojox.widget.Rotator, {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- suspendOnHover: false,
-
-
-
- duration: 4000,
-
-
- autoStart: true,
-
-
-
- pauseOnManualChange: false,
-
-
- cycles: -1,
-
-
- random: false,
-
-
- reverse: false,
- constructor: function(){
-
-
- var _t = this;
-
- if(_t.cycles-0 == _t.cycles && _t.cycles > 0){
-
- _t.cycles++;
- }else{
- _t.cycles = _t.cycles ? -1 : 0;
- }
-
- _t._connects = [
- d.connect(_t._domNode, "onmouseover", function(){
-
-
- if(_t.suspendOnHover && !_t.anim && !_t.wfe){
- var t = _t._endTime,
- n = _t._now();
- _t._suspended = true;
- _t._resetTimer();
- _t._resumeDuration = t > n ? t - n : 0.01;
- }
- }),
- d.connect(_t._domNode, "onmouseout", function(){
-
-
- if(_t.suspendOnHover && !_t.anim){
- _t._suspended = false;
- if(_t.playing && !_t.wfe){
- _t.play(true);
- }
- }
- })
- ];
-
- if(_t.autoStart && _t.panes.length > 1){
-
- _t.play();
- }else{
-
- _t.pause();
- }
- },
- destroy: function(){
-
-
- d.forEach(this._connects, d.disconnect);
- this.inherited(arguments);
- },
- play: function(/*boolean?*/skipCycleDecrement, /*boolean?*/skipDuration){
-
-
- this.playing = true;
- this._resetTimer();
-
- if(skipCycleDecrement !== true && this.cycles > 0){
- this.cycles--;
- }
- if(this.cycles == 0){
-
- this.pause();
- }else if(!this._suspended){
- this.onUpdate("play");
-
-
- if(skipDuration){
- this._cycle();
- }else{
- var r = (this._resumeDuration || 0)-0,
- u = (r > 0 ? r : (this.panes[this.idx].duration || this.duration))-0;
-
- this._resumeDuration = 0;
- this._endTime = this._now() + u;
- this._timer = setTimeout(d.hitch(this, "_cycle", false), u);
- }
- }
- },
- pause: function(){
-
-
- this.playing = this._suspended = false;
- this.cycles = -1;
- this._resetTimer();
-
- this.onUpdate("pause");
- },
- _now: function(){
-
-
- return (new Date()).getTime();
- },
- _resetTimer: function(){
-
-
- clearTimeout(this._timer);
- },
- _cycle: function(/*boolean|int?*/manual){
-
-
- var _t = this,
- i = _t.idx,
- j;
- if(_t.random){
-
- do{
- j = Math.floor(Math.random() * _t.panes.length + 1);
- }while(j == i);
- }else{
- j = i + (_t.reverse ? -1 : 1)
- }
-
- var def = _t.go(j);
- if(def){
- def.addCallback(function(/*boolean?*/skipDuration){
- _t.onUpdate("cycle");
- if(_t.playing){
- _t.play(false, skipDuration);
- }
- });
- }
- },
- onManualChange: function(/*string*/action){
-
-
- this.cycles = -1;
-
- if(action != "play"){
- this._resetTimer();
- if(this.pauseOnManualChange){
- this.pause();
- }
- }
- if(this.playing){
- this.play();
- }
- }
- });
- })(dojo);
- }
|