// vim: et:ts=4:sw=4:sts=4:ft=javascript pandora.ui.info = function() { var ui = pandora.user.ui, view = getView(), that = Ox.Element() .css({overflowX: 'hidden', overflowY: 'auto'}) .bindEvent({ toggle: function(data) { Ox.print('INFO TOGGLE') pandora.UI.set({showInfo: !data.collapsed}); //pandora.resizeFolders(); }, pandora_find: function() { if (pandora.user.ui._list != pandora.UI.getPrevious('_list')) { updateInfo(); } }, pandora_item: updateInfo, pandora_listselection: updateInfo, pandora_showinfo: function(data) { pandora.resizeFolders(); } }); //pandora.$ui.leftPanel && resize(); updateInfo(); function getId() { return ui.item || ( ui.listSelection.length ? ui.listSelection[ui.listSelection.length - 1] : null ); } function getView() { return !getId() ? 'list' : !ui.item && pandora.isClipView() ? 'poster' : 'video'; } function resizeInfo() { var height = pandora.getInfoHeight(true); Ox.print('RESIZE INFO', ui.showInfo, height) pandora.$ui.leftPanel.size(2, height); pandora.resizeFolders(); !ui.showInfo && pandora.$ui.leftPanel.css({bottom: -height + 'px'}); /* if (ui.showInfo) { pandora.$ui.leftPanel.size(2, height, function() { pandora.resizeFolders(); }); } else { pandora.$ui.leftPanel.css({bottom: -height + 'px'}); pandora.resizeFolders(); } */ } function updateInfo() { var id = getId(), previousView = view; view = getView(); if (view == 'list') { that.empty().append(pandora.$ui.listInfo = pandora.ui.listInfo()); previousView == 'video' && resizeInfo(); } else if (view == 'poster') { pandora.api.get({id: id, keys: ['director', 'posterRatio', 'title']}, function(result) { var ratio = result.data.posterRatio, height = pandora.getInfoHeight(true); that.empty().append( pandora.$ui.posterInfo = pandora.ui.posterInfo(Ox.extend(result.data, {id: id})) ); previousView == 'video' && resizeInfo(); }); } else if (view == 'video') { pandora.api.get({ id: id, keys: ['duration', 'rendered', 'videoRatio'] }, function(result) { if (result.data && result.data.rendered) { pandora.$ui.videoPreview && pandora.$ui.videoPreview.removeElement(); pandora.$ui.videoPreview = pandora.ui.videoPreview({ duration: result.data.duration, frameRatio: result.data.videoRatio, height: pandora.getInfoHeight(true), id: id, width: ui.sidebarSize }) .bindEvent({ click: function(data) { pandora.UI.set( 'videoPoints.' + id, {'in': 0, out: 0, position: data.position} ); if (ui.item && ['video', 'timeline'].indexOf(ui.itemView) > -1) { pandora.$ui[ ui.itemView == 'video' ? 'player' : 'editor' ].options({ position: data.position }); } else { pandora.UI.set({ item: id, itemView: ui.videoView }); } } }) .appendTo(pandora.$ui.info); previousView != 'video' && resizeInfo(); } }); } } that.resizeInfo = function() { var view = getView(); if (view == 'list') { pandora.$ui.listInfo.resizeIcon(); } else if (view == 'poster') { pandora.$ui.posterInfo.resizePoster(); } else if (view == 'video') { pandora.$ui.videoPreview.options({ height: pandora.getInfoHeight(true), width: ui.sidebarSize }); } }; return that; }; pandora.ui.listInfo = function() { var list = pandora.user.ui._list, that = $('