VideoPlayer: support spaceX control, where X is an integer indicating the width

This commit is contained in:
rolux 2013-02-20 23:49:21 +05:30
parent 1c26874918
commit 235b47c1d1

View file

@ -14,8 +14,10 @@ Ox.VideoPlayer <f> Generic Video Player
controlsBottom <[s]|[]> Bottom controls, from left to right
Can be 'close', fullscreen', 'scale', 'title', 'find', 'open',
'play', 'playInToOut', 'previous', 'next', 'mute', 'volume', 'size',
'timeline', 'space', 'position', 'settings'. The 'space' control is
empty space that separates left-aligned from right-aligned controls.
'timeline', 'position', 'settings', and 'space[int]'. A 'space16'
control, for example, is empty space that is 16px wide, and a
'space' control is empty space that separates left-aligned from
right-aligned controls.
controlsTooltips <o|{}> Tooltip text per control id
controlsTop <[s]|[]> Top controls, from left to right
duration <n|-1> Duration (sec)
@ -882,6 +884,15 @@ Ox.VideoPlayer = function(options, self) {
.html('&nbsp;') // fixme: ??
.appendTo(self['$controls' + titleCase].$element);
} else if (Ox.startsWith(control, 'space')) {
$('<div>')
.css({
width: parseInt(control.substr(5)) + 'px',
height: '16px'
})
.appendTo(self['$controls' + titleCase].$element);
} else if (control == 'timeline') {
/*
@ -1553,8 +1564,10 @@ Ox.VideoPlayer = function(options, self) {
return (self.options.fullscreen ? window.innerWidth : self.options.width) -
self.options.controlsBottom.reduce(function(prev, curr) {
return prev + (
curr == 'timeline' || curr == 'space' ? 0 :
curr == 'position' ? getPositionWidth() : 16
curr == 'timeline' || curr == 'space' ? 0
: Ox.startsWith(curr, 'space') ? parseInt(curr.substr(5))
: curr == 'position' ? getPositionWidth()
: 16
);
}, 0);
}
@ -1563,7 +1576,9 @@ Ox.VideoPlayer = function(options, self) {
return (self.options.fullscreen ? window.innerWidth : self.options.width) -
self.options.controlsTop.reduce(function(prev, curr) {
return prev + (
curr == 'title' || curr == 'space' ? 0 : 16
curr == 'title' || curr == 'space' ? 0
: Ox.startsWith(curr, 'space') ? parseInt(curr.substr(5))
: 16
);
}, 0);
}