This repository has been archived by the owner on Dec 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Richard Edwards
committed
Jan 19, 2016
1 parent
db6041c
commit 40cb2c0
Showing
7 changed files
with
117 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,66 @@ | ||
; (function ($) { | ||
$.extend($.ui.tabs.prototype, { | ||
rotation: null, | ||
rotationDelay: null, | ||
continuing: null, | ||
rotate: function (ms, continuing) { | ||
var self = this, | ||
o = this.options; | ||
|
||
if ((ms > 1 || self.rotationDelay === null) && ms !== undefined) {//only set rotationDelay if this is the first time through or if not immediately moving on from an unpause | ||
self.rotationDelay = ms; | ||
} | ||
|
||
if (continuing !== undefined) { | ||
self.continuing = continuing; | ||
} | ||
|
||
var rotate = self._rotate || (self._rotate = function (e) { | ||
clearTimeout(self.rotation); | ||
self.rotation = setTimeout(function () { | ||
var t = o.active; | ||
self.option("active", ++t < self.anchors.length ? t : 0); | ||
}, ms); | ||
|
||
if (e) { | ||
e.stopPropagation(); | ||
} | ||
}); | ||
|
||
var stop = self._unrotate || (self._unrotate = !continuing | ||
? function (e) { | ||
if (e.clientX) { // in case of a true click | ||
self.rotate(null); | ||
} | ||
} | ||
: function (e) { | ||
t = o.active; | ||
rotate(); | ||
}); | ||
|
||
// start rotation | ||
if (ms) { | ||
this.element.bind("tabsactivate", rotate); | ||
this.anchors.bind(o.event + ".tabs", self.pause); | ||
rotate(); | ||
// stop rotation | ||
} else { | ||
clearTimeout(self.rotation); | ||
this.element.unbind("tabsactivate", rotate); | ||
this.anchors.unbind(o.event + ".tabs", self.pause); | ||
delete this._rotate; | ||
delete this._unrotate; | ||
} | ||
|
||
//rotate immediately and then have normal rotation delay | ||
if (ms === 1) { | ||
//set ms back to what it was originally set to | ||
ms = self.rotationDelay; | ||
} | ||
|
||
return this; | ||
}, | ||
pause: function () { | ||
var self = this, | ||
o = this.options; | ||
|
||
self.rotate(0); | ||
}, | ||
unpause: function () { | ||
var self = this, | ||
o = this.options; | ||
|
||
self.rotate(1, self.continuing); | ||
} | ||
}); | ||
})(jQuery); | ||
;(function($){ | ||
$.extend( $.ui.tabs.prototype, { | ||
rotation: null, | ||
rotationDelay: null, | ||
continuing: null, | ||
rotate: function( ms, continuing ) { | ||
var self = this, | ||
o = this.options; | ||
if((ms > 1 || self.rotationDelay === null) && ms !== undefined){//only set rotationDelay if this is the first time through or if not immediately moving on from an unpause | ||
self.rotationDelay = ms; | ||
} | ||
if(continuing !== undefined){ | ||
self.continuing = continuing; | ||
} | ||
var rotate = self._rotate || ( self._rotate = function( e ) { | ||
clearTimeout( self.rotation ); | ||
self.rotation = setTimeout(function() { | ||
var t = o.active; | ||
self.option( "active", ++t < self.anchors.length ? t : 0 ); | ||
}, ms ); | ||
if ( e ) { | ||
e.stopPropagation(); | ||
} | ||
}); | ||
var stop = self._unrotate || ( self._unrotate = !continuing | ||
? function(e) { | ||
if (e.clientX) { // in case of a true click | ||
self.rotate(null); | ||
} | ||
} | ||
: function( e ) { | ||
t = o.active; | ||
rotate(); | ||
}); | ||
// start rotation | ||
if ( ms ) { | ||
this.element.bind( "tabsactivate", rotate ); | ||
this.anchors.bind( o.event + ".tabs", $.proxy(self.unpause, self) ); | ||
rotate(); | ||
// stop rotation | ||
} else { | ||
clearTimeout( self.rotation ); | ||
this.element.unbind( "tabsactivate", rotate ); | ||
this.anchors.unbind( o.event + ".tabs", $.proxy(self.pause, self) ); | ||
delete this._rotate; | ||
delete this._unrotate; | ||
} | ||
//rotate immediately and then have normal rotation delay | ||
if(ms === 1){ | ||
//set ms back to what it was originally set to | ||
ms = self.rotationDelay; | ||
} | ||
return this; | ||
}, | ||
pause: function() { | ||
var self = this, | ||
o = this.options; | ||
self.rotate(0); | ||
}, | ||
unpause: function(){ | ||
var self = this, | ||
o = this.options; | ||
self.rotate(1, self.continuing); | ||
} | ||
}); | ||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters