From 16d0856565d76b72869e661292f5359b9b60a83e Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 22 Feb 2013 09:50:45 +0530 Subject: [PATCH] update message event listener --- static/js/pandora.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/static/js/pandora.js b/static/js/pandora.js index 9bed338e..f12338d4 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -315,15 +315,15 @@ appPanel if (isEmbed) { pandora.$ui.embedPanel = pandora.ui.embedPanel().display(); window.addEventListener('message', function(e) { - var data; + var data = {} try { data = JSON.parse(e.data); - if (Ox.contains(pandora.site.themes, data.theme)) { - Ox.Theme(data.theme); - } else if (pandora.isEmbedURL(data.url)) { - pandora.URL.push(data.url); - } - } catch() {} + } catch(e) {} + if (Ox.contains(pandora.site.themes, data.theme)) { + Ox.Theme(data.theme); + } else if (pandora.isEmbedURL(data.url)) { + pandora.URL.push(data.url); + } }); } else { pandora.$ui.appPanel = pandora.ui.appPanel().display();