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