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

View file

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

View file

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

View file

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