post JSON messages, relay theme change to same-domain iframe

This commit is contained in:
rolux 2013-02-22 09:46:58 +05:30
commit ebdc2b7057
3 changed files with 28 additions and 13 deletions

View file

@ -315,10 +315,15 @@ appPanel
if (isEmbed) {
pandora.$ui.embedPanel = pandora.ui.embedPanel().display();
window.addEventListener('message', function(e) {
var url = e.data;
if (pandora.isEmbedURL(url)) {
pandora.URL.push(url);
}
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() {}
});
} else {
pandora.$ui.appPanel = pandora.ui.appPanel().display();