From 4f0e53646665c94cf0dd77d76db798ad8efb7ab2 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 30 Jun 2012 16:17:10 +0000 Subject: [PATCH] once item view has loaded, return if the item has changed in the meantime --- static/js/pandora/item.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/static/js/pandora/item.js b/static/js/pandora/item.js index 5ac97a1e..61ca11e2 100644 --- a/static/js/pandora/item.js +++ b/static/js/pandora/item.js @@ -3,10 +3,11 @@ pandora.ui.item = function() { - var that = Ox.Element(), - isVideoView = [ + var isVideoView = [ 'timeline', 'player', 'editor' - ].indexOf(pandora.user.ui.itemView) > -1; + ].indexOf(pandora.user.ui.itemView) > -1, + item = pandora.user.ui.item, + that = Ox.Element(); pandora.api.get({ id: pandora.user.ui.item, @@ -17,6 +18,10 @@ pandora.ui.item = function() { ] : [] }, pandora.user.ui.itemView == 'info' && pandora.site.capabilities.canEditMetadata[pandora.user.level] ? 0 : -1, function(result) { + if (pandora.user.ui.item != item) { + return; + } + if (result.status.code == 200) { // we want to cache the title in any way, so that after closing // a dialog and getting to this item, the title is correct @@ -24,18 +29,6 @@ pandora.ui.item = function() { document.title = pandora.getPageTitle(document.location.pathname) || documentTitle; } - /*if (result.status.code != 200) { - pandora.$ui.contentPanel.replaceElement(1, - Ox.Element() - .css({marginTop: '32px', fontSize: '12px', textAlign: 'center'}) - .html( - 'Sorry, we can\'t find the ' - + pandora.site.itemName.singular.toLowerCase() - + ' you\'re looking for.' - ) - ); - }*/ - pandora.$ui.itemTitle .options({ title: '' + result.data.title