From 921628ba6d251e5cd896c859f15a37c2f1696f5c Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Wed, 17 Nov 2021 13:10:44 +0000 Subject: [PATCH] Limit max length in download table (fixes #244) --- public/js/plugin-download.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/js/plugin-download.js b/public/js/plugin-download.js index a335e03..2346fe2 100644 --- a/public/js/plugin-download.js +++ b/public/js/plugin-download.js @@ -68,7 +68,12 @@ const buildTable = (chapters) => { $('table').append(thead); const rows = chapters.map(ch => { - const tds = Object.values(ch).map(v => `${v}`).join(''); + const tds = Object.values(ch).map(v => { + const maxLength = 40; + const shouldShrink = v.length > maxLength; + const content = shouldShrink ? `${v.substring(0, maxLength)}...
${v}
` : v; + return `${content}` + }).join(''); return `${tds}`; }); const tbody = `${rows}`;