pandora/static/js/pandora/status.js
2011-10-23 04:29:20 +02:00

23 lines
909 B
JavaScript

// vim: et:ts=4:sw=4:sts=4:ft=javascript
pandora.ui.status = function(key, data) {
var itemName = data.items != 1 ? pandora.site.itemName.plural : pandora.site.itemName.singular,
segments = [],
that = Ox.toTitleCase(key) + ': ';
if (!pandora.user.ui.item && pandora.user.ui.listView == 'clip') {
itemName = data.items != 1 ? 'Clips' : 'Clip';
}
segments.push(Ox.formatNumber(data.items) + ' '+ itemName);
if (data.runtime)
segments.push(Ox.formatDuration(data.runtime, 'short'));
if (data.files)
segments.push(data.files + ' file' + (data.files != 1 ? 's' : ''));
if (data.duration)
segments.push(Ox.formatDuration(data.duration));
if (data.size)
segments.push(Ox.formatValue(data.size, 'B'));
if (data.pixels)
segments.push(Ox.formatValue(data.pixels, 'px'));
return that + segments.join(', ');
};