From 926410d663ba46cc0502451170d0eb85ca2c5e40 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Mon, 17 Sep 2012 08:36:21 +0000 Subject: [PATCH] cleanup Resizebar; make tooltips in VideoEditor, VideoPanel and VideoTimelinePanel configurable --- source/Ox.UI/js/Bar/Resizebar.js | 55 +++++++++++---------- source/Ox.UI/js/Video/VideoEditor.js | 4 +- source/Ox.UI/js/Video/VideoPanel.js | 7 +-- source/Ox.UI/js/Video/VideoTimelinePanel.js | 3 +- 4 files changed, 36 insertions(+), 33 deletions(-) diff --git a/source/Ox.UI/js/Bar/Resizebar.js b/source/Ox.UI/js/Bar/Resizebar.js index 7a87a021..61dff43c 100644 --- a/source/Ox.UI/js/Bar/Resizebar.js +++ b/source/Ox.UI/js/Bar/Resizebar.js @@ -2,17 +2,17 @@ /*@ Ox.Resizebar Resizebar options Options object - collapsed inital collapse state - collapsible collapse state can be changed - edge edge - elements elements of the bar - orientation orientation, can be horizontal or vertical - panel panel object - resizeable can bar be resized - resize array with possible sizes - size default size - tooltip tooltip or not - self Shared private variable + collapsed Inital collapse state + collapsible If true, can be collapsed/expanded + edge Edge + elements Elements of the bar + orientation Orientation ('horizontal' or 'vertical') + panel Panel object + resizeable If true, can be resized + resize Array of sizes + size Default size + tooltip If true, display tooltip, if string, append it + self Shared private variable ([options[, self]]) -> 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()}); + }); } } diff --git a/source/Ox.UI/js/Video/VideoEditor.js b/source/Ox.UI/js/Video/VideoEditor.js index 0281e2cd..103cd9ab 100644 --- a/source/Ox.UI/js/Video/VideoEditor.js +++ b/source/Ox.UI/js/Video/VideoEditor.js @@ -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' diff --git a/source/Ox.UI/js/Video/VideoPanel.js b/source/Ox.UI/js/Video/VideoPanel.js index 56c80bfa..823a4e40 100644 --- a/source/Ox.UI/js/Video/VideoPanel.js +++ b/source/Ox.UI/js/Video/VideoPanel.js @@ -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' diff --git a/source/Ox.UI/js/Video/VideoTimelinePanel.js b/source/Ox.UI/js/Video/VideoTimelinePanel.js index f589e09f..c4b50cc9 100644 --- a/source/Ox.UI/js/Video/VideoTimelinePanel.js +++ b/source/Ox.UI/js/Video/VideoTimelinePanel.js @@ -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'