From 0e18cf060437388becf7e47d097266e185cb5b92 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 25 Aug 2011 16:44:22 +0200 Subject: [PATCH] dont fail if movie is unknown --- static/js/pandora/ui/info.js | 20 +++++++++++--------- static/js/pandora/ui/item.js | 6 ++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/static/js/pandora/ui/info.js b/static/js/pandora/ui/info.js index 0becca1..41c1798 100644 --- a/static/js/pandora/ui/info.js +++ b/static/js/pandora/ui/info.js @@ -32,15 +32,17 @@ pandora.ui.info = function(id) { } else { // Video Preview pandora.api.get({id: id, keys: ['duration', 'videoRatio']}, function(result) { - var height = Math.round(pandora.user.ui.sidebarSize / result.data.videoRatio) + 16; - pandora.$ui.videoPreview && pandora.$ui.videoPreview.removeElement(); - pandora.$ui.videoPreview = pandora.ui.videoPreview({ - id: id, - duration: result.data.duration, - ratio: result.data.videoRatio - }).appendTo(pandora.$ui.info); - pandora.user.infoRatio = pandora.user.ui.sidebarSize / height; - resize(height); + if(result.data) { + var height = Math.round(pandora.user.ui.sidebarSize / result.data.videoRatio) + 16; + pandora.$ui.videoPreview && pandora.$ui.videoPreview.removeElement(); + pandora.$ui.videoPreview = pandora.ui.videoPreview({ + id: id, + duration: result.data.duration, + ratio: result.data.videoRatio + }).appendTo(pandora.$ui.info); + pandora.user.infoRatio = pandora.user.ui.sidebarSize / height; + resize(height); + } }); } } else if (pandora.$ui.leftPanel) { diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js index bccec4f..fa36f97 100644 --- a/static/js/pandora/ui/item.js +++ b/static/js/pandora/ui/item.js @@ -403,8 +403,10 @@ pandora.ui.item = function() { }) ); } - var director = result.data.director?' ('+result.data.director.join(', ')+')':''; - pandora.$ui.total.html(result.data.title + director); + if (result.data) { + var director = result.data.director?' ('+result.data.director.join(', ')+')':''; + pandora.$ui.total.html(result.data.title + director); + } }); return that; };