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'
})
.update(function(key, value) {
console.log('got update', key, value)
if (Ox.contains(['area', 'zoom', 'page'], key)) {
$content.options(key, value)
}
})
.bindEvent({
pandora_showbrowser: function(data) {
that.update();

View file

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

View file

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

View file

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

View file

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