cablegates/static/js/pandora/ui/leftPanel.js

59 lines
2.5 KiB
JavaScript
Raw Normal View History

2011-07-29 18:37:11 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
2011-05-25 19:42:45 +00:00
pandora.ui.leftPanel = function() {
2011-06-19 17:49:25 +00:00
var that = Ox.SplitPanel({
2011-05-25 19:42:45 +00:00
elements: [
{
2011-06-06 15:48:11 +00:00
element: pandora.$ui.sectionbar = pandora.ui.sectionbar('buttons'),
2011-05-25 19:42:45 +00:00
size: 24
},
{
2011-06-06 15:48:11 +00:00
element: pandora.$ui.folders = pandora.ui.folders()
2011-05-25 19:42:45 +00:00
},
{
2011-06-06 15:48:11 +00:00
collapsed: !pandora.user.ui.showInfo,
2011-05-25 19:42:45 +00:00
collapsible: true,
2011-06-06 15:48:11 +00:00
element: pandora.$ui.info = pandora.ui.info(),
2011-08-18 07:54:46 +00:00
size: Math.round(pandora.user.ui.sidebarSize / pandora.user.infoRatio)
2011-05-25 19:42:45 +00:00
}
],
id: 'leftPanel',
orientation: 'vertical'
})
.bindEvent({
resize: function(event, data) {
2011-08-08 13:58:28 +00:00
Ox.print('LEFT PANEL RESIZE')
2011-08-18 07:54:46 +00:00
var infoSize = Math.round(data / pandora.user.infoRatio);
2011-06-06 15:48:11 +00:00
pandora.user.ui.sidebarSize = data;
if (data < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) {
pandora.$ui.sectionButtons.removeElement();
delete pandora.$ui.sectionButtons;
pandora.$ui.sectionbar.append(pandora.$ui.sectionSelect = pandora.ui.sectionSelect());
} else if (data >= pandora.site.sectionButtonsWidth && pandora.$ui.sectionSelect) {
pandora.$ui.sectionSelect.removeElement();
delete pandora.$ui.sectionSelect;
pandora.$ui.sectionbar.append(pandora.$ui.sectionButtons = pandora.ui.sectionButtons());
2011-05-25 19:42:45 +00:00
}
2011-06-06 15:48:11 +00:00
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoSize});
pandora.$ui.leftPanel.size(2, infoSize);
2011-08-08 13:58:28 +00:00
pandora.$ui.videoPreview && pandora.$ui.videoPreview.options({
frameHeight: infoSize - 16,
frameWidth: data
});
2011-05-25 19:42:45 +00:00
pandora.resizeFolders();
},
resizeend: function(event, data) {
pandora.UI.set({sidebarSize: data});
},
toggle: function(event, data) {
pandora.UI.set({showSidebar: !data.collapsed});
if (data.collapsed) {
2011-06-06 15:48:11 +00:00
$.each(pandora.$ui.folderList, function(k, $list) {
2011-05-25 19:42:45 +00:00
$list.loseFocus();
});
}
}
});
return that;
};