From e8494c34eb4758ba94216baad03e9bbc28704232 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 2 Jan 2013 13:59:58 +0100 Subject: [PATCH] info view: add duration, aspect ratio, cuts per minute, words per minute (fixes #79: some properties are missing from statistics section of info view) --- static/js/pandora/infoView.0xdb.js | 39 ++++++++++++++++++++++++++++- static/js/pandora/infoView.js | 34 ++++++++++++++++++++++++- static/js/pandora/infoView.padma.js | 34 ++++++++++++++++++++++++- 3 files changed, 104 insertions(+), 3 deletions(-) diff --git a/static/js/pandora/infoView.0xdb.js b/static/js/pandora/infoView.0xdb.js index 161e9543..42ae32eb 100644 --- a/static/js/pandora/infoView.0xdb.js +++ b/static/js/pandora/infoView.0xdb.js @@ -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; + $('
') + .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; + $('
') + .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 = $('
'); @@ -582,7 +618,8 @@ pandora.ui.infoView = function(data) { function formatKey(key, isStatistics) { return isStatistics - ? $('
').css({marginBottom: '4px', fontWeight: 'bold'}).html(Ox.toTitleCase(key)) + ? $('
').css({marginBottom: '4px', fontWeight: 'bold'}) + .html(Ox.toTitleCase(key).replace(' Per ', ' per ')) : '' + Ox.toTitleCase(key) + ': '; } diff --git a/static/js/pandora/infoView.js b/static/js/pandora/infoView.js index 9211be41..ba157661 100644 --- a/static/js/pandora/infoView.js +++ b/static/js/pandora/infoView.js @@ -279,6 +279,25 @@ pandora.ui.infoView = function(data) { $('
').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; + $('
') + .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 --------------------------------------------------------- + + $('
') + .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 - ? $('
').css({marginBottom: '4px', fontWeight: 'bold'}).html(Ox.toTitleCase(key)) + ? $('
').css({marginBottom: '4px', fontWeight: 'bold'}) + .html(Ox.toTitleCase(key).replace(' Per ', ' per ')) : '' + Ox.toTitleCase(key) + ': '; } diff --git a/static/js/pandora/infoView.padma.js b/static/js/pandora/infoView.padma.js index 64b0adeb..bac730a2 100644 --- a/static/js/pandora/infoView.padma.js +++ b/static/js/pandora/infoView.padma.js @@ -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; + $('
') + .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 --------------------------------------------------------- + + $('
') + .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 - ? $('
').css({marginBottom: '4px', fontWeight: 'bold'}).html(Ox.toTitleCase(key)) + ? $('
').css({marginBottom: '4px', fontWeight: 'bold'}) + .html(Ox.toTitleCase(key).replace(' Per ', ' per ')) : '' + Ox.toTitleCase(key) + ': '; }