cleanup Resizebar; make tooltips in VideoEditor, VideoPanel and VideoTimelinePanel configurable

This commit is contained in:
rlx 2012-09-17 08:36:21 +00:00
parent 6433c31002
commit 926410d663
4 changed files with 36 additions and 33 deletions

View file

@ -2,17 +2,17 @@
/*@ /*@
Ox.Resizebar <f> Resizebar Ox.Resizebar <f> Resizebar
options <o> Options object options <o> Options object
collapsed <b|false> inital collapse state collapsed <b|false> Inital collapse state
collapsible <b|true> collapse state can be changed collapsible <b|true> If true, can be collapsed/expanded
edge <s|left> edge edge <s|left> Edge
elements <a|[]> elements of the bar elements <a|[]> Elements of the bar
orientation <s|horizontal> orientation, can be horizontal or vertical orientation <s|horizontal> Orientation ('horizontal' or 'vertical')
panel <o|null> panel object panel <o|null> Panel object
resizeable <b|true> can bar be resized resizeable <b|true> If true, can be resized
resize <a|[]> array with possible sizes resize <a|[]> Array of sizes
size <n|0> default size size <n|0> Default size
tooltip <b|s|false> tooltip or not tooltip <b|s|false> If true, display tooltip, if string, append it
self <o> Shared private variable self <o> Shared private variable
([options[, self]]) -> <o:Ox.Element> Resizebar object ([options[, self]]) -> <o:Ox.Element> Resizebar object
@*/ @*/
Ox.Resizebar = function(options, self) { Ox.Resizebar = function(options, self) {
@ -28,7 +28,8 @@ Ox.Resizebar = function(options, self) {
parent: null, parent: null,
resizable: true, resizable: true,
resize: [], resize: [],
size: 0 size: 0,
tooltip: false
}) })
.options(options || {}) .options(options || {})
.update({ .update({
@ -70,8 +71,8 @@ Ox.Resizebar = function(options, self) {
function dragstart(data) { function dragstart(data) {
if (self.options.resizable && !self.options.collapsed) { if (self.options.resizable && !self.options.collapsed) {
self.drag = { self.drag = {
startPos: data[self.clientXY], startPos: data[self.clientXY],
startSize: self.options.size startSize: self.options.size
} }
} }
@ -158,25 +159,25 @@ Ox.Resizebar = function(options, self) {
function reset() { function reset() {
if (self.options.resizable && !self.options.collapsed) { if (self.options.resizable && !self.options.collapsed) {
// fixme: silly, pass an option // fixme: silly, pass an option
self.options.parent.reset( self.options.parent.reset(
self.isLeftOrTop ? 0 self.isLeftOrTop ? 0
: self.options.parent.options('elements').length - 1 : self.options.parent.options('elements').length - 1
); );
} }
} }
function toggle() { function toggle() {
if (self.options.collapsible) { if (self.options.collapsible) {
// fixme: silly, pass an option // fixme: silly, pass an option
self.options.parent.toggle( self.options.parent.toggle(
self.isLeftOrTop ? 0 self.isLeftOrTop ? 0
: self.options.parent.options('elements').length - 1 : self.options.parent.options('elements').length - 1
); );
self.options.collapsed = !self.options.collapsed; self.options.collapsed = !self.options.collapsed;
that.css({cursor: getCursor()}); that.css({cursor: getCursor()});
self.$tooltip && self.$tooltip.hide(function() { self.$tooltip && self.$tooltip.hide(function() {
self.$tooltip.options({title: getTitle()}); self.$tooltip.options({title: getTitle()});
}); });
} }
} }

View file

@ -54,6 +54,7 @@ Ox.VideoEditor = function(options, self) {
annotationsRange: 'all', annotationsRange: 'all',
annotationsSize: 256, annotationsSize: 256,
annotationsSort: 'position', annotationsSort: 'position',
annotationsTooltip: 'annotations',
censored: [], censored: [],
censoredIcon: '', censoredIcon: '',
censoredTooltip: '', censoredTooltip: '',
@ -88,7 +89,6 @@ Ox.VideoEditor = function(options, self) {
subtitles: [], subtitles: [],
timeline: '', timeline: '',
timelines: [], timelines: [],
tooltips: false,
videoRatio: 16/9, videoRatio: 16/9,
videoSize: 'small', videoSize: 'small',
video: '', video: '',
@ -829,7 +829,7 @@ Ox.VideoEditor = function(options, self) {
resizable: true, resizable: true,
resize: [192, 256, 320, 384, 448, 512], resize: [192, 256, 320, 384, 448, 512],
size: self.options.annotationsSize, size: self.options.annotationsSize,
tooltip: self.options.tooltips ? 'annotations' : false tooltip: self.options.annotationsTooltip
} }
], ],
orientation: 'horizontal' orientation: 'horizontal'

View file

@ -41,6 +41,7 @@ Ox.VideoPanel = function(options, self) {
annotationsRange: 'all', annotationsRange: 'all',
annotationsSize: 256, annotationsSize: 256,
annotationsSort: 'position', annotationsSort: 'position',
annotationsTooltip: 'annotations',
censored: [], censored: [],
censoredIcon: '', censoredIcon: '',
censoredTooltip: '', censoredTooltip: '',
@ -74,7 +75,7 @@ Ox.VideoPanel = function(options, self) {
smallTimelineURL: '', smallTimelineURL: '',
subtitles: [], subtitles: [],
timeline: '', timeline: '',
tooltips: false, timelineTooltip: 'timeline',
video: '', video: '',
volume: 1, volume: 1,
width: 0 width: 0
@ -251,7 +252,7 @@ Ox.VideoPanel = function(options, self) {
collapsible: true, collapsible: true,
element: self.$controls, element: self.$controls,
size: 80, size: 80,
tooltip: self.options.tooltips ? 'timeline' : false tooltip: self.options.timelineTooltip
} }
], ],
orientation: 'vertical' orientation: 'vertical'
@ -347,7 +348,7 @@ Ox.VideoPanel = function(options, self) {
resizable: true, resizable: true,
resize: [192, 256, 320, 384], resize: [192, 256, 320, 384],
size: self.options.annotationsSize, size: self.options.annotationsSize,
tooltip: self.options.tooltips ? 'annotations' : false tooltip: self.options.annotationsTooltip
} }
], ],
orientation: 'horizontal' orientation: 'horizontal'

View file

@ -37,6 +37,7 @@ Ox.VideoTimelinePanel = function(options, self) {
annotationsRange: 'all', annotationsRange: 'all',
annotationsSize: 256, annotationsSize: 256,
annotationsSort: 'position', annotationsSort: 'position',
annotationsTooltip: 'annotations',
censored: [], censored: [],
censoredIcon: '', censoredIcon: '',
censoredTooltip: '', censoredTooltip: '',
@ -234,7 +235,7 @@ Ox.VideoTimelinePanel = function(options, self) {
resizable: true, resizable: true,
resize: [192, 256, 320, 384], resize: [192, 256, 320, 384],
size: self.options.annotationsSize, size: self.options.annotationsSize,
tooltip: self.options.tooltips ? 'annotations' : false tooltip: self.options.annotationsTooltip
} }
], ],
orientation: 'horizontal' orientation: 'horizontal'