2014-05-04 17:26:43 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-01-13 07:04:35 +00:00
|
|
|
oml.ui.transferButton = function() {
|
2014-05-04 17:26:43 +00:00
|
|
|
|
|
|
|
var that = Ox.Element({
|
2016-01-07 05:09:10 +00:00
|
|
|
tooltip: Ox._('Transfers')
|
2014-05-04 17:26:43 +00:00
|
|
|
})
|
|
|
|
.css({
|
2016-01-13 04:49:49 +00:00
|
|
|
marginRight: '6px'
|
2015-11-30 23:26:35 +00:00
|
|
|
}),
|
2014-05-04 17:26:43 +00:00
|
|
|
|
2016-01-07 05:09:10 +00:00
|
|
|
bandwidth = Ox.Element()
|
|
|
|
.addClass('OxLight')
|
|
|
|
.css({
|
|
|
|
float: 'left',
|
|
|
|
marginTop: '2px',
|
|
|
|
fontSize: '9px'
|
|
|
|
})
|
|
|
|
.html(formatBandwidth(0, 0))
|
2016-01-16 15:32:40 +00:00
|
|
|
.bindEvent({
|
|
|
|
anyclick: function() {
|
|
|
|
oml.UI.set({page: 'transfers'});
|
|
|
|
}
|
|
|
|
})
|
2016-01-07 05:09:10 +00:00
|
|
|
.appendTo(that);
|
2014-05-04 17:26:43 +00:00
|
|
|
|
2015-11-30 23:26:35 +00:00
|
|
|
function formatBandwidth(up, down) {
|
2016-01-07 05:09:10 +00:00
|
|
|
return '↓ ' + Ox.formatValue(down, 'B')
|
2016-01-13 04:49:49 +00:00
|
|
|
+ ' ↑ ' + Ox.formatValue(up, 'B');
|
2015-11-30 23:26:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
oml.bindEvent({
|
|
|
|
bandwidth: function(data) {
|
|
|
|
bandwidth.html(formatBandwidth(data.up, data.down));
|
|
|
|
}
|
|
|
|
});
|
2016-01-07 05:09:10 +00:00
|
|
|
|
2014-05-04 17:26:43 +00:00
|
|
|
return that;
|
|
|
|
|
2015-11-30 23:26:35 +00:00
|
|
|
};
|