@@ -231,12 +231,21 @@ def _walk(parent: TLNode):
231231 document.querySelectorAll('.tree ul').forEach(ul => ul.classList.add('hidden'));
232232}
233233function filterTree() {
234- const q = document.getElementById('q').value.toLowerCase();
235- document.querySelectorAll('.tree li').forEach(li => {
236- const name = li.getAttribute('data-name');
237- const match = !q || (name && name.toLowerCase().includes(q));
238- li.style.display = match ? '' : 'none';
239- });
234+ const q = document.getElementById('q').value.toLowerCase();
235+ const items = document.querySelectorAll('.tree li');
236+ items.forEach(function(item) {
237+ const nameSpan = item.querySelector('.name');
238+ const name = nameSpan ? nameSpan.textContent.toLowerCase() : '';
239+ let match = q === '' || (name && name.includes(q));
240+ if (!match) {
241+ // Se non corrisponde, controllo se uno dei figli visibili corrisponde
242+ const childMatch = Array.from(item.querySelectorAll(':scope > ul > li')).some(
243+ child => child.style.display !== 'none'
244+ );
245+ match = childMatch;
246+ }
247+ item.style.display = match ? '' : 'none';
248+ });
240249}
241250"""
242251
@@ -415,7 +424,8 @@ def main():
415424 print ("Generazione HTML..." )
416425 html = render_html (root_obj , root_path , total_nodes , skipped )
417426
418- out_name = f"Export_data_{ date .today ().isoformat ()} .html"
427+ now = datetime .now ()
428+ out_name = f"Export_data_{ now .strftime ('%Y-%m-%d_%H-%M-%S' )} .html"
419429 with open (out_name , "w" , encoding = "utf-8" , newline = "" ) as f :
420430 f .write (html )
421431
0 commit comments