forked from 0x2620/pandora
re-adding info view
This commit is contained in:
parent
a383b5fc77
commit
5d98943fcf
1 changed files with 115 additions and 99 deletions
|
@ -18,9 +18,6 @@ var pandora = new Ox.App({
|
||||||
},
|
},
|
||||||
config: data.config,
|
config: data.config,
|
||||||
requests: {},
|
requests: {},
|
||||||
templates: {
|
|
||||||
info: $('<div>').load('/static/html/itemInfo.html')
|
|
||||||
},
|
|
||||||
ui: {
|
ui: {
|
||||||
infoRatio: 4 / 3,
|
infoRatio: 4 / 3,
|
||||||
sectionElement: 'buttons',
|
sectionElement: 'buttons',
|
||||||
|
@ -78,7 +75,7 @@ var pandora = new Ox.App({
|
||||||
height: app.$ui.document.height() -
|
height: app.$ui.document.height() -
|
||||||
20 - 24 - app.$ui.contentPanel.size(0) - 1 - 16,
|
20 - 24 - app.$ui.contentPanel.size(0) - 1 - 16,
|
||||||
width: app.$ui.document.width() -
|
width: app.$ui.document.width() -
|
||||||
app.$ui.mainPanel.size(0) - app.$ui.timelinePanel.size(1) - 2 // fixme: item, not timelinePanel
|
app.$ui.mainPanel.size(0) - app.$ui.item.size(1) - 2
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -451,7 +448,9 @@ var pandora = new Ox.App({
|
||||||
return that;
|
return that;
|
||||||
},
|
},
|
||||||
annotations: function() {
|
annotations: function() {
|
||||||
var that = new Ox.Element(),
|
var that = new Ox.Element({
|
||||||
|
id: 'annotations'
|
||||||
|
}),
|
||||||
$bins = [];
|
$bins = [];
|
||||||
$.each(app.config.layers, function(i, layer) {
|
$.each(app.config.layers, function(i, layer) {
|
||||||
var $bin = new Ox.CollapsePanel({
|
var $bin = new Ox.CollapsePanel({
|
||||||
|
@ -475,6 +474,7 @@ var pandora = new Ox.App({
|
||||||
$.each($bins, function(i, bin) {
|
$.each($bins, function(i, bin) {
|
||||||
that.append(bin);
|
that.append(bin);
|
||||||
});
|
});
|
||||||
|
//alert(JSON.stringify(that.id))
|
||||||
return that;
|
return that;
|
||||||
},
|
},
|
||||||
appPanel: function() {
|
appPanel: function() {
|
||||||
|
@ -564,7 +564,7 @@ var pandora = new Ox.App({
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
});
|
})
|
||||||
return that;
|
return that;
|
||||||
},
|
},
|
||||||
findElement: function() {
|
findElement: function() {
|
||||||
|
@ -805,73 +805,91 @@ var pandora = new Ox.App({
|
||||||
return that;
|
return that;
|
||||||
},
|
},
|
||||||
item: function(id, view) { // fixme: params are not necessary
|
item: function(id, view) { // fixme: params are not necessary
|
||||||
var that,
|
var that = new Ox.Element('div');
|
||||||
elements = [
|
elements = [];
|
||||||
];
|
getItem();
|
||||||
if (view == 'timeline') {
|
|
||||||
that = app.$ui.timelinePanel = new Ox.SplitPanel({
|
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
element: new Ox.Element('div'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
collapsible: true,
|
|
||||||
element: app.$ui.annotations = ui.annotations(),
|
|
||||||
size: 256
|
|
||||||
}
|
|
||||||
],
|
|
||||||
orientation: 'horizontal'
|
|
||||||
});
|
|
||||||
getItem();
|
|
||||||
}
|
|
||||||
function getItem() {
|
function getItem() {
|
||||||
pandora.api.getItem(id, function(result) {
|
pandora.api.getItem(app.user.ui.item, function(result) {
|
||||||
var video = result.data.item.stream,
|
if (app.user.ui.itemView == 'info') {
|
||||||
cuts = result.data.item.layers.cuts || {},
|
Ox.print('result.data.item', result.data.item)
|
||||||
subtitles = result.data.item.layers.subtitles || [{
|
$.get('/static/html/itemInfo.html', {}, function(template) {
|
||||||
'in': 5,
|
Ox.print(template);
|
||||||
'out': 10,
|
app.$ui.contentPanel.replace(1,
|
||||||
'text': 'This subtitle is just a test...'
|
app.$ui.item = new Ox.Element('div')
|
||||||
}];
|
.append($.tmpl(template, result.data.item))
|
||||||
video.height = 96;
|
);
|
||||||
video.width = parseInt(video.height * video.aspectRatio / 2) * 2;
|
});
|
||||||
video.url = video.baseUrl + '/' + video.height + 'p.' + ($.support.video.webm ? 'webm' : 'mp4');
|
} else if (app.user.ui.itemView == 'timeline') {
|
||||||
app.$ui.timelinePanel.replace(0, app.$ui.editor = new Ox.VideoEditor({
|
var video = result.data.item.stream,
|
||||||
cuts: cuts,
|
cuts = result.data.item.layers.cuts || {},
|
||||||
duration: video.duration,
|
subtitles = result.data.item.layers.subtitles || [{
|
||||||
find: '',
|
'in': 5,
|
||||||
frameURL: function(position) {
|
'out': 10,
|
||||||
return '/' + id + '/frame/' + video.width.toString() + '/' + position.toString() + '.jpg'
|
'text': 'This subtitle is just a test...'
|
||||||
},
|
}];
|
||||||
height: app.$ui.contentPanel.size(1),
|
video.height = 96;
|
||||||
id: 'editor',
|
video.width = parseInt(video.height * video.aspectRatio / 2) * 2;
|
||||||
largeTimeline: true,
|
video.url = video.baseUrl + '/' + video.height + 'p.' + ($.support.video.webm ? 'webm' : 'mp4');
|
||||||
matches: [],
|
app.$ui.contentPanel.replace(1, app.$ui.item = new Ox.SplitPanel({
|
||||||
points: [0, 0],
|
elements: [
|
||||||
position: 0,
|
{
|
||||||
posterFrame: parseInt(video.duration / 2),
|
element: app.$ui.editor = new Ox.VideoEditor({
|
||||||
subtitles: subtitles,
|
cuts: cuts,
|
||||||
videoHeight: video.height,
|
duration: video.duration,
|
||||||
videoId: id,
|
find: '',
|
||||||
videoWidth: video.width,
|
frameURL: function(position) {
|
||||||
videoSize: 'small',
|
return '/' + id + '/frame/' + video.width.toString() + '/' + position.toString() + '.jpg'
|
||||||
videoURL: video.url,
|
},
|
||||||
width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - 1 - 256 - 1
|
height: app.$ui.contentPanel.size(1),
|
||||||
}).bindEvent('resize', function(event, data) {
|
id: 'editor',
|
||||||
Ox.print('RESIZE:', data)
|
largeTimeline: true,
|
||||||
app.$ui.editor.options({
|
matches: [],
|
||||||
width: data
|
points: [0, 0],
|
||||||
});
|
position: 0,
|
||||||
}));
|
posterFrame: parseInt(video.duration / 2),
|
||||||
app.$ui.rightPanel.bindEvent('resize', function(event, data) {
|
subtitles: subtitles,
|
||||||
Ox.print('rightPanel resize', data, app.$ui.timelinePanel.size(1))
|
videoHeight: video.height,
|
||||||
app.$ui.editor.options({
|
videoId: id,
|
||||||
width: data - app.$ui.timelinePanel.size(1) - 1
|
videoWidth: video.width,
|
||||||
});
|
videoSize: 'small',
|
||||||
});
|
videoURL: video.url,
|
||||||
|
width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - 1 - 256 - 1
|
||||||
|
}).bindEvent('resize', function(event, data) {
|
||||||
|
Ox.print('resize editor', data)
|
||||||
|
app.$ui.editor.options({
|
||||||
|
width: data
|
||||||
|
});
|
||||||
|
Ox.print('resize done')
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
collapsible: true,
|
||||||
|
element: app.$ui.annotations = ui.annotations(),
|
||||||
|
resizable: true,
|
||||||
|
resize: [256, 384],
|
||||||
|
size: 256
|
||||||
|
}
|
||||||
|
],
|
||||||
|
orientation: 'horizontal'
|
||||||
|
}).bindEvent('resize', function(event, data) {
|
||||||
|
Ox.print('resize item', data)
|
||||||
|
app.$ui.editor.options({
|
||||||
|
height: data
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
/*
|
||||||
|
app.$ui.rightPanel.bindEvent('resize', function(event, data) {
|
||||||
|
Ox.print('... rightPanel resize', data, app.$ui.timelinePanel.size(1))
|
||||||
|
app.$ui.editor.options({
|
||||||
|
width: data - app.$ui.timelinePanel.size(1) - 1
|
||||||
|
});
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
that.display = function() {
|
that.display = function() {
|
||||||
|
//alert('display')
|
||||||
app.$ui.contentPanel.replaceElements([
|
app.$ui.contentPanel.replaceElements([
|
||||||
{
|
{
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
|
@ -880,25 +898,14 @@ var pandora = new Ox.App({
|
||||||
size: 80
|
size: 80
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: app.$ui.timelinePanel = new Ox.SplitPanel({
|
element: new Ox.Element('div')
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
element: app.$ui.editor = new Ox.Element('div')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
collapsible: true,
|
|
||||||
element: app.$ui.annotations = ui.annotations(),
|
|
||||||
size: 256
|
|
||||||
}
|
|
||||||
],
|
|
||||||
orientation: 'horizontal'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
// getItem(); // fixme: can the asynchronicity be moved within the video editor?
|
getItem(); // fixme: can the asynchronicity be moved within the video editor?
|
||||||
}
|
}
|
||||||
return that;
|
return that;
|
||||||
},
|
},
|
||||||
|
/*
|
||||||
item_: function(id, view) {
|
item_: function(id, view) {
|
||||||
var $item;
|
var $item;
|
||||||
//location.hash = '!' + id;
|
//location.hash = '!' + id;
|
||||||
|
@ -979,14 +986,12 @@ var pandora = new Ox.App({
|
||||||
width: data - app.$ui.item.size(1) - 1
|
width: data - app.$ui.item.size(1) - 1
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
///*
|
|
||||||
app.$ui.window.resize(function() {
|
app.$ui.window.resize(function() {
|
||||||
app.$ui.editor.options({
|
app.$ui.editor.options({
|
||||||
height: app.$ui.document.height() - 20 - 24 - app.$ui.contentPanel.size(0) - 1 - 16,
|
height: app.$ui.document.height() - 20 - 24 - app.$ui.contentPanel.size(0) - 1 - 16,
|
||||||
width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - app.$ui.timelinePanel.size(1) - 2
|
width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - app.$ui.timelinePanel.size(1) - 2
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//*/
|
|
||||||
});
|
});
|
||||||
} else if (view == 'info') {
|
} else if (view == 'info') {
|
||||||
pandora.api.getItem(id, function(result) {
|
pandora.api.getItem(id, function(result) {
|
||||||
|
@ -995,17 +1000,16 @@ var pandora = new Ox.App({
|
||||||
var $item = new Ox.Container();
|
var $item = new Ox.Container();
|
||||||
$item.append(app.template.info.tmpl(item));
|
$item.append(app.template.info.tmpl(item));
|
||||||
app.$ui.rightPanel.replace(1, $item);
|
app.$ui.rightPanel.replace(1, $item);
|
||||||
/*
|
|
||||||
app.$ui.rightPanel
|
app.$ui.rightPanel
|
||||||
.bindEvent('resize', function(event, data) {
|
.bindEvent('resize', function(event, data) {
|
||||||
app.$ui.editor.options({
|
app.$ui.editor.options({
|
||||||
width: data - app.$ui.timelinePanel.size(1) - 1
|
width: data - app.$ui.timelinePanel.size(1) - 1
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
leftPanel: function() {
|
leftPanel: function() {
|
||||||
var that = new Ox.SplitPanel({
|
var that = new Ox.SplitPanel({
|
||||||
elements: [
|
elements: [
|
||||||
|
@ -1959,7 +1963,7 @@ var pandora = new Ox.App({
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
orientation: 'horizontal'
|
orientation: 'horizontal'
|
||||||
});
|
})
|
||||||
return that;
|
return that;
|
||||||
},
|
},
|
||||||
rightPanel: function() {
|
rightPanel: function() {
|
||||||
|
@ -1981,6 +1985,7 @@ var pandora = new Ox.App({
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
})
|
})
|
||||||
.bindEvent('resize', function(event, data) {
|
.bindEvent('resize', function(event, data) {
|
||||||
|
Ox.print('???? resize rightPanel', event, data)
|
||||||
if (!app.user.ui.item) {
|
if (!app.user.ui.item) {
|
||||||
resizeGroups(data);
|
resizeGroups(data);
|
||||||
app.$ui.list.size();
|
app.$ui.list.size();
|
||||||
|
@ -1990,7 +1995,7 @@ var pandora = new Ox.App({
|
||||||
} else {
|
} else {
|
||||||
if (app.user.ui.itemView == 'timeline') {
|
if (app.user.ui.itemView == 'timeline') {
|
||||||
app.$ui.editor.options({
|
app.$ui.editor.options({
|
||||||
width: data
|
width: data - app.$ui.item.size(1) - 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2156,26 +2161,31 @@ var pandora = new Ox.App({
|
||||||
})
|
})
|
||||||
.append(
|
.append(
|
||||||
app.$ui.viewSelect = ui.viewSelect()
|
app.$ui.viewSelect = ui.viewSelect()
|
||||||
)
|
|
||||||
.append(
|
|
||||||
app.$ui.sortSelect = ui.sortSelect()
|
|
||||||
)
|
|
||||||
.append(
|
|
||||||
app.$ui.findElement = ui.findElement()
|
|
||||||
);
|
);
|
||||||
that.toggle = function() {
|
!app.user.ui.item && that.append(
|
||||||
|
app.$ui.sortSelect = ui.sortSelect()
|
||||||
|
);
|
||||||
|
that.append(
|
||||||
|
app.$ui.findElement = ui.findElement()
|
||||||
|
);
|
||||||
|
that.display = function() {
|
||||||
|
app.$ui.rightPanel.replace(0, app.$ui.toolbar = toolbar());
|
||||||
}
|
}
|
||||||
return that;
|
return that;
|
||||||
},
|
},
|
||||||
viewSelect: function() {
|
viewSelect: function() {
|
||||||
var that = new Ox.Select({
|
var that = new Ox.Select({
|
||||||
id: 'viewSelect',
|
id: 'viewSelect',
|
||||||
items: $.map(app.config.listViews, function(view) {
|
items: !app.user.ui.item ? $.map(app.config.listViews, function(view) {
|
||||||
return $.extend($.extend({}, view), {
|
return $.extend($.extend({}, view), {
|
||||||
checked: app.user.ui.listView == view.id,
|
checked: app.user.ui.listView == view.id,
|
||||||
title: 'View ' + view.title
|
title: 'View ' + view.title
|
||||||
});
|
});
|
||||||
|
}) : $.map(app.config.itemViews, function(view) {
|
||||||
|
return $.extend($.extend({}, view), {
|
||||||
|
checked: app.user.ui.itemView == view.id,
|
||||||
|
title: 'View ' + view.title
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
width: 144
|
width: 144
|
||||||
})
|
})
|
||||||
|
@ -2183,11 +2193,15 @@ var pandora = new Ox.App({
|
||||||
float: 'left',
|
float: 'left',
|
||||||
margin: '4px 0 0 4px'
|
margin: '4px 0 0 4px'
|
||||||
})
|
})
|
||||||
.bindEvent('change', function(event, data) {
|
.bindEvent('change', !app.user.ui.item ? function(event, data) {
|
||||||
var id = data.selected[0].id;
|
var id = data.selected[0].id;
|
||||||
app.user.ui.listView = id;
|
app.user.ui.listView = id;
|
||||||
app.$ui.mainMenu.checkItem('viewMenu_movies_' + id);
|
app.$ui.mainMenu.checkItem('viewMenu_movies_' + id);
|
||||||
app.$ui.contentPanel.replace(1, app.$ui.list = ui.list(id));
|
app.$ui.contentPanel.replace(1, app.$ui.list = ui.list(id));
|
||||||
|
} : function(event, data) {
|
||||||
|
var id = data.selected[0].id;
|
||||||
|
app.user.ui.itemView = id;
|
||||||
|
app.$ui.contentPanel.replace(1, app.$ui.item = ui.item());
|
||||||
});
|
});
|
||||||
return that;
|
return that;
|
||||||
}
|
}
|
||||||
|
@ -2471,6 +2485,8 @@ var pandora = new Ox.App({
|
||||||
update: function() {
|
update: function() {
|
||||||
URL.parse();
|
URL.parse();
|
||||||
if (!old.user.ui.item && app.user.ui.item) {
|
if (!old.user.ui.item && app.user.ui.item) {
|
||||||
|
//ui.toolbar.display();
|
||||||
|
app.$ui.rightPanel.replace(0, app.$ui.toolbar = ui.toolbar());
|
||||||
ui.item(app.user.ui.item, app.user.ui.itemView).display();
|
ui.item(app.user.ui.item, app.user.ui.itemView).display();
|
||||||
} else if (old.user.ui.item && !app.user.ui.item) {
|
} else if (old.user.ui.item && !app.user.ui.item) {
|
||||||
ui.list(app.user.ui.listView).display();
|
ui.list(app.user.ui.listView).display();
|
||||||
|
|
Loading…
Reference in a new issue