pandora/static/js/pandora/status.js

26 lines
1 KiB
JavaScript
Raw Normal View History

2011-07-29 18:37:11 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
2011-11-05 17:04:10 +00:00
'use strict';
2011-05-25 19:42:45 +00:00
pandora.ui.status = function(key, data) {
2011-10-18 21:02:30 +00:00
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.runtime && data.duration)
segments.push(Ox.formatDuration(data.duration, 'short'));
else if (data.duration)
2011-10-18 21:02:30 +00:00
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(', ');
2011-05-25 19:42:45 +00:00
};