forked from 0x2620/pandora
use Ox.Message
This commit is contained in:
parent
1e17102e4b
commit
b7f417c29d
6 changed files with 81 additions and 53 deletions
|
|
@ -314,15 +314,16 @@ appPanel
|
|||
Ox.Theme(pandora.user.ui.theme);
|
||||
if (isEmbed) {
|
||||
pandora.$ui.embedPanel = pandora.ui.embedPanel().display();
|
||||
window.addEventListener('message', function(e) {
|
||||
var data = {};
|
||||
try {
|
||||
data = JSON.parse(e.data);
|
||||
} 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);
|
||||
Ox.$parent.onMessage({
|
||||
settheme: function(data) {
|
||||
if (Ox.contains(pandora.site.themes, data.theme)) {
|
||||
Ox.Theme(data.theme);
|
||||
}
|
||||
},
|
||||
seturl: function(data) {
|
||||
if (pandora.isEmbedURL(data.url)) {
|
||||
pandora.URL.push(data.url);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -126,6 +126,9 @@ pandora.ui.embedPanel = function() {
|
|||
type: data.timeline
|
||||
});
|
||||
}
|
||||
})
|
||||
.bindEvent(function(data, event) {
|
||||
Ox.$parent.postMessage(event, {});
|
||||
});
|
||||
|
||||
$controls = Ox.Element();
|
||||
|
|
|
|||
|
|
@ -230,13 +230,11 @@ pandora.ui.mainMenu = function() {
|
|||
var iframe, src;
|
||||
Ox.Theme(value);
|
||||
pandora.UI.set('theme', value);
|
||||
iframe = $('#embed')[0];
|
||||
iframe = Ox.UI.elements[$('#embed').data('oxid')];
|
||||
if (iframe) {
|
||||
src = $(iframe).attr('src');
|
||||
src = iframe.attr('src');
|
||||
if (src && Ox.parseURL(src).hostname == document.location.hostname) {
|
||||
iframe.contentWindow.postMessage(JSON.stringify({
|
||||
theme: value
|
||||
}), '*');
|
||||
iframe.postMessage('settheme', {theme: value});
|
||||
}
|
||||
}
|
||||
} else if (data.id == 'showsiteposters') {
|
||||
|
|
|
|||
|
|
@ -321,17 +321,25 @@ pandora.ui.textHTML = function(text) {
|
|||
|
||||
pandora.ui.textPDF = function(text) {
|
||||
|
||||
var that = Ox.Element();
|
||||
var that = Ox.Element(),
|
||||
$iframe;
|
||||
if (text.uploaded) {
|
||||
$('<iframe>')
|
||||
$iframe = Ox.Element('<iframe>')
|
||||
.attr({
|
||||
height: '100%',
|
||||
frameborder: 0,
|
||||
height: '100%',
|
||||
src: '/texts/' + pandora.user.ui.text + '/text.pdf.html',
|
||||
width: '100%'
|
||||
})
|
||||
.appendTo(that);
|
||||
|
||||
.onMessage(function(event, data) {
|
||||
if(event == 'edit') {
|
||||
Ox.Dialog({
|
||||
title: 'edit',
|
||||
content: Ox.Element().html('test')
|
||||
}).open()
|
||||
}
|
||||
})
|
||||
.appendTo(that);
|
||||
} else {
|
||||
that.html('UPLOADED: ' + text.uploaded);
|
||||
}
|
||||
|
|
@ -361,7 +369,7 @@ pandora.ui.textEmbed = function() {
|
|||
.hide()
|
||||
.appendTo(that),
|
||||
|
||||
$iframe = $('<iframe>')
|
||||
$iframe = Ox.Element('<iframe>')
|
||||
.attr({
|
||||
height: '100%',
|
||||
id: 'embed',
|
||||
|
|
@ -397,9 +405,9 @@ pandora.ui.textEmbed = function() {
|
|||
&& parsed.url.protocol == parsed.src.protocol
|
||||
&& parsed.url.hostname == parsed.src.hostname
|
||||
) {
|
||||
$iframe[0].contentWindow.postMessage(JSON.stringify({
|
||||
$iframe.postMessage('seturl', {
|
||||
url: parsed.url.pathname + parsed.url.search + parsed.url.hash
|
||||
}), '*');
|
||||
});
|
||||
} else {
|
||||
$iframe.attr({src: url});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue