From 89ba81561794fea1c6de0ee0e8de75b2c8ad835b Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 19 Oct 2011 12:29:16 +0000 Subject: [PATCH] make doubleclick on clip work in clips view --- static/js/pandora/ui/clipList.js | 4 +++- static/js/pandora/ui/itemClips.js | 40 +++++++++++++++---------------- static/js/pandora/ui/list.js | 11 +++++---- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/static/js/pandora/ui/clipList.js b/static/js/pandora/ui/clipList.js index 2e4c254a..c3613393 100644 --- a/static/js/pandora/ui/clipList.js +++ b/static/js/pandora/ui/clipList.js @@ -155,7 +155,7 @@ pandora.ui.clipList = function(videoRatio) { .bindEvent({ // doubleclick opens item singleclick: function() { - $player.$element.is('.OxSelectedVideo')&& $player.togglePaused(); + $player.$element.is('.OxSelectedVideo') && $player.togglePaused(); } }); $img.replaceWith($player.$element); @@ -167,10 +167,12 @@ pandora.ui.clipList = function(videoRatio) { // so we have to make sure that selecting // an item that already has a video // doesn't click through to play + ///* setTimeout(function() { $('.OxSelectedVideo').removeClass('OxSelectedVideo'); $video.addClass('OxSelectedVideo'); }, 300); + //*/ } !ui.item && pandora.UI.set('listSelection', [item]); } else { diff --git a/static/js/pandora/ui/itemClips.js b/static/js/pandora/ui/itemClips.js index bd242684..b5f46018 100644 --- a/static/js/pandora/ui/itemClips.js +++ b/static/js/pandora/ui/itemClips.js @@ -7,6 +7,7 @@ pandora.ui.itemClips = function(options) { margin: '4px' }) .bindEvent({ + doubleclick: doubleclick, singleclick: singleclick }); @@ -43,6 +44,23 @@ pandora.ui.itemClips = function(options) { that.append($item); }); + function doubleclick(data) { + var $item, $target = $(data.target), item, points, set; + if ($target.is('.OxSpecialTarget')) { + $item = $target.parent().parent(); + item = self.options.id; + points = [$item.data('in'), $item.data('out')]; + set = {}; + set['videoPoints.' + item] = { + 'in': points[0], + out: points[1], + position: points[0] + }; + //Ox.print('SETTING VIDEO POINTS', set) + pandora.UI.set(set); + } + } + function singleclick(data) { var $img, $item, $target = $(data.target), $video, points; if ($target.is('.OxSpecialTarget')) { @@ -56,10 +74,10 @@ pandora.ui.itemClips = function(options) { result.data.durations, points ), $player = Ox.VideoPlayer({ + enableMouse: true, height: self.height, 'in': partsAndPoints.points[0], out: partsAndPoints.points[1], - //paused: true, playInToOut: true, poster: '/' + self.options.id + '/' + self.height + 'p' + points[0] + '.jpg', rewind: true, @@ -69,25 +87,7 @@ pandora.ui.itemClips = function(options) { }), width: self.width }) - .addClass('OxTarget OxSpecialTarget') - .bindEvent({ - doubleclick: function() { - var item = self.options.id, - set = { - item: item, - itemView: pandora.user.ui.videoView - }; - set['videoPoints.' + item] = { - 'in': points[0], - out: points[1], - position: points[0] - }; - pandora.UI.set(set); - }, - singleclick: function() { - $player.togglePaused(); - } - }); + .addClass('OxTarget OxSpecialTarget'); $img.replaceWith($player.$element); }); } diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index 0a385e35..753906e3 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -383,11 +383,12 @@ pandora.ui.list = function() { pandora.$ui.selected.html(pandora.ui.status('selected', data)); }, open: function(data) { - pandora.UI.set(Ox.extend({ - item: data.ids[0] - }, view == 'timelines' && data.isSpecialTarget ? { - itemView: pandora.user.ui.videoView - } : {})); + var set = {item: data.ids[0]}; + if (data.isSpecialTarget) { + set.itemView = pandora.user.ui.videoView; + } + //Ox.print('SETTING ITEM', set) + pandora.UI.set(set); }, openpreview: function(data) { pandora.requests.preview && pandora.api.cancel(pandora.requests.preview);