forked from 0x2620/pandora
merge loading icon and reload button
This commit is contained in:
parent
03a27fab5d
commit
ec644ea8fc
3 changed files with 55 additions and 28 deletions
|
|
@ -2,14 +2,64 @@
|
|||
|
||||
pandora.ui.loadingIcon = function() {
|
||||
|
||||
var that = Ox.LoadingIcon({size: 'medium'});
|
||||
var self = {},
|
||||
that = Ox.LoadingIcon({
|
||||
tooltip: 'Reload Application'
|
||||
}, self)
|
||||
.attr({
|
||||
src: Ox.UI.getImageURL('symbolRedo')
|
||||
})
|
||||
.css(getCSS('stop'))
|
||||
.bindEvent({
|
||||
anyclick: function() {
|
||||
pandora.$ui.appPanel.reload();
|
||||
}
|
||||
});
|
||||
|
||||
that.superStart = that.start;
|
||||
that.superStop = that.stop;
|
||||
|
||||
that.start = function() {
|
||||
if (!self.loadingInterval) {
|
||||
that.css(getCSS('start'))
|
||||
.attr({
|
||||
src: Ox.UI.getImageURL('symbolLoading')
|
||||
});
|
||||
that.superStart();
|
||||
}
|
||||
};
|
||||
|
||||
that.stop = function() {
|
||||
if (self.loadingInterval) {
|
||||
that.superStop(function() {
|
||||
if (!self.loadingInterval) {
|
||||
that.css(getCSS('stop'))
|
||||
.attr({
|
||||
src: Ox.UI.getImageURL('symbolRedo')
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
that.update = function(requests) {
|
||||
that[requests ? 'start' : 'stop']().options({
|
||||
tooltip: (requests || 'No') + ' request' + (requests == 1 ? '' : 's')
|
||||
});
|
||||
that[requests ? 'start' : 'stop']();
|
||||
};
|
||||
|
||||
function getCSS(action) {
|
||||
return action == 'start' ? {
|
||||
width: '16px',
|
||||
height: '16px',
|
||||
margin: 0,
|
||||
opacity: 0
|
||||
} : {
|
||||
width: '10px',
|
||||
height: '10px',
|
||||
margin: '3px',
|
||||
opacity: 1
|
||||
};
|
||||
}
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue