pandora/static/js/leftPanel.js

63 lines
2.7 KiB
JavaScript
Raw Permalink Normal View History

2011-11-05 17:04:10 +00:00
'use strict';
2018-06-19 06:33:26 +00:00
2013-07-15 11:39:23 +00:00
pandora.ui.leftPanel = function(section) {
2011-06-19 17:49:25 +00:00
var that = Ox.SplitPanel({
2011-05-25 19:42:45 +00:00
elements: [
{
2013-07-15 11:39:23 +00:00
element: pandora.$ui.sectionbar = pandora.ui.sectionbar('buttons', section),
2011-05-25 19:42:45 +00:00
size: 24
},
{
2013-07-15 11:39:23 +00:00
element: pandora.$ui.folders = pandora.ui.folders(section)
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(),
size: pandora.getInfoHeight(true),
tooltip: Ox._('info') + ' <span class="OxBright">'
2014-09-25 19:56:19 +00:00
+ Ox.SYMBOLS.shift + 'I</span>'
2011-05-25 19:42:45 +00:00
}
],
id: 'leftPanel',
orientation: 'vertical'
})
.bindEvent({
2011-09-17 17:40:15 +00:00
resize: function(data) {
2011-09-18 21:18:05 +00:00
pandora.user.ui.sidebarSize = data.size;
2011-10-29 13:50:40 +00:00
var infoHeight = pandora.getInfoHeight(true);
2011-09-17 17:40:15 +00:00
if (data.size < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) {
pandora.$ui.sectionButtons.remove();
2011-06-06 15:48:11 +00:00
delete pandora.$ui.sectionButtons;
2013-07-15 11:39:23 +00:00
pandora.$ui.sectionbar.append(pandora.$ui.sectionSelect = pandora.ui.sectionSelect(section));
2011-09-17 17:40:15 +00:00
} else if (data.size >= pandora.site.sectionButtonsWidth && pandora.$ui.sectionSelect) {
pandora.$ui.sectionSelect.remove();
2011-06-06 15:48:11 +00:00
delete pandora.$ui.sectionSelect;
2013-07-15 11:39:23 +00:00
pandora.$ui.sectionbar.append(pandora.$ui.sectionButtons = pandora.ui.sectionButtons(section));
2011-05-25 19:42:45 +00:00
}
2011-09-19 12:29:55 +00:00
pandora.$ui.leftPanel.size(2, infoHeight);
2011-10-29 14:17:43 +00:00
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoHeight + 'px'});
2011-05-25 19:42:45 +00:00
pandora.resizeFolders();
2018-03-07 07:54:33 +00:00
pandora.$ui.info.resizeInfo();
2011-05-25 19:42:45 +00:00
},
2011-09-17 17:40:15 +00:00
resizeend: function(data) {
2011-09-18 21:18:05 +00:00
// set to 0 so that UI.set registers a change of the value
pandora.user.ui.sidebarSize = 0;
2011-09-17 17:40:15 +00:00
pandora.UI.set({sidebarSize: data.size});
2011-05-25 19:42:45 +00:00
},
2011-09-17 17:40:15 +00:00
toggle: function(data) {
2011-05-25 19:42:45 +00:00
pandora.UI.set({showSidebar: !data.collapsed});
if (data.collapsed) {
Ox.forEach(pandora.$ui.folderList, function($list) {
2011-05-25 19:42:45 +00:00
$list.loseFocus();
});
}
},
pandora_showinfo: function(data) {
2014-09-23 21:57:01 +00:00
data.value == that.options('elements')[2].collapsed && that.toggleElement(2);
2011-05-25 19:42:45 +00:00
}
});
return that;
};