allow outer frames to set options

This commit is contained in:
j 2018-03-06 18:27:10 +05:30
parent e389068ae5
commit 2bc8f66dd4
5 changed files with 22 additions and 5 deletions

View file

@ -24,6 +24,12 @@ pandora.ui.document = function() {
], ],
orientation: 'vertical' orientation: 'vertical'
}) })
.update(function(key, value) {
console.log('got update', key, value)
if (Ox.contains(['area', 'zoom', 'page'], key)) {
$content.options(key, value)
}
})
.bindEvent({ .bindEvent({
pandora_showbrowser: function(data) { pandora_showbrowser: function(data) {
that.update(); that.update();

View file

@ -515,7 +515,9 @@ pandora.ui.editPanel = function(isEmbed) {
}, },
}); });
pandora.$ui.embedPanel.replaceWith(that); pandora.$ui.embedPanel.replaceWith(that);
pandora.$ui.embedPanel = that;
updateSmallTimelineURL(); updateSmallTimelineURL();
Ox.$parent.postMessage('loaded');
} }
function orderClips(ids) { function orderClips(ids) {

View file

@ -3,7 +3,6 @@
'use strict'; 'use strict';
pandora.ui.embedDocument = function() { pandora.ui.embedDocument = function() {
var that = Ox.Element(); var that = pandora.ui.document();
pandora.ui.document().appendTo(that)
return that; return that;
}; };

View file

@ -1,8 +1,11 @@
'use strict'; 'use strict';
pandora.ui.embedPlayer = function() { pandora.ui.embedPlayer = function() {
var self = {};
var that = Ox.Element(), var that = Ox.Element({}, self)
.update(function(key, value) {
$player.options(key, value);
}),
ui = pandora.user.ui, ui = pandora.user.ui,
defaults = { defaults = {
annotationsRange: ui.annotationsRange, annotationsRange: ui.annotationsRange,
@ -139,6 +142,9 @@ pandora.ui.embedPlayer = function() {
playing: function(data) { playing: function(data) {
setPosition(data.position, true); setPosition(data.position, true);
}, },
paused: function(data) {
self.options.position = data.paused
},
position: function(data) { position: function(data) {
setPosition(data.position); setPosition(data.position);
}, },
@ -154,7 +160,7 @@ pandora.ui.embedPlayer = function() {
} }
}) })
.bindEvent(function(data, event) { .bindEvent(function(data, event) {
if (Ox.contains(['close', 'paused', 'position'], event)) { if (Ox.contains(['close', 'paused', 'position', 'playing'], event)) {
Ox.$parent.postMessage(event, data); Ox.$parent.postMessage(event, data);
} }
}); });
@ -343,6 +349,7 @@ pandora.ui.embedPlayer = function() {
} }
function setPosition(position, playing) { function setPosition(position, playing) {
self.options.position = position
!playing && $player.options({position: position}); !playing && $player.options({position: position});
options.showTimeline && $timeline.options({position: position}); options.showTimeline && $timeline.options({position: position});
options.showAnnotations && $annotations.options({position: position}); options.showAnnotations && $annotations.options({position: position});

View file

@ -442,6 +442,9 @@ appPanel
if (pandora.isEmbedURL(data.url)) { if (pandora.isEmbedURL(data.url)) {
pandora.URL.push(data.url); pandora.URL.push(data.url);
} }
},
options: function(data) {
pandora.$ui.embedPanel.options(data);
} }
}); });
} else if (isPrint) { } else if (isPrint) {