From fc13606bd984f3273a7b2690a0426bc138ca57b7 Mon Sep 17 00:00:00 2001 From: turner Date: Wed, 24 Jan 2024 16:17:58 -0500 Subject: [PATCH] Session. Local track file load widget build out. --- js/sessionUtils.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/js/sessionUtils.js b/js/sessionUtils.js index d9bc4cd..08988b9 100644 --- a/js/sessionUtils.js +++ b/js/sessionUtils.js @@ -183,19 +183,20 @@ function createLocalTrackFileCard(parentElement, id, browser){ fileInputElement.addEventListener('change', async e => { - const {files} = fileInputElement - const names = Array.from(files).map(({ name }) => name) + const names = Array.from(fileInputElement.files).map(({ name }) => name) if (names.length > 0) { - for (const name of names) { - const element = document.querySelector(`[data-filename="${ name }"]`) - if (null !== element) { - console.log(`Retrieved file named ${ element.innerText }`) + const listItemElement = document.querySelector(`[data-filename="${ name }"]`) + if (null !== listItemElement) { + console.log(`Retrieved file ${ name } is a local session file`) + listItemElement.style.backgroundColor = 'pink' + const inputElement = listItemElement.querySelector('input') + inputElement.checked = true + } else { + console.log(`Retrieved file ${ name } is NOT a local session file`) } } - - } })