make video position stick when switching between player and timeline view (part 1)

This commit is contained in:
rolux 2011-01-18 16:26:09 +00:00
parent 1eca5218c8
commit 014d2638dc
2 changed files with 23 additions and 8 deletions

View file

@ -185,6 +185,7 @@
"sidebarSize": 256, "sidebarSize": 256,
"sitePage": "home", "sitePage": "home",
"theme": "modern", "theme": "modern",
"videoPosition": {},
"videoSize": "fit" "videoSize": "fit"
}, },
"username": "" "username": ""

View file

@ -32,6 +32,10 @@ var pandora = new Ox.App({
pandora.app = app; // remove later pandora.app = app; // remove later
if ($.browser.mozilla) {
app.config.user.ui.theme = 'classic'
}
if (app.user.group == 'guest') { if (app.user.group == 'guest') {
app.user = $.extend({}, app.config.user); app.user = $.extend({}, app.config.user);
} }
@ -43,6 +47,7 @@ var pandora = new Ox.App({
URL.update(); URL.update();
}; };
Ox.theme(app.user.ui.theme);
app.$ui.appPanel = ui.appPanel(); app.$ui.appPanel = ui.appPanel();
$(function() { $(function() {
@ -61,13 +66,13 @@ var pandora = new Ox.App({
function login(data) { function login(data) {
app.user = data.user; app.user = data.user;
//Ox.Event.unbindAll(); Ox.theme(app.user.ui.theme);
app.$ui.appPanel.reload(); app.$ui.appPanel.reload();
} }
function logout(data) { function logout(data) {
app.user = data.user; app.user = data.user;
//Ox.Event.unbindAll(); Ox.theme(app.config.user.ui.theme);
app.$ui.appPanel.reload(); app.$ui.appPanel.reload();
} }
@ -977,6 +982,7 @@ var pandora = new Ox.App({
annotationsSize: app.user.ui.annotationsSize, annotationsSize: app.user.ui.annotationsSize,
duration: video.duration, duration: video.duration,
height: app.$ui.contentPanel.size(1), height: app.$ui.contentPanel.size(1),
position: app.user.ui.videoPosition[app.user.ui.item] || 0,
showAnnotations: app.user.ui.showAnnotations, showAnnotations: app.user.ui.showAnnotations,
showControls: app.user.ui.showControls, showControls: app.user.ui.showControls,
subtitles: subtitles, subtitles: subtitles,
@ -1023,7 +1029,7 @@ var pandora = new Ox.App({
largeTimeline: true, largeTimeline: true,
matches: [], matches: [],
points: [0, 0], points: [0, 0],
position: 0, position: app.user.ui.videoPosition[app.user.ui.item] || 0,
posterFrame: parseInt(video.duration / 2), posterFrame: parseInt(video.duration / 2),
subtitles: subtitles, subtitles: subtitles,
videoHeight: video.height, videoHeight: video.height,
@ -1059,6 +1065,7 @@ var pandora = new Ox.App({
app.$ui.total.html(result.data.item.title + ' (' + result.data.item.director.join(', ') + ')') app.$ui.total.html(result.data.item.title + ' (' + result.data.item.director.join(', ') + ')')
}); });
} }
/*
that.display = function() { that.display = function() {
app.$ui.contentPanel.replaceElements([ app.$ui.contentPanel.replaceElements([
{ {
@ -1073,6 +1080,7 @@ var pandora = new Ox.App({
]); ]);
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;
}, },
leftPanel: function() { leftPanel: function() {
@ -2960,14 +2968,13 @@ var pandora = new Ox.App({
change: !app.user.ui.item ? function(event, data) { change: !app.user.ui.item ? function(event, data) {
var id = data.selected[0].id; var id = data.selected[0].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));
UI.set(['lists', app.user.ui.list, 'listView'].join('|'), id); UI.set(['lists', app.user.ui.list, 'listView'].join('|'), id);
URL.set(Query.toString()); URL.set(Query.toString());
} : function(event, data) { } : function(event, data) {
var id = data.selected[0].id; var id = data.selected[0].id;
UI.set({itemView: id}); //UI.set({itemView: id});
// fixme: URL.set() here URL.set(app.user.ui.item + '/' + id);
app.$ui.contentPanel.replace(1, app.$ui.item = ui.item()); // app.$ui.contentPanel.replace(1, app.$ui.item = ui.item());
} }
}); });
return that; return that;
@ -3494,7 +3501,8 @@ var pandora = new Ox.App({
item = split[0], item = split[0],
view = new RegExp( view = new RegExp(
'^(calendar|clips|files|info|map|player|statistics|timeline)$' '^(calendar|clips|files|info|map|player|statistics|timeline)$'
)(split[1]) || app.user.ui.itemView; )(split[1]);
view = view ? view[0] : app.user.ui.itemView;
UI.set({ UI.set({
section: 'items', section: 'items',
item: item, item: item,
@ -3556,6 +3564,12 @@ var pandora = new Ox.App({
app.$ui.mainPanel.replace(1, app.$ui.rightPanel = ui.rightPanel()); app.$ui.mainPanel.replace(1, app.$ui.rightPanel = ui.rightPanel());
//ui.list(app.user.ui.listView).display(); //ui.list(app.user.ui.listView).display();
} else { } else {
if (['player', 'timeline'].indexOf(old.user.ui.itemView) > -1) {
UI.set(
'videoPosition|' + app.user.ui.item,
app.$ui[old.user.ui.itemView == 'player' ? 'player' : 'editor'].options('position')
);
}
app.$ui.contentPanel.replace(1, ui.item()); app.$ui.contentPanel.replace(1, ui.item());
} }
} }