From b2550c81d7696441a2bc0fea5632334474e026e0 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 30 Oct 2011 14:59:54 +0000 Subject: [PATCH] use getMatches option of ListMap --- static/js/pandora/UI.js | 1 + static/js/pandora/item.js | 8 ++++---- static/js/pandora/placesDialog.js | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js index 53e565c7..86ce18ec 100644 --- a/static/js/pandora/UI.js +++ b/static/js/pandora/UI.js @@ -55,6 +55,7 @@ pandora.UI = (function() { // switch from item view to list view args['item'] = ''; } + add['itemFind'] = pandora.site.user.ui.itemFind; if (!pandora.user.ui.lists[list]) { add['lists.' + that.encode(list)] = {}; } diff --git a/static/js/pandora/item.js b/static/js/pandora/item.js index 8eafa440..77cce587 100644 --- a/static/js/pandora/item.js +++ b/static/js/pandora/item.js @@ -174,10 +174,10 @@ pandora.ui.item = function() { width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 }).bindEvent({ find: function(data) { - pandora.UI.set('itemFind', { + pandora.UI.set('itemFind', data.find ? { conditions: [{key: 'subtitles', value: data.find, operator: '='}], operator: '&' - }); + } : pandora.site.user.ui.itemFind); }, muted: function(data) { pandora.UI.set('muted', data.muted); @@ -241,10 +241,10 @@ pandora.ui.item = function() { width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 }).bindEvent({ find: function(data) { - pandora.UI.set('itemFind', { + pandora.UI.set('itemFind', data.find ? { conditions: [{key: 'subtitles', value: data.find, operator: '='}], operator: '&' - }); + } : pandora.site.user.ui.itemFind); }, points: function(data) { pandora.UI.set('videoPoints.' + pandora.user.ui.item, { diff --git a/static/js/pandora/placesDialog.js b/static/js/pandora/placesDialog.js index 2b870b86..958c658c 100644 --- a/static/js/pandora/placesDialog.js +++ b/static/js/pandora/placesDialog.js @@ -22,6 +22,20 @@ pandora.ui.placesDialog = function() { callback(result); }); }, + getMatches: function(names, callback) { + // fixme: the results of this are of course + // not identical to actual place matches + pandora.api.findClips({ + query: { + conditions: names.map(function(name) { + return {key: 'subtitles', value: name, operator: '='}; + }), + operator: names.length == 1 ? '&' : '|' + } + }, function(result) { + callback(result.data.items); + }); + }, removePlace: function(place, callback) { pandora.api.removePlace(place, function(result) { Ox.Request.clearCache(); // fixme: remove