From 7cb819d4019da702bf8d00b0e49b781231454bc9 Mon Sep 17 00:00:00 2001 From: rlv-dan Date: Sun, 9 Aug 2020 17:29:25 +0200 Subject: [PATCH] Update template * Faster display after searching large amount of files * Also show "searching..." indicator. * Fix [..] position --- Snap2HTML/template.html | 86 ++++++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 22 deletions(-) diff --git a/Snap2HTML/template.html b/Snap2HTML/template.html index af1d911..72a8a12 100644 --- a/Snap2HTML/template.html +++ b/Snap2HTML/template.html @@ -172,6 +172,22 @@ .list_files { overflow: auto; + position: relative; + } + + .search_indicator { + position: absolute; + left: 0px; + right: 0px; + top: 0px; + bottom: 0px; + background-color: white; + opacity: 0.7; + text-align: center; + padding-top: 100px; + font-size: 18px; + display: none; + z-index: 99; } /* --- Splitter --- */ @@ -291,7 +307,7 @@ } #parent_folder { position: absolute; - top: 43px; + top: 24px; left: 4px; } #parent_folder_border { @@ -299,7 +315,7 @@ height: 1px; position: absolute; width: 100%; - top: 61px; + top: 42px; } @@ -970,13 +986,17 @@ return; } + var showLocationColumn = true; + if( numberOfFiles > 5000 ) { - $("#list_header").html( "Searching..." ); + $("#search_indicator").show(); + //$("#list_header").html( "Searching..." ); + showLocationColumn = false; } location.hash = ""; - setTimeout(function(){ // timeout allows redrawing screen before possible timeconsuming search + setTimeout(function(){ // timeout allows redrawing screen before possible time consuming search if( SelectedFolderID != -1 ) { @@ -1033,9 +1053,15 @@ } } + var locationHtml = ""; + + if(showLocationColumn) locationHtml = "Folder"; + currentView = []; var table_html = ""; - table_html += "\n"; + table_html += "
NameFolderSizeModified
" + + locationHtml + + ""; var countFiles = 0; var countDirs = 0; @@ -1079,18 +1105,23 @@ sizeDirs += SearchFilenames[index][1]; var subdir_id = parent_folders[ SearchLocationsID[index] ]; - var located_in = SearchLocations[index]; - if( located_in === "" ) located_in = "[.]" - located_in = located_in.substring( 0, located_in.lastIndexOf("\\") ); var timestamp = timestampToDate(SearchFilenames[index][2]); + locationHtml = ""; + if(showLocationColumn) { + var located_in = SearchLocations[index]; + if( located_in === "" ) located_in = "[.]" + located_in = located_in.substring( 0, located_in.lastIndexOf("\\") ); + locationHtml = ""; + } + table_html += "" + "" + - "" + + locationHtml + "" + "" + - "\n"; + ""; currentView.push( { "name": SearchFilenames[index][3], "path": SearchLocationsRaw[index].replace(/\//g,"\\"), "type": "dir", "size": SearchFilenames[index][1], "date": SearchFilenames[index][2] } ); } else // files @@ -1131,16 +1162,22 @@ } } - var located_in = SearchLocations[index]; - if( located_in === "" ) located_in = "[.]" + locationHtml = ""; + if(showLocationColumn) { + var located_in = SearchLocations[index]; + if( located_in === "" ) located_in = "[.]" + locationHtml = ""; + } + + var timestamp = timestampToDate(SearchFilenames[index][2]); table_html += "" + "" + - "" + + locationHtml + "" + "" + - "\n"; + ""; currentView.push( { "name": SearchFilenames[index][3], "path": SearchLocationsRaw[index].replace(/\//g,"\\"), "type": "file", "size": SearchFilenames[index][1], "date": SearchFilenames[index][2] } ); @@ -1170,24 +1207,28 @@ } } - table_html += "
NameSizeModified
" + located_in + "
" + SearchFilenames[index][3] + " " + located_in + "" + bytesToSize( SearchFilenames[index][1] ) + "" + timestamp + "
" + located_in + "
" + file_tmp + " " + located_in + "" + bytesToSize( SearchFilenames[index][1] ) + "" + timestamp + "
\n"; + table_html += ""; $("#list_header").html( "Search Results " ); document.getElementById("list_files").innerHTML = table_html; + $("#search_indicator").hide(); addFolderClickEventHandlers(); + + var tablesorterHeaders = { 1 : { sorter: 'datasort' }, 2 : { sorter: 'datasort' } } + if(showLocationColumn) { + tablesorterHeaders = { 2 : { sorter: 'datasort' }, 3 : { sorter: 'datasort' } } + } + $("#files").tablesorter({ sortInitialOrder: "desc", - headers: { - 2 : { sorter: 'datasort' }, - 3 : { sorter: 'datasort' } - } + headers: tablesorterHeaders }); var sFiles = " files"; if(countFiles===1) sFiles = " file"; var sDirs = " folders"; if(countDirs===1) sDirs = " folder"; $("#list_footer_info_label").html( countDirs + sDirs + " (" + bytesToSize( sizeDirs , 0 ) + "), " + countFiles + sFiles + " (" + bytesToSize( sizeFiles , 0 ) + ")" ); - }, 1); // end setTimeout before search + }, 50); // end setTimeout before search }; // end doSearch() @@ -1689,10 +1730,12 @@
Loading...

(if nothing happens, make sure javascript is enabled and allowed to execute, or try another browser)

-
+
+ Searching... +
-