diff --git a/js/app.js b/js/app.js index 6ad9680..1b8d899 100644 --- a/js/app.js +++ b/js/app.js @@ -233,11 +233,6 @@ async function initializationHelper(browser, container, options) { const trackLoader = async configurations => { try { - // Add "searchable" attribute to non-indexed annotation tracks - for(let c of configurations) { - - - } await browser.loadTrackList(configurations) } catch (e) { console.error(e) diff --git a/js/sessionUtils.js b/js/sessionUtils.js index 10e737f..127dc12 100644 --- a/js/sessionUtils.js +++ b/js/sessionUtils.js @@ -166,10 +166,20 @@ function createLocalTrackFileCard(parentElement, id, browser){ fileInput.click() }) - cardElement.querySelector(`#${ id }-load-tracks`).addEventListener('click', e => { - console.log('Load Files') + cardElement.querySelector(`#${ id }-load-tracks`).addEventListener('click', async e => { + + const configurations = [] + for (const config of Object.values(sessionLocalTrackFilesDictionary)) { + if (config.url) { + configurations.push(config) + } + } + if (configurations.length > 0) { + await browser.loadTrackList(configurations) + } cardElement.style.left = '-1000px' cardElement.style.top = '-1000px' + }) makeDraggable(cardElement, cardElement.querySelector('.card-header'), undefined) @@ -182,15 +192,20 @@ function createLocalTrackFileCard(parentElement, id, browser){ fileInputElement.addEventListener('change', async e => { const names = Array.from(fileInputElement.files).map(({ name }) => name) + const files = Array.from(fileInputElement.files) - if (names.length > 0) { - for (const name of names) { - const listItemElement = document.querySelector(`[data-filename="${ name }"]`) + if (files.length > 0) { + for (const file of files) { + const listItemElement = document.querySelector(`[data-filename="${ file.name }"]`) if (null !== listItemElement) { const inputElement = listItemElement.querySelector('input') inputElement.disabled = false inputElement.checked = true listItemElement.style.backgroundColor = '#007bff1c' + + sessionLocalTrackFilesDictionary[ file.name ].url = file + + cardElement.querySelector(`#${ id }-load-tracks`).disabled = false } else { console.log(`Retrieved file ${ name } is NOT a local session file`) }