deal with completely empty directories, remove ChangeSize and move that content into changeSize

This commit is contained in:
2025-10-06 21:41:35 +11:00
parent e5d6ce9b73
commit 7f13d78700

View File

@@ -221,20 +221,6 @@ function DetailsDBox()
}
// function to change the size of thumbnails (and resets button bar to newly
// selected size)
function ChangeSize(clicked_button,sz)
{
$('.sz-but.btn-info').removeClass('btn-info text-white').addClass('btn-outline-info')
$(clicked_button).addClass('btn-info text-white').removeClass('btn-outline-info')
$('.thumb').attr( {height: sz, style: 'font-size:'+sz+'px' } )
$('#size').val(sz)
sz=sz-22
$('.svg').height(sz);
$('.svg').width(sz);
$('.svg_cap').width(sz);
}
// DoSel is called when a click event occurs, and sets the selection via adding
// 'highlight' to the class of the appropriate thumbnails
// e == event (can see if shift/ctrl held down while left-clicking
@@ -504,7 +490,7 @@ function drawPageOfFigures()
if( OPT.folders )
{
if( document.entries.length && document.entries[0].in_dir.rel_path == '' )
if( !document.entries.length || (document.entries.length && document.entries[0].in_dir.rel_path == '' ) )
{
gray="_gray"
back=""
@@ -535,8 +521,11 @@ function drawPageOfFigures()
addFigure( obj, last, ecnt )
ecnt++
}
if( document.entries.length == 0 && OPT.search_term )
$('#figures').append( `<span class="alert alert-danger p-2 col-auto"> No matches for: '${OPT.search_term}'</span>` )
if( document.entries.length == 0 )
if( OPT.search_term )
$('#figures').append( `<span class="alert alert-danger p-2 col-auto"> No matches for: '${OPT.search_term}'</span>` )
else
$('#figures').append( `<span class="alert alert-danger p-2 col-auto d-flex align-items-center">No files in Path!</span>` )
$('.figure').click( function(e) { DoSel(e, this ); SetButtonState(); return false; });
$('.figure').dblclick( function(e) { dblClickToViewEntry( $(this).attr('id') ); setDisabledForViewingNextPrevBttons(); addViewerKeyHandler() } )
// for dir, getDirEntries 2nd param is back (or "up" a dir)
@@ -594,6 +583,13 @@ function getPage(pageNumber, successCallback, viewingIdx=0)
// if search, disable folders
if( OPT.search_term )
$('#folders').prop('disabled', 'disabled').removeClass('border-info').addClass('border-secondary').removeClass('text-info').addClass('text-secondary');
else if( res == [] )
{
html=`<span class="alert alert-danger p-2 col-auto">No files in Path!'</span>`
console.log(html)
$('#file_list_div').append(html)
$('#files_div').append(html)
}
},
error: function(xhr, status, error) { console.error("Error:", error); } });
return
@@ -704,7 +700,7 @@ function changeOPT(successCallback) {
OPT.folders=new_f
OPT.folders=$('#folders').val()
OPT.grouping=$('#grouping').val()
OPT.size=$('#size').val()
OPT.size=$('input[name="size"]:checked').val();
$.ajax({
type: 'POST',
url: '/change_file_opts',
@@ -715,6 +711,7 @@ function changeOPT(successCallback) {
// put data back into booleans, ints, etc
OPT.folders=( OPT.folders == 'True' )
OPT.how_many=parseInt(OPT.how_many)
console.log('OPT.size='+OPT.size)
$('.how_many_text').html( `&nbsp;${OPT.how_many} files&nbsp;` )
OPT.root_eid=parseInt(OPT.root_eid)
OPT.size=parseInt(OPT.size)
@@ -727,7 +724,13 @@ function changeOPT(successCallback) {
function changeSize()
{
sz=$('input[name="size"]:checked').val();
$('.thumb').prop('height',sz);
OPT.size=sz
$('.thumb').attr( {height: sz, style: 'font-size:'+sz+'px' } )
$('#size').val(sz)
sz=sz-22
$('.svg').height(sz);
$('.svg').width(sz);
$('.svg_cap').width(sz);
}