From 06ac4b9c6eec5d1c7f94c288741511e171f6d055 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 2 Mar 2013 14:54:57 +0530 Subject: [PATCH] info view: get rid of browserImages var; editor: update browser icon on poster frame change --- static/js/pandora/editor.js | 18 +++++++++++++++++- static/js/pandora/infoView.indiancinema.js | 6 +----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/static/js/pandora/editor.js b/static/js/pandora/editor.js index a88aa5e0..5302d60f 100644 --- a/static/js/pandora/editor.js +++ b/static/js/pandora/editor.js @@ -199,7 +199,15 @@ pandora.ui.editor = function(data) { } if (ui.listSort[0].key == 'modified') { Ox.Request.clearCache('find'); - pandora.$ui.browser.reloadList(); + pandora.$ui.browser + .reloadList() + .bindEventOnce({ + load: function() { + updateBrowser(); + } + }); + } else { + updateBrowser(); } }); }, @@ -256,6 +264,14 @@ pandora.ui.editor = function(data) { } }); + function updateBrowser() { + pandora.$ui.browser.find('img[src*="/' + data.id + '/"]').each(function() { + $(this).attr({ + src: '/' + data.id + '/' + ui.icons.slice(0, -1) + '128.jpg?' + Ox.uid() + }); + }); + } + return that; }; diff --git a/static/js/pandora/infoView.indiancinema.js b/static/js/pandora/infoView.indiancinema.js index 55432d32..c22e5686 100644 --- a/static/js/pandora/infoView.indiancinema.js +++ b/static/js/pandora/infoView.indiancinema.js @@ -3,7 +3,6 @@ pandora.ui.infoView = function(data) { var ui = pandora.user.ui, - browserImages = [], canEdit = pandora.site.capabilities.canEditMetadata[pandora.user.level], canRemove = pandora.site.capabilities.canRemoveItems[pandora.user.level], css = { @@ -435,10 +434,7 @@ pandora.ui.infoView = function(data) { if (Ox.contains(['title', 'director', 'year'], key)) { pandora.clearIconCache(data.id); if (ui.icons == 'posters') { - if (browserImages.length == 0) { - browserImages = pandora.$ui.browser.find('img[src*="/' + data.id + '/"]'); - } - browserImages.each(function() { + pandora.$ui.browser.find('img[src*="/' + data.id + '/"]').each(function() { $(this).attr({ src: '/' + data.id + '/poster128.jpg?' + Ox.uid() });