openmedialibrary/static/js/connectionButton.js

41 lines
903 B
JavaScript
Raw Normal View History

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({
marginRight: '3px'
})
.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')
+ ' / ↑ ' + 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
};