1
0
Fork 0
forked from 0x2620/oxjs

rename various options of video widgets to allow for different timeline types

This commit is contained in:
rlx 2012-04-18 07:43:32 +00:00
commit 132e8d2207
10 changed files with 90 additions and 67 deletions

View file

@ -6,14 +6,15 @@ Ox.SmallVideoTimelineImage = function(options, self) {
var that = Ox.Element({}, self)
.defaults({
duration: 0,
imageURL: '',
'in': 0,
mode: 'player',
out: 0,
results: [],
state: 'default',
subtitles: [],
timeline: '',
type: '',
width: 256,
type: 'player'
})
.options(options || {})
.css({
@ -21,24 +22,24 @@ Ox.SmallVideoTimelineImage = function(options, self) {
width: self.options.width + 'px'
});
self.images = Ox.isString(self.options.timeline) ?
self.images = Ox.isString(self.options.imageURL) ?
1 : Math.ceil(self.options.duration / 3600);
self.imageWidth = Ox.isString(self.options.timeline) ?
self.imageWidth = Ox.isString(self.options.imageURL) ?
1920 : Math.round(self.options.duration);
self.height = self.options.type == 'player' ? 16 : 24;
self.imageHeight = self.options.type == 'player' ? 16 : 18;
self.imageTop = self.options.type == 'player' ? 0 : 3;
self.timelineTop = self.options.type == 'player' ? 0 : 4;
self.height = self.options.mode == 'player' ? 16 : 24;
self.imageHeight = self.options.mode == 'player' ? 16 : 18;
self.imageTop = self.options.mode == 'player' ? 0 : 3;
self.timelineTop = self.options.mode == 'player' ? 0 : 4;
self.theme = Ox.Theme();
that.css({
height: self.height + 'px'
});
if (Ox.isString(self.options.timeline)) {
if (Ox.isString(self.options.imageURL)) {
self.$timeline = $('<img>')
.attr({
src: self.options.timeline
src: self.options.imageURL
})
.css({
position: 'absolute',
@ -51,7 +52,7 @@ Ox.SmallVideoTimelineImage = function(options, self) {
Ox.loop(self.images, function(i) {
$('<img>')
.attr({
src: self.options.timeline(i)
src: self.options.imageURL(self.options.type, i)
})
.css({
position: 'absolute',
@ -124,7 +125,7 @@ Ox.SmallVideoTimelineImage = function(options, self) {
) + 1;
Ox.loop(left, right, function(x) {
Ox.loop(top, bottom, function(y) {
var alpha = self.options.type == 'editor'
var alpha = self.options.mode == 'editor'
&& (y == top || y == bottom - 1) ? 255 : 128,
color = [2, 3, 6].indexOf(x % 4 + y % 4) > -1
? [0, 0, 0] : [255, 255, 0],
@ -151,7 +152,7 @@ Ox.SmallVideoTimelineImage = function(options, self) {
: [[32, 32, 32], [224, 224, 224]];
Ox.loop(left, right, function(x) {
Ox.loop(top, bottom, function(y) {
var alpha = self.options.type == 'editor'
var alpha = self.options.mode == 'editor'
&& (y == top || y == bottom - 1) ? 255 : 128,
color = rgb[[2, 3, 6].indexOf(x % 4 + y % 4) > -1 ? 0 : 1],
index = x * 4 + y * 4 * width;
@ -162,7 +163,7 @@ Ox.SmallVideoTimelineImage = function(options, self) {
});
});
} else if (image == 'subtitles') {
var bottom = self.options.type == 'player' ? 14 : 15;
var bottom = self.options.mode == 'player' ? 14 : 15;
self.options.subtitles.forEach(function(subtitle) {
var left = Math.round(
subtitle['in'] / self.options.duration * self.imageWidth