only listen to main videopoints.id event

This commit is contained in:
j 2012-07-01 11:40:54 +00:00
parent a1163b5f2e
commit dcaa9d0817

View file

@ -7,7 +7,8 @@ pandora.ui.item = function() {
'timeline', 'player', 'editor' 'timeline', 'player', 'editor'
].indexOf(pandora.user.ui.itemView) > -1, ].indexOf(pandora.user.ui.itemView) > -1,
item = pandora.user.ui.item, item = pandora.user.ui.item,
that = Ox.Element(); that = Ox.Element(),
videopointsEvent = 'pandora_videopoints.' + item.toLowerCase();
pandora.api.get({ pandora.api.get({
id: pandora.user.ui.item, id: pandora.user.ui.item,
@ -135,23 +136,25 @@ pandora.ui.item = function() {
if (isVideoView && result.data.rendered) { if (isVideoView && result.data.rendered) {
// handle links in annotations // handle links in annotations
pandora.$ui[pandora.user.ui.itemView].bindEvent( pandora.$ui[pandora.user.ui.itemView].bindEvent(
'pandora_videopoints.' + pandora.user.ui.item.toLowerCase(), videopointsEvent,
function(data) { function(data, event, element) {
//Ox.print('DATA.VALUE', JSON.stringify(data.value));
var options = {}; var options = {};
if (data.value.annotation) { if (event == videopointsEvent) {
options.selected = pandora.user.ui.item + '/' + data.value.annotation; //Ox.print('DATA.VALUE', JSON.stringify(data.value));
} else { if (data && data.value && data.value.annotation) {
// if annotation got set to something other than '', options.selected = pandora.user.ui.item + '/' + data.value.annotation;
// points and position will be set in consequence, } else {
// so lets try to keep events from looping // if annotation got set to something other than '',
['annotation', 'in', 'out', 'position'].forEach(function(key) { // points and position will be set in consequence,
if (!Ox.isUndefined(data.value[key])) { // so lets try to keep events from looping
options[key == 'annotation' ? 'selected' : key] = data.value[key]; ['annotation', 'in', 'out', 'position'].forEach(function(key) {
} if (!Ox.isUndefined(data.value[key])) {
}); options[key == 'annotation' ? 'selected' : key] = data.value[key];
}
});
}
pandora.$ui[pandora.user.ui.itemView].options(options);
} }
pandora.$ui[pandora.user.ui.itemView].options(options);
} }
); );
} }