use posterRatio

This commit is contained in:
j 2011-08-19 14:33:02 +02:00
parent f595dcb991
commit 30a86de951
5 changed files with 15 additions and 15 deletions

View file

@ -43,7 +43,7 @@ pandora.ui.browser = function() {
id: 'list',
item: function(data, sort, size) {
var icons = pandora.user.ui.icons,
ratio = icons == 'posters' ? data.poster.width / data.poster.height : 1;
ratio = icons == 'posters' ? data.posterRatio : 1;
size = size || 64;
return {
height: ratio <= 1 ? size : size / ratio,
@ -61,7 +61,7 @@ pandora.ui.browser = function() {
query: pandora.Query.toObject()
}), callback);
},
keys: ['director', 'id', 'poster', 'title', 'year'],
keys: ['director', 'id', 'posterRatio', 'title', 'year'],
max: 1,
min: 1,
orientation: 'horizontal',

View file

@ -12,8 +12,8 @@ pandora.ui.info = function(id) {
if (id) {
if (!pandora.user.ui.item && pandora.user.ui.lists[pandora.user.ui.list].listView == 'clip') {
// Poster
pandora.api.get({id: id, keys: ['poster']}, function(result) {
var ratio = result.data.poster.width / result.data.poster.height,
pandora.api.get({id: id, keys: ['posterRatio']}, function(result) {
var ratio = result.data.posterRatio,
height = pandora.user.ui.sidebarSize;
that.empty().append(
$('<img>').attr({

View file

@ -10,7 +10,7 @@ pandora.ui.infoView = function(data) {
margin = 16,
iconSize = pandora.user.ui.infoIconSize,
iconRatio = pandora.user.ui.icons == 'posters'
? data.poster.width / data.poster.height : 1,
? data.posterRatio : 1,
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio),
iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio),
iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0,
@ -501,7 +501,7 @@ pandora.ui.infoView = function(data) {
$reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256;
iconRatio = pandora.user.ui.icons == 'posters'
? data.poster.width / data.poster.height : 1;
? data.posterRatio : 1;
toggleIconSize();
pandora.user.level == 'admin' && $list.replaceWith($list = renderList());
};
@ -514,4 +514,4 @@ pandora.ui.infoView = function(data) {
return that;
}
}

View file

@ -119,7 +119,7 @@ pandora.ui.item = function() {
/*
$.get('/static/html/itemInfo.html', {}, function(template) {
//Ox.print(template);
var posterRatio = result.data.poster.width / result.data.poster.height;
var posterRatio = result.data.posterRatio;
result.data.posterWidth = posterRatio > 1 ? 256 : Math.round(256 * posterRatio);
result.data.posterHeight = posterRatio < 1 ? 256 : Math.round(256 / posterRatio);
result.data.posterLeft = Math.floor((256 - result.data.posterWidth) / 2);

View file

@ -86,7 +86,7 @@ pandora.ui.list = function() { // fixme: remove view argument
id: 'list',
item: function(data, sort, size) {
var icons = pandora.user.ui.icons,
ratio = icons == 'posters' ? data.poster.width / data.poster.height : 1;
ratio = icons == 'posters' ? data.posterRatio : 1;
size = size || 128;
return {
height: ratio <= 1 ? size : size / ratio,
@ -105,7 +105,7 @@ pandora.ui.list = function() { // fixme: remove view argument
query: pandora.Query.toObject()
}), callback);
},
keys: ['director', 'id', 'poster', 'title', 'year'],
keys: ['director', 'id', 'posterRatio', 'title', 'year'],
selected: pandora.user.ui.lists[pandora.user.ui.list].selected,
size: 128,
sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
@ -122,7 +122,7 @@ pandora.ui.list = function() { // fixme: remove view argument
id: 'list',
item: function(data, sort, size) {
var icons = pandora.user.ui.icons,
ratio = icons == 'posters' ? data.poster.width / data.poster.height : 1;
ratio = icons == 'posters' ? data.posterRatio : 1;
size = 128;
return {
icon: {
@ -153,7 +153,7 @@ pandora.ui.list = function() { // fixme: remove view argument
query: pandora.Query.toObject()
}), callback);
},
keys: ['director', 'duration', 'id', 'poster', 'title', 'year'],
keys: ['director', 'duration', 'id', 'posterRatio', 'title', 'year'],
selected: pandora.user.ui.lists[pandora.user.ui.list].selected,
size: 192,
sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
@ -441,7 +441,7 @@ pandora.ui.list = function() { // fixme: remove view argument
openpreview: function(data) {
pandora.requests.preview && pandora.api.cancel(pandora.requests.preview);
pandora.requests.preview = pandora.api.find({
keys: ['director', 'id', 'poster', 'title'],
keys: ['director', 'id', 'posterRatio', 'title'],
query: {
conditions: $.map(data.ids, function(id, i) {
return {
@ -454,8 +454,8 @@ pandora.ui.list = function() { // fixme: remove view argument
}
}, function(result) {
var item = result.data.items[0],
title = item.title + ' (' + item.director + ')'
ratio = item.poster.width / item.poster.height,
title = item.title + ' (' + item.director + ')',
ratio = item.posterRatio,
windowWidth = window.innerWidth * 0.8,
windowHeight = window.innerHeight * 0.8,
windowRatio = windowWidth / windowHeight,