if showSitePosters is active, show site poster in preview (fixes #1087)

This commit is contained in:
rolux 2013-07-07 17:02:08 +02:00
parent 0995eab3de
commit b145946372

View file

@ -445,7 +445,7 @@ pandora.ui.list = function() {
}, },
openpreview: function(data) { openpreview: function(data) {
if (data.ids.length) { if (data.ids.length) {
// ...
} }
pandora.requests.preview && pandora.api.cancel(pandora.requests.preview); pandora.requests.preview && pandora.api.cancel(pandora.requests.preview);
pandora.requests.preview = pandora.api.find({ pandora.requests.preview = pandora.api.find({
@ -467,19 +467,23 @@ pandora.ui.list = function() {
) + ( ) + (
item.year ? ' ' + item.year : '' item.year ? ' ' + item.year : ''
), ),
ratio = item.posterRatio, ratio = ui.showSitePosters ? 5/8 : item.posterRatio,
windowWidth = window.innerWidth * 0.8, windowWidth = window.innerWidth * 0.8,
windowHeight = window.innerHeight * 0.8, windowHeight = window.innerHeight * 0.8,
windowRatio = windowWidth / windowHeight, windowRatio = windowWidth / windowHeight,
width = Math.round(ratio > windowRatio ? windowWidth : windowHeight * ratio), width = Math.round(ratio > windowRatio ? windowWidth : windowHeight * ratio),
height = Math.round(ratio < windowRatio ? windowHeight : windowWidth / ratio); height = Math.round(ratio < windowRatio ? windowHeight : windowWidth / ratio);
pandora.$ui.previewImage = $('<img>') pandora.$ui.previewImage = $('<img>')
.attr({src: '/' + item.id + '/poster128.jpg'}) .attr({src: '/' + item.id + '/' + (
ui.showSitePosters ? 'siteposter' : 'poster'
) + '128.jpg'})
.css({width: width + 'px', height: height + 'px'}) .css({width: width + 'px', height: height + 'px'})
$('<img>').load(function() { $('<img>').load(function() {
pandora.$ui.previewImage.attr({src: $(this).attr('src')}); pandora.$ui.previewImage.attr({src: $(this).attr('src')});
}) })
.attr({src: '/' + item.id + '/poster1024.jpg'}); .attr({src: '/' + item.id + '/' + (
ui.showSitePosters ? 'siteposter' : 'poster'
) + '1024.jpg'});
if (!preview) { if (!preview) {
if (!pandora.$ui.previewDialog) { if (!pandora.$ui.previewDialog) {
pandora.$ui.previewDialog = Ox.Dialog({ pandora.$ui.previewDialog = Ox.Dialog({