make video editor handle internal links (fixes #494)

This commit is contained in:
rlx 2012-02-17 16:13:08 +00:00
parent c36a3537c0
commit e8f370ab7c
5 changed files with 38 additions and 36 deletions

View file

@ -258,7 +258,6 @@ Ox.AnnotationPanel = function(options, self) {
} }
function insert(data) { function insert(data) {
Ox.print('insert', data);
var id = data.id; var id = data.id;
Ox.InsertHTMLDialog(Ox.extend({ Ox.InsertHTMLDialog(Ox.extend({
callback: function(data) { callback: function(data) {
@ -271,14 +270,12 @@ Ox.AnnotationPanel = function(options, self) {
} }
function renderEditMenu() { function renderEditMenu() {
Ox.print('RENDER EDIT MENU')
var annotation, annotationTitle, folder, var annotation, annotationTitle, folder,
isDefined, isEditable, isEvent, isEventOrPlace, isPlace, isString, isDefined, isEditable, isEvent, isEventOrPlace, isPlace, isString,
key, manageTitle, type, value key, manageTitle, type, value
if (self.options.selected) { if (self.options.selected) {
annotation = getAnnotation(self.options.selected); annotation = getAnnotation(self.options.selected);
folder = getFolder(self.options.selected); folder = getFolder(self.options.selected);
Ox.print('>>>>?', annotation, folder, self.options.selected);
key = folder.options('id'); key = folder.options('id');
type = folder.options('type'); type = folder.options('type');
value = annotation.value; value = annotation.value;
@ -400,7 +397,6 @@ Ox.AnnotationPanel = function(options, self) {
} }
if (!self.deselecting) { if (!self.deselecting) {
self.options.selected = data.id; self.options.selected = data.id;
Ox.print('selectAnnotation', index, data.id)
self.options.editable && renderEditMenu(); self.options.editable && renderEditMenu();
that.triggerEvent('select', data); that.triggerEvent('select', data);
} }
@ -417,7 +413,6 @@ Ox.AnnotationPanel = function(options, self) {
Ox.getIndexById(self.options.layers, layer) + direction, Ox.getIndexById(self.options.layers, layer) + direction,
self.options.layers.length self.options.layers.length
); );
Ox.print('index', index)
self.$folder[index].selectItem(direction == 1 ? 0 : -1); self.$folder[index].selectItem(direction == 1 ? 0 : -1);
} }

View file

@ -594,7 +594,7 @@ Ox.VideoEditor = function(options, self) {
}) })
.bindEvent({ .bindEvent({
add: function(data) { add: function(data) {
Ox.print('ADD EVENT REACHED EDITOR', data) //Ox.print('ADD EVENT REACHED EDITOR', data)
addAnnotation(data.layer); addAnnotation(data.layer);
}, },
annotationsfont: function(data) { annotationsfont: function(data) {
@ -610,7 +610,7 @@ Ox.VideoEditor = function(options, self) {
that.triggerEvent('annotationssort', data); that.triggerEvent('annotationssort', data);
}, },
blur: function(data) { blur: function(data) {
Ox.print('VIDEO EDITOR BLUR') //Ox.print('VIDEO EDITOR BLUR')
// Only blur if the video editor did not receive the click, // Only blur if the video editor did not receive the click,
// no dialog is open, and no menu was visible // no dialog is open, and no menu was visible
if ( if (
@ -628,7 +628,7 @@ Ox.VideoEditor = function(options, self) {
that.triggerEvent('define', data); that.triggerEvent('define', data);
}, },
edit: function(data) { edit: function(data) {
Ox.print('EDIT EVENT REACHED EDITOR', data) //Ox.print('EDIT EVENT REACHED EDITOR', data)
updateWords('remove'); updateWords('remove');
self.editing = true; self.editing = true;
setTimelineState(); setTimelineState();
@ -979,7 +979,7 @@ Ox.VideoEditor = function(options, self) {
} }
function removeAnnotation(data) { function removeAnnotation(data) {
Ox.print('REMOVE EVENT REACHED EDITOR', data) //Ox.print('REMOVE EVENT REACHED EDITOR', data)
var layer = Ox.getObjectById(self.options.layers, data.layer), var layer = Ox.getObjectById(self.options.layers, data.layer),
index = Ox.getIndexById(layer.items, data.id); index = Ox.getIndexById(layer.items, data.id);
updateWords('remove'); updateWords('remove');
@ -1258,7 +1258,6 @@ Ox.VideoEditor = function(options, self) {
function updateWords(action) { function updateWords(action) {
// action can be 'add' or 'remove' // action can be 'add' or 'remove'
var words = []; var words = [];
Ox.print('#^#$^#$^#$^#$', self.options.selected, getAnnotationValue(self.options.selected))
Ox.forEach(Ox.count(Ox.words( Ox.forEach(Ox.count(Ox.words(
getAnnotationValue(self.options.selected) getAnnotationValue(self.options.selected)
)), function(count, value) { )), function(count, value) {
@ -1293,10 +1292,16 @@ Ox.VideoEditor = function(options, self) {
} }
self.setOption = function(key, value) { self.setOption = function(key, value) {
if (key == 'width' || key == 'height') { if (key == 'height' || key == 'width') {
setSizes(); setSizes();
} else if (key == 'in' || key == 'out') {
setPoint(key, value);
} else if (key == 'position') { } else if (key == 'position') {
setPosition(value); setPosition(value);
} else if (key == 'selected') {
selectAnnotation(
value ? Ox.getObjectById(self.annotations, value) : {id: ''}
);
} else if (key == 'showAnnotations') { } else if (key == 'showAnnotations') {
that.$element.toggle(1); that.$element.toggle(1);
} }
@ -1317,7 +1322,7 @@ Ox.VideoEditor = function(options, self) {
// called from editannotation callback // called from editannotation callback
self.options.selected = annotation.id; // fixme: needed? self.options.selected = annotation.id; // fixme: needed?
self.$annotationPanel.updateItem(id, annotation); self.$annotationPanel.updateItem(id, annotation);
} };
/*@ /*@
removeAnnotation <f> remove annotation removeAnnotation <f> remove annotation

View file

@ -41,6 +41,7 @@ Ox.VideoPanel = function(options, self) {
poster: '', poster: '',
resolution: 0, resolution: 0,
scaleToFill: false, scaleToFill: false,
selected: '',
showAnnotations: false, showAnnotations: false,
showAnnotationsCalendar: false, showAnnotationsCalendar: false,
showAnnotationsMap: false, showAnnotationsMap: false,
@ -366,16 +367,14 @@ Ox.VideoPanel = function(options, self) {
self.$video.options({ self.$video.options({
height: getPlayerHeight() height: getPlayerHeight()
}); });
} else if (key == 'in' || key == 'out') {
setPoint(key, value);
} else if (key == 'position') { } else if (key == 'position') {
self.$video.options({ self.$video.options({position: value});
position: value self.$timeline.options({position: value});
}); self.$annotationPanel.options({position: value});
self.$timeline.options({ } else if (key == 'selected') {
position: value self.$annotationPanel.options({selected: value});
});
self.$annotationPanel.options({
position: value
});
} else if (key == 'showAnnotations') { } else if (key == 'showAnnotations') {
that.$element.toggle(1); that.$element.toggle(1);
} else if (key == 'showTimeline') { } else if (key == 'showTimeline') {

View file

@ -1085,6 +1085,13 @@ Ox.VideoPlayer = function(options, self) {
self.$copyrightIcon[self.censored ? 'show' : 'hide'](); self.$copyrightIcon[self.censored ? 'show' : 'hide']();
} }
function changeVolumeBy(num) {
showVolume();
self.options.volume = Ox.limit(self.options.volume + num, 0, 1);
setVolume(self.options.volume);
self.$volumeInput && self.$volumeInput.value(self.options.volume);
}
function clearInterfaceTimeout() { function clearInterfaceTimeout() {
clearTimeout(self.interfaceTimeout); clearTimeout(self.interfaceTimeout);
self.interfaceTimeout = 0; self.interfaceTimeout = 0;
@ -1853,6 +1860,14 @@ Ox.VideoPlayer = function(options, self) {
} }
} }
function setCensored() {
var censored = getCensored();
if (censored != self.censored) {
self.censored = censored;
censor();
}
}
function setMarkers() { function setMarkers() {
//Ox.Log('Video', 'SET MARKERS', self.options.position, self.options['in'], self.options.out, self.$pointMarker); //Ox.Log('Video', 'SET MARKERS', self.options.position, self.options['in'], self.options.out, self.$pointMarker);
Ox.forEach(self.$posterMarker, function(marker) { Ox.forEach(self.$posterMarker, function(marker) {
@ -1877,6 +1892,7 @@ Ox.VideoPlayer = function(options, self) {
function setPosition(position, from) { function setPosition(position, from) {
self.options.position = Ox.limit(position, self['in'], self.out); self.options.position = Ox.limit(position, self['in'], self.out);
/* /*
// disabled
self.options.position = Math.round( self.options.position = Math.round(
position * self.options.fps position * self.options.fps
) / self.options.fps; ) / self.options.fps;
@ -1989,14 +2005,6 @@ Ox.VideoPlayer = function(options, self) {
} }
} }
function setCensored() {
var censored = getCensored();
if (censored != self.censored) {
self.censored = censored;
censor();
}
}
function setSubtitle() { function setSubtitle() {
var subtitle = getSubtitle(); var subtitle = getSubtitle();
if (subtitle != self.subtitle) { if (subtitle != self.subtitle) {
@ -2024,13 +2032,6 @@ Ox.VideoPlayer = function(options, self) {
self.$video.css(self.videoCSS); self.$video.css(self.videoCSS);
}; };
function changeVolumeBy(num) {
showVolume();
self.options.volume = Ox.limit(self.options.volume + num, 0, 1);
setVolume(self.options.volume);
self.$volumeInput && self.$volumeInput.value(self.options.volume);
}
function setVolume(volume) { function setVolume(volume) {
self.options.volume = volume; self.options.volume = volume;
if (!!self.options.volume == self.options.muted) { if (!!self.options.volume == self.options.muted) {

View file

@ -74,6 +74,8 @@ Ox.highlightHTML <f> Highlight matches in an HTML string
'<span class="h">AT&amp;T</span>' '<span class="h">AT&amp;T</span>'
> Ox.highlightHTML('AT&amp;T', 'amp', 'h') > Ox.highlightHTML('AT&amp;T', 'amp', 'h')
'AT&amp;T' 'AT&amp;T'
> Ox.highlightHTML('a &lt;b&gt; c', '<b>', 'h')
'<span class="h">a <span class="h">&lt;b&gt;</span> c'
@*/ @*/
Ox.highlightHTML = function(html, str, classname, tags) { Ox.highlightHTML = function(html, str, classname, tags) {
var count = 0, var count = 0,