From a7cc9acc635126eab719a36d1f84362b1effd7b3 Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 3 Oct 2011 10:37:24 +0000 Subject: [PATCH] fix clips query in clip view; rewind video icon on deselect --- static/js/pandora/UI.js | 1 + static/js/pandora/URL.js | 4 +++- static/js/pandora/ui/clipList.js | 15 ++++++++------- static/js/pandora/ui/folderBrowserBar.js | 6 +++--- static/js/pandora/ui/usersDialog.js | 9 ++++----- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js index 1727e576..215bfea2 100644 --- a/static/js/pandora/UI.js +++ b/static/js/pandora/UI.js @@ -118,6 +118,7 @@ pandora.UI = (function() { } */ // pandora.URL.update(Object.keys(trigger)); + Ox.print('isBooting?', !pandora.$ui.appPanel, Object.keys(args)); pandora.URL.update(Object.keys( !pandora.$ui.appPanel ? args : trigger )); diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index 07a569d7..57ab2c64 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -332,7 +332,8 @@ pandora.URL = (function() { if (url) { self.URL.push(null, '', url, setState); } else { - alert('DO YOU REALLY WANT TO CALL PUSH WITHOUT URL?') + // fixme + //alert('DO YOU REALLY WANT TO CALL PUSH WITHOUT URL?') //self.URL.push(getState()); } return that; @@ -349,6 +350,7 @@ pandora.URL = (function() { }; that.update = function(keys) { + Ox.print('update.........', keys) // this gets called from pandora.UI var action; if (self.isPopState) { diff --git a/static/js/pandora/ui/clipList.js b/static/js/pandora/ui/clipList.js index 7cb71f48..41c1bb56 100644 --- a/static/js/pandora/ui/clipList.js +++ b/static/js/pandora/ui/clipList.js @@ -5,6 +5,7 @@ pandora.ui.clipList = function(videoRatio) { var ui = pandora.user.ui, fixedRatio = !ui.item ? 16/9 : videoRatio, isClipView = !ui.item ? ui.listView == 'clip' : ui.itemView == 'clips', + $selectedVideo, that = Ox.IconList({ fixedRatio: fixedRatio, @@ -47,14 +48,9 @@ pandora.ui.clipList = function(videoRatio) { query = {conditions: [], operator: '&'}; // if the item query contains a layer condition, // then this condition is added to the clip query - // fixme: don't just check for 'subtitles' itemQuery.conditions.forEach(function(condition) { - if (condition.key == 'subtitles') { - query.conditions.push({ - key: 'value', - value: condition.value, - operator: condition.operator - }); + if (Ox.getPositionById(pandora.site.layers, condition.key) > -1) { + query.conditions.push(condition); } }); } else { @@ -158,6 +154,7 @@ pandora.ui.clipList = function(videoRatio) { $img.replaceWith($player.$element); $('.OxSelectedVideo').removeClass('OxSelectedVideo'); $player.$element.addClass('OxSelectedVideo'); + $selectedVideo = $player; }); } else if ($video.length) { // item select fires before video click @@ -167,11 +164,15 @@ pandora.ui.clipList = function(videoRatio) { setTimeout(function() { $('.OxSelectedVideo').removeClass('OxSelectedVideo'); $video.addClass('OxSelectedVideo'); + $selectedVideo = $video; }, 300); } !ui.item && pandora.UI.set('listSelection', [item]); } else { $('.OxSelectedVideo').removeClass('OxSelectedVideo'); + $selectedVideo && $selectedVideo.options({ + position: $selectedVideo.options('in') + }); !ui.item && pandora.UI.set('listSelection', []); } } diff --git a/static/js/pandora/ui/folderBrowserBar.js b/static/js/pandora/ui/folderBrowserBar.js index 7ff171d9..6cbf08c7 100644 --- a/static/js/pandora/ui/folderBrowserBar.js +++ b/static/js/pandora/ui/folderBrowserBar.js @@ -17,7 +17,7 @@ pandora.ui.folderBrowserBar = function(id) { change: function(data) { var key = data.selected[0].id == 'user' ? 'user' : 'name', value = pandora.$ui.findListInput[id].value(); - value && updateItems(key, value); + value && updateList(key, value); pandora.$ui.findListInput[id].options({ placeholder: data.selected[0].title }); @@ -33,7 +33,7 @@ pandora.ui.folderBrowserBar = function(id) { change: function(data) { var key = pandora.$ui.findListSelect[id].value() == 'user' ? 'user' : 'name', value = data.value; - updateItems(key, value); + updateList(key, value); } }) ], @@ -44,7 +44,7 @@ pandora.ui.folderBrowserBar = function(id) { align: 'right' }) .appendTo(that); - function updateItems(key, value) { + function updateList(key, value) { pandora.$ui.folderList[id].options({ items: function(data, callback) { var query = id == 'favorite' ? {conditions: [ diff --git a/static/js/pandora/ui/usersDialog.js b/static/js/pandora/ui/usersDialog.js index 4131dbef..170f6d51 100644 --- a/static/js/pandora/ui/usersDialog.js +++ b/static/js/pandora/ui/usersDialog.js @@ -68,7 +68,7 @@ pandora.ui.usersDialog = function() { change: function(data) { var key = data.selected[0].id, value = $findInput.value(); - value && updateItems(key, value); + value && updateList(key, value); $findInput.options({ placeholder: data.selected[0].title }); @@ -85,7 +85,7 @@ pandora.ui.usersDialog = function() { change: function(data) { var key = $findSelect.value(), value = data.value; - updateItems(key, value); + updateList(key, value); } }), @@ -396,7 +396,7 @@ pandora.ui.usersDialog = function() { } - function updateItems(key, value) { + function updateList(key, value) { var query = { conditions: Ox.merge( key != 'email' ? [{key: 'username', value: value, operator: '='}] : [], @@ -410,8 +410,7 @@ pandora.ui.usersDialog = function() { query: query }), callback); } - }); - + }); } return that;