oxjs/source/Ox.UI/js/Core/Ox.LoadingIcon.js

64 lines
1.4 KiB
JavaScript
Raw Normal View History

2011-07-29 20:48:43 +02:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
2011-11-05 17:46:53 +01:00
'use strict';
2011-05-16 10:24:46 +02:00
/*@
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
@*/
2011-04-23 00:03:10 +02:00
Ox.LoadingIcon = function(options, self) {
2012-01-27 19:59:11 +05:30
self = self || {};
var that = Ox.Element('<img>', self)
2012-01-17 23:04:33 +05:30
.defaults({
size: 'medium'
})
.options(options || {})
.attr({
src: Ox.UI.getImageURL('symbolLoading')
})
.addClass(
'OxLoadingIcon Ox' + Ox.toTitleCase(self.options.size)
);
2012-01-27 19:59:11 +05:30
self.setOption = function(key, value) {
};
2011-05-16 10:24:46 +02:00
/*@
start <f> Start loading animation
() -> <f> Loading Icon Element
@*/
2011-04-23 00:03:10 +02:00
that.start = function() {
that.attr({
src: Ox.UI.getImageURL('symbolLoadingAnimated')
})
.animate({
2011-04-23 00:03:10 +02:00
opacity: 1
}, 250);
return that;
};
2012-01-27 19:59:11 +05:30
2011-05-16 10:24:46 +02:00
/*@
stop <f> Stop loading animation
() -> <f> Loading Icon Element
@*/
2011-04-23 00:03:10 +02:00
that.stop = function() {
that.animate({
opacity: 0
}, 250, function() {
that.attr({
2012-01-17 23:04:33 +05:30
src: Ox.UI.getImageURL('symbolLoading')
});
});
2011-04-23 00:03:10 +02:00
return that;
};
2012-01-27 19:59:11 +05:30
2011-04-23 00:03:10 +02:00
return that;
2012-01-27 19:59:11 +05:30
};