From bfcb489c5c7afce031816eb581153f2622b2910e Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sat, 6 Aug 2011 04:28:19 +0000 Subject: [PATCH] some changes towards fixed height icon lists --- static/js/pandora/ui/browser.js | 1 + static/js/pandora/ui/infoView.js | 1 + static/js/pandora/ui/list.js | 17 +++++++++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/static/js/pandora/ui/browser.js b/static/js/pandora/ui/browser.js index 180316a..083c0aa 100644 --- a/static/js/pandora/ui/browser.js +++ b/static/js/pandora/ui/browser.js @@ -38,6 +38,7 @@ pandora.ui.browser = function() { } else { var that = Ox.IconList({ centered: true, + defaultRatio: 5/8, id: 'list', item: function(data, sort, size) { var ratio = data.poster.width / data.poster.height; diff --git a/static/js/pandora/ui/infoView.js b/static/js/pandora/ui/infoView.js index fbdff41..296ff24 100644 --- a/static/js/pandora/ui/infoView.js +++ b/static/js/pandora/ui/infoView.js @@ -334,6 +334,7 @@ pandora.ui.infoView = function(data) { return image.selected; })[0]; $list = Ox.IconList({ + defaultRatio: 5/8, item: function(data, sort, size) { var ratio = data.width / data.height; size = size || 128; diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index d7c6b5b..3442888 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -72,6 +72,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument }); } else if (view == 'icons') { that = Ox.IconList({ + defaultRatio: 5/8, id: 'list', item: function(data, sort, size) { var ratio = data.poster.width / data.poster.height; @@ -108,6 +109,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument that = Ox.Element().css({margin: '16px'}).html(view + ' results view still missing.'); } else if (view == 'clip') { that = Ox.IconList({ + fixedRatio: 4/3, item: function(data, sort, size) { size = size || 128; var ratio = data.aspectRatio, @@ -190,16 +192,19 @@ pandora.ui.list = function(view) { // fixme: remove view argument }, { element: pandora.$ui.clips = Ox.IconList({ + fixedRatio: 4/3, item: function(data, sort, size) { + Ox.print('RATIO', data.aspectRatio); size = size || 128; - var ratio = data.aspectRatio, - width = size, - height = size/ratio, - url = '/' + data.item + '/frame/' + size + '/'+data['in'] + '.jpg'; + var fixedRatio = 4/3, + width = data.aspectRatio < fixedRatio ? size : size * data.aspectRatio / fixedRatio, + height = width / data.aspectRatio, + url = '/' + data.item + '/frame/' + width + '/' + data['in'] + '.jpg'; return { height: height, - id: data['id'], - info: Ox.formatDuration(data['in'], 'short') +' - '+ Ox.formatDuration(data['out'], 'short'), + id: data.id, + info: Ox.formatDuration(data['in'], 'short') + ' - ' + + Ox.formatDuration(data['out'], 'short'), title: data.value, url: url, width: width