mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
now panels are hidden rather than removed (optional mode switch exists but commented out)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
06ac2d63c4
commit
837ee9120f
@ -36,6 +36,14 @@ var PANELS = {}
|
||||
var PANEL_STATE = {}
|
||||
|
||||
|
||||
/*
|
||||
// This can be:
|
||||
// - hide
|
||||
// - remove
|
||||
var PANEL_CLOSE_METHOD = 'hide'
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Helpers...
|
||||
@ -158,7 +166,7 @@ function makePanel(title, parent, open, keep_empty, close_button){
|
||||
// be accessed from different contexts...
|
||||
.on('subPanelsUpdated', function(){
|
||||
// remove the panel when it runs out of sub-panels...
|
||||
if(!keep_empty && panel.find('.sub-panel').length <= 0){
|
||||
if(!keep_empty && panel.find('.sub-panel:visible').length <= 0){
|
||||
removePanel(panel, true)
|
||||
}
|
||||
})
|
||||
@ -444,8 +452,10 @@ function openPanel(panel){
|
||||
open = isPanelVisible(panel)
|
||||
// show panels...
|
||||
panel
|
||||
.css('display', '')
|
||||
.prop('open', true)
|
||||
.parents('.panel')
|
||||
.css('display', '')
|
||||
.prop('open', true)
|
||||
// show side panels...
|
||||
panel
|
||||
@ -481,7 +491,7 @@ function closePanel(panel){
|
||||
panel = typeof(panel) == typeof('str')
|
||||
? getPanel(panel)
|
||||
: panel
|
||||
panel.find('.sub-panel').each(function(){
|
||||
panel.find('.sub-panel:visible').each(function(){
|
||||
var p = $(this)
|
||||
if(p.prop('open')){
|
||||
p.trigger('panelClosing', p)
|
||||
@ -500,9 +510,18 @@ function removePanel(panel){
|
||||
panel = typeof(panel) == typeof('str')
|
||||
? getPanel(panel)
|
||||
: panel
|
||||
/*
|
||||
if(PANEL_CLOSE_METHOD == 'hide'){
|
||||
return closePanel(panel)
|
||||
.hide()
|
||||
} else {
|
||||
return closePanel(panel)
|
||||
.remove()
|
||||
}
|
||||
*/
|
||||
return closePanel(panel)
|
||||
.hide()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user