From 90758ca156c2310ed59e0e8dae25f43f8ae097e6 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 31 Jan 2013 10:57:35 +0530 Subject: [PATCH] fix #1203 (info doesn't update if item has no video) --- static/js/pandora/info.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/static/js/pandora/info.js b/static/js/pandora/info.js index c8a59d642..52008e4b4 100644 --- a/static/js/pandora/info.js +++ b/static/js/pandora/info.js @@ -32,6 +32,13 @@ pandora.ui.info = function() { updateInfo(); + function emptyInfo() { + pandora.$ui.listInfo && pandora.$ui.listInfo.remove(); + pandora.$ui.posterInfo && pandora.$ui.posterInfo.remove(); + pandora.$ui.videoPreview && pandora.$ui.videoPreview.remove(); + that.empty(); + } + function getId() { return ui.item || ( ui.listSelection.length @@ -58,15 +65,15 @@ pandora.ui.info = function() { previousView = view; view = getView(); if (view == 'list') { - pandora.$ui.listInfo && pandora.$ui.listInfo.remove(); - that.empty().append(pandora.$ui.listInfo = pandora.ui.listInfo()); + emptyInfo(); + that.append(pandora.$ui.listInfo = pandora.ui.listInfo()); previousView == 'video' && resizeInfo(); } else if (view == 'poster') { pandora.api.get({id: id, keys: ['director', 'posterRatio', 'title']}, function(result) { var ratio = result.data.posterRatio, height = pandora.getInfoHeight(true); - pandora.$ui.posterInfo && pandora.$ui.posterInfo.remove(); - that.empty().append( + emptyInfo(); + that.append( pandora.$ui.posterInfo = pandora.ui.posterInfo(Ox.extend(result.data, {id: id})) ); previousView == 'video' && resizeInfo(); @@ -76,9 +83,9 @@ pandora.ui.info = function() { id: id, keys: ['duration', 'rendered', 'videoRatio'] }, function(result) { + emptyInfo(); if (result.data && result.data.rendered) { - pandora.$ui.videoPreview && pandora.$ui.videoPreview.remove(); - that.empty().append( + that.append( pandora.$ui.videoPreview = pandora.ui.videoPreview({ duration: result.data.duration, frameRatio: result.data.videoRatio,