forked from 0x2620/oxjs
rename Ox.UI source files, remove Ox. prefix
This commit is contained in:
parent
005d50c389
commit
91e1065aab
101 changed files with 0 additions and 0 deletions
70
source/Ox.UI/js/Core/LoadingIcon.js
Normal file
70
source/Ox.UI/js/Core/LoadingIcon.js
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
'use strict';
|
||||
|
||||
/*@
|
||||
Ox.LoadingIcon <f:Ox.Element> Loading Icon Element
|
||||
() -> <f> Loading Icon Element
|
||||
(options) -> <f> Loading Icon Element
|
||||
(options, self) -> <f> Loading Icon Element
|
||||
options <o> Options object
|
||||
size <s|medium> size of icon
|
||||
self <o> Shared private variable
|
||||
@*/
|
||||
|
||||
Ox.LoadingIcon = function(options, self) {
|
||||
|
||||
self = self || {};
|
||||
var that = Ox.Element('<img>', self)
|
||||
.defaults({
|
||||
size: 'medium'
|
||||
})
|
||||
.options(options || {})
|
||||
.attr({
|
||||
src: Ox.UI.getImageURL('symbolLoading')
|
||||
})
|
||||
.addClass(
|
||||
'OxLoadingIcon Ox' + Ox.toTitleCase(self.options.size)
|
||||
);
|
||||
|
||||
/*@
|
||||
start <f> Start loading animation
|
||||
() -> <f> Loading Icon Element
|
||||
@*/
|
||||
that.start = function() {
|
||||
var css, deg = 0, previousTime = +new Date();
|
||||
if (!self.loadingInterval) {
|
||||
self.loadingInterval = setInterval(function() {
|
||||
var currentTime = +new Date(),
|
||||
delta = (currentTime - previousTime) / 1000;
|
||||
previousTime = currentTime;
|
||||
deg = Math.round((deg + delta * 360) % 360 / 30) * 30;
|
||||
css = 'rotate(' + deg + 'deg)';
|
||||
that.css({
|
||||
MozTransform: css,
|
||||
MsTransform: css,
|
||||
OTransform: css,
|
||||
WebkitTransform: css
|
||||
});
|
||||
}, 83);
|
||||
that.animate({opacity: 1}, 250);
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
/*@
|
||||
stop <f> Stop loading animation
|
||||
() -> <f> Loading Icon Element
|
||||
@*/
|
||||
that.stop = function() {
|
||||
var loadingInterval = self.loadingInterval;
|
||||
if (self.loadingInterval) {
|
||||
self.loadingInterval = void 0;
|
||||
that.animate({opacity: 0}, 250, function() {
|
||||
clearInterval(loadingInterval);
|
||||
});
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue