info view: add duration, aspect ratio, cuts per minute, words per minute (fixes #79: some properties are missing from statistics section of info view)

This commit is contained in:
rolux 2013-01-02 13:59:58 +01:00
parent 197a42b9b7
commit e8494c34eb
3 changed files with 104 additions and 3 deletions

View file

@ -480,6 +480,25 @@ pandora.ui.infoView = function(data) {
.appendTo($statistics);
});
// Duration, Aspect Ratio --------------------------------------------------
['duration', 'aspectratio'].forEach(function(key) {
var itemKey = Ox.getObjectById(pandora.site.itemKeys, key),
value = data[key] || 0;
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey(itemKey.title, true))
.append(
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(
Ox['format' + Ox.toTitleCase(itemKey.format.type)]
.apply(null, [value].concat(itemKey.format.args))
)
)
.appendTo($statistics);
});
// Hue, Saturation, Lightness, Volume --------------------------------------
['hue', 'saturation', 'lightness', 'volume'].forEach(function(key) {
@ -494,6 +513,23 @@ pandora.ui.infoView = function(data) {
.appendTo($statistics);
});
// Cuts per Minute, Words per Minute ---------------------------------------
['cutsperminute', 'wordsperminute'].forEach(function(key) {
var value = data[key] || 0;
$('<div>')
.css({marginBottom: '4px'})
.append(
formatKey(key.slice(0, -9) + ' per minute', true)
)
.append(
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(Ox.formatNumber(data[key], 3))
)
.appendTo($statistics);
});
// Rights Level ------------------------------------------------------------
var $rightsLevel = $('<div>');
@ -582,7 +618,8 @@ pandora.ui.infoView = function(data) {
function formatKey(key, isStatistics) {
return isStatistics
? $('<div>').css({marginBottom: '4px', fontWeight: 'bold'}).html(Ox.toTitleCase(key))
? $('<div>').css({marginBottom: '4px', fontWeight: 'bold'})
.html(Ox.toTitleCase(key).replace(' Per ', ' per '))
: '<span style="font-weight: bold">' + Ox.toTitleCase(key) + ':</span> ';
}

View file

@ -279,6 +279,25 @@ pandora.ui.infoView = function(data) {
$('<div>').css(css).html(data.summary).appendTo($center);
}
// Duration, Aspect Ratio --------------------------------------------------
['duration', 'aspectratio'].forEach(function(key) {
var itemKey = Ox.getObjectById(pandora.site.itemKeys, key),
value = data[key] || 0;
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey(itemKey.title, true))
.append(
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(
Ox['format' + Ox.toTitleCase(itemKey.format.type)]
.apply(null, [value].concat(itemKey.format.args))
)
)
.appendTo($right);
});
// Hue, Saturation, Lightness, Volume --------------------------------------
['hue', 'saturation', 'lightness', 'volume'].forEach(function(key) {
@ -293,6 +312,18 @@ pandora.ui.infoView = function(data) {
.appendTo($right);
});
// Cuts per Minute ---------------------------------------------------------
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey('cuts per minute', true))
.append(
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(Ox.formatNumber(data['cutsperminute'] || 0, 3))
)
.appendTo($right);
// User and Groups ---------------------------------------------------------
['user', 'groups'].forEach(function(key) {
@ -412,7 +443,8 @@ pandora.ui.infoView = function(data) {
function formatKey(key, isStatistics) {
return isStatistics
? $('<div>').css({marginBottom: '4px', fontWeight: 'bold'}).html(Ox.toTitleCase(key))
? $('<div>').css({marginBottom: '4px', fontWeight: 'bold'})
.html(Ox.toTitleCase(key).replace(' Per ', ' per '))
: '<span style="font-weight: bold">' + Ox.toTitleCase(key) + ':</span> ';
}

View file

@ -456,6 +456,25 @@ pandora.ui.infoView = function(data) {
);
}
// Duration, Aspect Ratio --------------------------------------------------
['duration', 'aspectratio'].forEach(function(key) {
var itemKey = Ox.getObjectById(pandora.site.itemKeys, key),
value = data[key] || 0;
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey(itemKey.title, true))
.append(
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(
Ox['format' + Ox.toTitleCase(itemKey.format.type)]
.apply(null, [value].concat(itemKey.format.args))
)
)
.appendTo($right);
});
// Hue, Saturation, Lightness, Volume --------------------------------------
['hue', 'saturation', 'lightness', 'volume'].forEach(function(key) {
@ -470,6 +489,18 @@ pandora.ui.infoView = function(data) {
.appendTo($right);
});
// Cuts per Minute ---------------------------------------------------------
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey('cuts per minute', true))
.append(
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(Ox.formatNumber(data['cutsperminute'] || 0, 3))
)
.appendTo($right);
// User and Groups ---------------------------------------------------------
['user', 'groups'].forEach(function(key) {
@ -589,7 +620,8 @@ pandora.ui.infoView = function(data) {
function formatKey(key, isStatistics) {
return isStatistics
? $('<div>').css({marginBottom: '4px', fontWeight: 'bold'}).html(Ox.toTitleCase(key))
? $('<div>').css({marginBottom: '4px', fontWeight: 'bold'})
.html(Ox.toTitleCase(key).replace(' Per ', ' per '))
: '<span style="font-weight: bold">' + Ox.toTitleCase(key) + ':</span> ';
}