2014-05-04 17:26:43 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
oml.ui.connectionButton = function() {
|
|
|
|
|
|
|
|
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'
|
2014-05-04 17:26:43 +00:00
|
|
|
})
|
|
|
|
.bindEvent({
|
2016-01-07 05:09:10 +00:00
|
|
|
click: function() {
|
|
|
|
oml.UI.set({page: 'transfers'});
|
|
|
|
}
|
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))
|
|
|
|
.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
|
|
|
};
|