From 7f13d7870032b6fb78b46262d86abb87dda480b0 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Mon, 6 Oct 2025 21:41:35 +1100 Subject: [PATCH] deal with completely empty directories, remove ChangeSize and move that content into changeSize --- internal/js/files_support.js | 41 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/internal/js/files_support.js b/internal/js/files_support.js index a45a94d..82b411c 100644 --- a/internal/js/files_support.js +++ b/internal/js/files_support.js @@ -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( ` No matches for: '${OPT.search_term}'` ) + if( document.entries.length == 0 ) + if( OPT.search_term ) + $('#figures').append( ` No matches for: '${OPT.search_term}'` ) + else + $('#figures').append( `No files in Path!` ) $('.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=`No files in Path!'` + 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( ` ${OPT.how_many} files ` ) 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); }