From 517b5c616700d6f35fdd6b8786b7ef58295576e9 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sat, 11 Oct 2025 15:02:58 +1100 Subject: [PATCH] made more of the javascript hopefulyl honour versions, sort of works, not fully deployed consistently but works well enough for home use in dev. Also tweaked how the layout looks on a phone so that la / ra buttons on beside the image. Still oddly needs me to shrink that page, but it is now visually right - odd --- TODO | 4 ++++ files.py | 9 ++++++--- internal/js/files_support.js | 4 ++-- internal/js/view_support.js | 9 +++++++++ templates/file_list.html | 10 +++++----- templates/files.html | 19 ++++++++++++------- 6 files changed, 38 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index 65fd265..b7d0bbf 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,8 @@ ### +# +# consider how to better version jscript - across all html files, consistently +# mtime, didnt work anyway, my phone still wont pick up the change, it was adding any ?v= changed this (once) +# # 4 TEST everything (don't forget keybindings,e.g. delete) # going up from folder view shows different order? # diff --git a/files.py b/files.py index 1971a24..b69e6d5 100644 --- a/files.py +++ b/files.py @@ -461,7 +461,8 @@ def change_file_opts(): def file_list_ip(): OPT=States( request ) query_data = GetQueryData( OPT ) - return render_template("file_list.html", page_title='View File Details (Import Path)', query_data=query_data, OPT=OPT ) + js_vers = getVersions() + return render_template("file_list.html", page_title='View File Details (Import Path)', query_data=query_data, OPT=OPT, js_vers=js_vers ) ################################################################################ # /files -> show thumbnail view of files from import_path(s) @@ -482,7 +483,8 @@ def files_ip(): def files_sp(): OPT=States( request ) query_data = GetQueryData( OPT ) - return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, query_data=query_data ) + js_vers = getVersions() + return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, query_data=query_data, js_vers=js_vers ) ################################################################################ @@ -493,7 +495,8 @@ def files_sp(): def files_rbp(): OPT=States( request ) query_data = GetQueryData( OPT ) - return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, query_data=query_data ) + js_vers = getVersions() + return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, query_data=query_data, js_vers=js_vers ) ################################################################################ # search -> GET version -> has search_term in the URL and is therefore able to diff --git a/internal/js/files_support.js b/internal/js/files_support.js index 78fe650..f2d63b4 100644 --- a/internal/js/files_support.js +++ b/internal/js/files_support.js @@ -506,7 +506,7 @@ function drawPageOfFigures() else if( OPT.root_eid == 0 ) $('#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() } ) + $('.figure').dblclick( function(e) { startViewing( $(this).attr('id') ) } ) // for dir, getDirEntries 2nd param is back (or "up" a dir) $(".dir").click( function(e) { document.back_id=this.id; getDirEntries(this.id,false) } ) $(".back").click( function(e) { getDirEntries(this.id,true) } ) @@ -779,7 +779,7 @@ $.contextMenu({ return { callback: function( key, options) { if( key == "details" ) { DetailsDBox() } - if( key == "view" ) { dblClickToViewEntry( $(this).attr('id') ) } + if( key == "view" ) { startViewing( $(this).attr('id') ) } if( key == "move" ) { MoveDBox(move_paths) } if( key == "del" ) { DelDBox('Delete') } if( key == "undel") { DelDBox('Restore') } diff --git a/internal/js/view_support.js b/internal/js/view_support.js index 82cbd8b..95d2525 100644 --- a/internal/js/view_support.js +++ b/internal/js/view_support.js @@ -726,3 +726,12 @@ function nextImageInViewer() ViewImageOrVideo() } + +// wrapper func to start the viewer - needed as we have a dbl-click & View file +// to start the viewer +function startViewing(eid) +{ + dblClickToViewEntry( eid ); + setDisabledForViewingNextPrevBttons(); + addViewerKeyHandler() +} diff --git a/templates/file_list.html b/templates/file_list.html index 097c936..65aa261 100644 --- a/templates/file_list.html +++ b/templates/file_list.html @@ -1,5 +1,5 @@ {% extends "base.html" %} {% block main_content %} - +

{{page_title}}

@@ -9,11 +9,11 @@ {{CreateSelect( "how_many", OPT.how_many|string, ["10", "25", "50", "75", "100", "150", "200", "500"], "changeOPT(getPageFileList); return false", "rounded-end py-1 my-1" )|safe }}
 {{OPT.how_many}} files 
@@ -26,11 +26,11 @@
 {{OPT.how_many}} files 
diff --git a/templates/files.html b/templates/files.html index ed7c6d0..eb91c2f 100644 --- a/templates/files.html +++ b/templates/files.html @@ -2,6 +2,11 @@ {% block main_content %}