Ox.BlockVideoTimeline = function(options, self) {
self = self || {};
var that = new Ox.Element({}, self)
.defaults({
duration: 0,
find: '',
getTimelineURL: null,
'in': 0,
out: 0,
position: 0,
results: [],
subtitles: [],
width: 0
})
.options(options || {})
.css({
position: 'absolute',
//background: 'rgba(192, 192, 192, 0.1)'
})
.bind({
mousedown: mousedown,
mouseleave: mouseleave,
mousemove: mousemove
})
.bindEvent({
drag: function(event, e) {
mousedown(e);
}
});
self.$images = [];
self.$interfaces = [];
self.$lines = [];
self.$tooltip = new Ox.Tooltip({
animate: false
}).css({
textAlign: 'center'
});
self.height = 16;
self.lines = getLines();
self.margin = 8;
setCSS();
self.$image = Ox.SmallVideoTimelineImage({
duration: self.options.duration,
editing: self.options.editing,
getTimelineURL: self.options.getTimelineURL,
'in': self.options['in'],
out: self.options.out,
results: self.options.results,
subtitles: self.options.subtitles,
width: Math.ceil(self.options.duration),
type: self.options.type
})
.bindEvent('load', function() {
// wait until the timeline image (the one image that is async)
// has loaded, so we can clone the element
Ox.loop(self.lines, function(i) {
addLine(i);
});
})
self.$positionMarker = $('')
.attr({
src: Ox.UI.PATH + 'png/videoMarkerPlay.png'
})
.css({
position: 'absolute',
width: '9px',
height: '5px',
zIndex: 10
})
.appendTo(that.$element);
setPositionMarker();
self.$pointMarker = {};
['in', 'out'].forEach(function(point) {
var titleCase = Ox.toTitleCase(point);
self.$pointMarker[point] = $('
')
.addClass('OxPointMarker' + titleCase)
.attr({
src: Ox.UI.PATH + 'png/videoMarker' + titleCase + '.png'
})
.css({
position: 'absolute',
width: '6px',
height: '6px',
marginLeft: (point == 'in' ? -1 : 4) + 'px',
zIndex: 10
})
.appendTo(that.$element);
setPointMarker(point);
});
function addLine(i) {
self.$lines[i] = $('