forked from 0x2620/pandora
add rudimentary support for itemFind
This commit is contained in:
parent
9342bcd391
commit
d4e1bc7e56
5 changed files with 129 additions and 101 deletions
|
@ -488,6 +488,7 @@
|
||||||
{"id": "data", "title": "Data"},
|
{"id": "data", "title": "Data"},
|
||||||
{"id": "files", "title": "Files"}
|
{"id": "files", "title": "Files"}
|
||||||
],
|
],
|
||||||
|
// fixme: should be renamed to annotationLayers
|
||||||
"layers": [
|
"layers": [
|
||||||
{
|
{
|
||||||
"id": "privatenotes",
|
"id": "privatenotes",
|
||||||
|
@ -601,6 +602,7 @@
|
||||||
"icons": "posters",
|
"icons": "posters",
|
||||||
"infoIconSize": 256,
|
"infoIconSize": 256,
|
||||||
"item": "",
|
"item": "",
|
||||||
|
"itemFind": {"conditions": [], "operator": "&"},
|
||||||
"itemSort": [{"key": "position", "operator": "+"}],
|
"itemSort": [{"key": "position", "operator": "+"}],
|
||||||
"itemView": "info",
|
"itemView": "info",
|
||||||
"listColumns": ["title", "director", "country", "year", "language", "runtime", "genre"],
|
"listColumns": ["title", "director", "country", "year", "language", "runtime", "genre"],
|
||||||
|
|
|
@ -65,7 +65,9 @@ pandora.UI = (function() {
|
||||||
Ox.forEach(listSettings, function(listSetting, setting) {
|
Ox.forEach(listSettings, function(listSetting, setting) {
|
||||||
if (!pandora.user.ui.lists[list]) {
|
if (!pandora.user.ui.lists[list]) {
|
||||||
// add default list setting and copy to settings
|
// add default list setting and copy to settings
|
||||||
add['lists.' + that.encode(list) + '.' + listSetting] = pandora.site.user.ui[setting];
|
add[
|
||||||
|
'lists.' + that.encode(list) + '.' + listSetting
|
||||||
|
] = pandora.site.user.ui[setting];
|
||||||
add[setting] = pandora.site.user.ui[setting];
|
add[setting] = pandora.site.user.ui[setting];
|
||||||
} else {
|
} else {
|
||||||
// copy lists setting to settings
|
// copy lists setting to settings
|
||||||
|
@ -73,12 +75,13 @@ pandora.UI = (function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
add.itemFind = pandora.isItemFind(args.find)
|
||||||
|
? args.find : pandora.site.user.ui.itemFind;
|
||||||
}
|
}
|
||||||
// it is important to check for find first, so that if find
|
// it is important to check for find first, so that if find
|
||||||
// changes list, pandora.user.ui._list is correct here
|
// changes list, pandora.user.ui._list is correct here
|
||||||
var item = args['item'] || pandora.user.ui.item,
|
var item = args['item'] || pandora.user.ui.item,
|
||||||
list = pandora.user.ui._list || '';
|
list = pandora.user.ui._list || '';
|
||||||
Ox.print('item/list', item, list, '...', args['videoPoints.' + item])
|
|
||||||
if (!pandora.user.ui.lists[list]) {
|
if (!pandora.user.ui.lists[list]) {
|
||||||
add['lists.' + that.encode(list)] = {};
|
add['lists.' + that.encode(list)] = {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,12 +98,13 @@ pandora.URL = (function() {
|
||||||
if (!pandora.user.ui.item) {
|
if (!pandora.user.ui.item) {
|
||||||
state.view = pandora.user.ui.listView;
|
state.view = pandora.user.ui.listView;
|
||||||
state.sort = pandora.user.ui.listSort;
|
state.sort = pandora.user.ui.listSort;
|
||||||
|
state.find = pandora.user.ui.find;
|
||||||
} else {
|
} else {
|
||||||
state.item = pandora.user.ui.item;
|
state.item = pandora.user.ui.item;
|
||||||
state.view = pandora.user.ui.itemView;
|
state.view = pandora.user.ui.itemView;
|
||||||
state.sort = pandora.user.ui.itemSort;
|
state.sort = pandora.user.ui.itemSort;
|
||||||
|
state.find = pandora.user.ui.itemFind;
|
||||||
}
|
}
|
||||||
state.find = pandora.user.ui.find
|
|
||||||
}
|
}
|
||||||
Ox.print('STATE .................... ->', state)
|
Ox.print('STATE .................... ->', state)
|
||||||
return state;
|
return state;
|
||||||
|
@ -139,9 +140,10 @@ pandora.URL = (function() {
|
||||||
if (state.page == 'home') {
|
if (state.page == 'home') {
|
||||||
//pandora.$ui.home = pandora.ui.home().showScreen();
|
//pandora.$ui.home = pandora.ui.home().showScreen();
|
||||||
pandora.$ui.home = pandora.ui.home().fadeInScreen();
|
pandora.$ui.home = pandora.ui.home().fadeInScreen();
|
||||||
} else if ([
|
} else if (
|
||||||
'about', 'contact', 'faq', 'news', 'rights', 'software', 'terms', 'tour'
|
Ox.getPositionById(pandora.site.sitePages, state.page) > -1
|
||||||
].indexOf(state.page) > -1) {
|
|| state.page == 'software'
|
||||||
|
) {
|
||||||
pandora.$ui.siteDialog = pandora.ui.siteDialog(state.page).open();
|
pandora.$ui.siteDialog = pandora.ui.siteDialog(state.page).open();
|
||||||
} else if (state.page == 'help') {
|
} else if (state.page == 'help') {
|
||||||
pandora.$ui.helpDialog = pandora.ui.helpDialog().open();
|
pandora.$ui.helpDialog = pandora.ui.helpDialog().open();
|
||||||
|
@ -168,8 +170,7 @@ pandora.URL = (function() {
|
||||||
|
|
||||||
var set = {
|
var set = {
|
||||||
section: state.type == pandora.site.itemsSection ? 'items' : state.type,
|
section: state.type == pandora.site.itemsSection ? 'items' : state.type,
|
||||||
item: state.item,
|
item: state.item
|
||||||
//find: state.find
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (state.view) {
|
if (state.view) {
|
||||||
|
@ -195,6 +196,8 @@ pandora.URL = (function() {
|
||||||
set['mapFind'] = state.span.substr(1);
|
set['mapFind'] = state.span.substr(1);
|
||||||
set['mapSelection'] = '';
|
set['mapSelection'] = '';
|
||||||
}
|
}
|
||||||
|
} else if (state.view == 'calendar') {
|
||||||
|
// ...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,17 +205,20 @@ pandora.URL = (function() {
|
||||||
set[!state.item ? 'listSort' : 'itemSort'] = state.sort;
|
set[!state.item ? 'listSort' : 'itemSort'] = state.sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
///*
|
|
||||||
if (state.find) {
|
if (state.find) {
|
||||||
|
if (!state.item) {
|
||||||
find = state.find;
|
find = state.find;
|
||||||
set.find = find;
|
set.find = state.find;
|
||||||
} else {
|
} else if (pandora.isItemFind(state.find)) {
|
||||||
|
set.itemFind = state.find;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!find) {
|
||||||
find = pandora.user.ui.find;
|
find = pandora.user.ui.find;
|
||||||
pandora.user.ui._list = pandora.getListsState(find)
|
pandora.user.ui._list = pandora.getListsState(find)
|
||||||
pandora.user.ui._groupsState = pandora.getGroupsState(find);
|
pandora.user.ui._groupsState = pandora.getGroupsState(find);
|
||||||
pandora.user.ui._findState = pandora.getFindState(find);
|
pandora.user.ui._findState = pandora.getFindState(find);
|
||||||
}
|
}
|
||||||
//*/
|
|
||||||
|
|
||||||
Ox.Request.cancel();
|
Ox.Request.cancel();
|
||||||
$('video').each(function() {
|
$('video').each(function() {
|
||||||
|
|
|
@ -148,16 +148,13 @@ pandora.ui.item = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
} else if (pandora.user.ui.itemView == 'video') {
|
} else if (pandora.user.ui.itemView == 'video') {
|
||||||
// fixme: duplicated
|
|
||||||
var clipsQuery = pandora.getClipsQuery(),
|
|
||||||
isClipsQuery = !!clipsQuery.conditions.length;
|
|
||||||
// ...
|
|
||||||
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({
|
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({
|
||||||
annotationsSize: pandora.user.ui.annotationsSize,
|
annotationsSize: pandora.user.ui.annotationsSize,
|
||||||
censored: censored,
|
censored: censored,
|
||||||
cuts: result.data.cuts || [],
|
cuts: result.data.cuts || [],
|
||||||
duration: result.data.duration,
|
duration: result.data.duration,
|
||||||
find: isClipsQuery ? clipsQuery.conditions[0].value : '',
|
find: pandora.user.ui.itemFind.conditions[0]
|
||||||
|
? pandora.user.ui.itemFind.conditions[0].value : '',
|
||||||
getTimelineImageURL: function(i) {
|
getTimelineImageURL: function(i) {
|
||||||
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
|
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
|
||||||
},
|
},
|
||||||
|
@ -176,6 +173,12 @@ pandora.ui.item = function() {
|
||||||
volume: pandora.user.ui.videoVolume,
|
volume: pandora.user.ui.videoVolume,
|
||||||
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
|
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
|
||||||
}).bindEvent({
|
}).bindEvent({
|
||||||
|
find: function(data) {
|
||||||
|
pandora.UI.set('itemFind', {
|
||||||
|
conditions: [{key: 'subtitles', value: data.find, operator: '='}],
|
||||||
|
operator: '&'
|
||||||
|
});
|
||||||
|
},
|
||||||
muted: function(data) {
|
muted: function(data) {
|
||||||
pandora.UI.set('muted', data.muted);
|
pandora.UI.set('muted', data.muted);
|
||||||
},
|
},
|
||||||
|
@ -203,14 +206,14 @@ pandora.ui.item = function() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
} else if (pandora.user.ui.itemView == 'timeline') {
|
} else if (pandora.user.ui.itemView == 'timeline') {
|
||||||
var clipsQuery = pandora.getClipsQuery(),
|
pandora.$ui.contentPanel.replaceElement(1,
|
||||||
isClipsQuery = !!clipsQuery.conditions.length;
|
pandora.$ui.editor = Ox.VideoEditor({
|
||||||
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = Ox.VideoEditor({
|
|
||||||
annotationsSize: pandora.user.ui.annotationsSize,
|
annotationsSize: pandora.user.ui.annotationsSize,
|
||||||
censored: censored,
|
censored: censored,
|
||||||
cuts: result.data.cuts || [],
|
cuts: result.data.cuts || [],
|
||||||
duration: result.data.duration,
|
duration: result.data.duration,
|
||||||
find: isClipsQuery ? clipsQuery.conditions[0].value : '',
|
find: pandora.user.ui.itemFind.conditions[0]
|
||||||
|
? pandora.user.ui.itemFind.conditions[0].value : '',
|
||||||
getFrameURL: function(position) {
|
getFrameURL: function(position) {
|
||||||
return '/' + pandora.user.ui.item + '/' + Ox.last(pandora.site.video.resolutions) + 'p' + position + '.jpg';
|
return '/' + pandora.user.ui.item + '/' + Ox.last(pandora.site.video.resolutions) + 'p' + position + '.jpg';
|
||||||
},
|
},
|
||||||
|
@ -237,6 +240,12 @@ pandora.ui.item = function() {
|
||||||
videoSize: pandora.user.ui.videoSize,
|
videoSize: pandora.user.ui.videoSize,
|
||||||
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
|
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
|
||||||
}).bindEvent({
|
}).bindEvent({
|
||||||
|
find: function(data) {
|
||||||
|
pandora.UI.set('itemFind', {
|
||||||
|
conditions: [{key: 'subtitles', value: data.find, operator: '='}],
|
||||||
|
operator: '&'
|
||||||
|
});
|
||||||
|
},
|
||||||
points: function(data) {
|
points: function(data) {
|
||||||
pandora.UI.set('videoPoints.' + pandora.user.ui.item, {
|
pandora.UI.set('videoPoints.' + pandora.user.ui.item, {
|
||||||
'in': data['in'],
|
'in': data['in'],
|
||||||
|
@ -285,7 +294,8 @@ pandora.ui.item = function() {
|
||||||
pandora_showannotations: function(data) {
|
pandora_showannotations: function(data) {
|
||||||
pandora.$ui.editor.options({showAnnotations: data.value});
|
pandora.$ui.editor.options({showAnnotations: data.value});
|
||||||
}
|
}
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
that.bindEvent('resize', function(data) {
|
that.bindEvent('resize', function(data) {
|
||||||
//Ox.print('resize item', data)
|
//Ox.print('resize item', data)
|
||||||
pandora.$ui.editor.options({
|
pandora.$ui.editor.options({
|
||||||
|
|
|
@ -435,6 +435,7 @@ pandora.getClipsItems = function(width) {
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.getClipsQuery = function() {
|
pandora.getClipsQuery = function() {
|
||||||
|
// fixme: nice, but not needed
|
||||||
function addClipsConditions(conditions) {
|
function addClipsConditions(conditions) {
|
||||||
conditions.forEach(function(condition) {
|
conditions.forEach(function(condition) {
|
||||||
if (condition.conditions) {
|
if (condition.conditions) {
|
||||||
|
@ -678,6 +679,12 @@ pandora.isClipView = function(view, item) {
|
||||||
).indexOf(view) > -1;
|
).indexOf(view) > -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pandora.isItemFind = function(find) {
|
||||||
|
return find.conditions.length == 1
|
||||||
|
&& Ox.getPositionById(pandora.site.layers, find.conditions[0].key) > -1
|
||||||
|
&& find.conditions[0].operator == '=';
|
||||||
|
};
|
||||||
|
|
||||||
pandora.signin = function(data) {
|
pandora.signin = function(data) {
|
||||||
pandora.user = data.user;
|
pandora.user = data.user;
|
||||||
pandora.user.ui._list = pandora.getListsState(pandora.user.ui.find);
|
pandora.user.ui._list = pandora.getListsState(pandora.user.ui.find);
|
||||||
|
|
Loading…
Reference in a new issue