From 2f6a213e6d8d2e8e06580de70998d86e2416ce41 Mon Sep 17 00:00:00 2001 From: "matth@ultra" Date: Sun, 1 Sep 2024 23:46:58 +0200 Subject: [PATCH] add no files --- src/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index b6ca9b7..8670d64 100644 --- a/src/index.js +++ b/src/index.js @@ -6,6 +6,7 @@ const mappings = new Map(JSON.parse(localStorage.getItem('mappings')) || []); let statusLine = document.getElementById('status'); // store for when done with sorting TODO display let splash = document.getElementById('current-file').innerHTML; +let noFiles = document.getElementById('file-list').innerHTML; let history = []; @@ -87,6 +88,10 @@ function renderMoveButtons() { function renderFileList() { const fileListDiv = document.getElementById('file-list'); + if (fileList.length == 0) { + fileListDiv.innerHTML = noFiles; + return; + } fileListDiv.innerHTML = ''; fileList.forEach(file => { const p = document.createElement('p'); @@ -95,7 +100,7 @@ function renderFileList() { classes += " selected-file-list-item"; } p.setAttribute("class", classes) - p.innerHTML = file; + p.textContent = file; fileListDiv.appendChild(p); }); }