From c25099920c8ffbfb9e1966a815a15165f76f09bd Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 19 Aug 2011 14:33:02 +0200 Subject: [PATCH] use posterRatio --- static/js/pandora/ui/browser.js | 4 ++-- static/js/pandora/ui/info.js | 4 ++-- static/js/pandora/ui/infoView.js | 6 +++--- static/js/pandora/ui/item.js | 2 +- static/js/pandora/ui/list.js | 14 +++++++------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/static/js/pandora/ui/browser.js b/static/js/pandora/ui/browser.js index 77147b5c8..d2972212b 100644 --- a/static/js/pandora/ui/browser.js +++ b/static/js/pandora/ui/browser.js @@ -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', diff --git a/static/js/pandora/ui/info.js b/static/js/pandora/ui/info.js index c6eb30156..7796d012a 100644 --- a/static/js/pandora/ui/info.js +++ b/static/js/pandora/ui/info.js @@ -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( $('').attr({ diff --git a/static/js/pandora/ui/infoView.js b/static/js/pandora/ui/infoView.js index aa09c21bd..91fe025f3 100644 --- a/static/js/pandora/ui/infoView.js +++ b/static/js/pandora/ui/infoView.js @@ -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; -} \ No newline at end of file +} diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js index e73597ef6..c3d6a6e43 100644 --- a/static/js/pandora/ui/item.js +++ b/static/js/pandora/ui/item.js @@ -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); diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index f086111ab..1704959fe 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -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,