openmedialibrary/static/js/connectionButton.js

44 lines
897 B
JavaScript
Raw Normal View History

2014-05-04 17:26:43 +00:00
'use strict';
oml.ui.connectionButton = function() {
var that = Ox.Element({
tooltip: Ox._('Disconnected')
})
.css({
marginRight: '3px'
})
.bindEvent({
// ...
2015-11-30 23:26:35 +00:00
}),
bandwidth;
2014-05-04 17:26:43 +00:00
/*
2015-11-30 23:26:35 +00:00
oml.ui.statusIcon(oml.user)
2014-05-04 17:26:43 +00:00
.css({float: 'left'})
.appendTo(that);
*/
2015-11-30 23:26:35 +00:00
function formatBandwidth(up, down) {
return '↓'+Ox.formatValue(down, 'b')+' / ↑'+Ox.formatValue(up, 'b')+'';
}
bandwidth = Ox.Element()
2014-05-04 17:26:43 +00:00
.addClass('OxLight')
.css({
float: 'left',
marginTop: '2px',
fontSize: '9px'
})
2015-11-30 23:26:35 +00:00
.html(formatBandwidth(0, 0))
2014-05-04 17:26:43 +00:00
.appendTo(that);
2015-11-30 23:26:35 +00:00
oml.bindEvent({
bandwidth: function(data) {
bandwidth.html(formatBandwidth(data.up, data.down));
}
});
2014-05-04 17:26:43 +00:00
return that;
2015-11-30 23:26:35 +00:00
};