diff --git a/src/index.html b/src/index.html index bc9c3dd..90c3fce 100644 --- a/src/index.html +++ b/src/index.html @@ -40,6 +40,9 @@ color: var(--text-light); /*font-weight: lighter;*/ } + .hidden { + display: none; + } #search_term { width: 100%; } diff --git a/src/js/main.ts b/src/js/main.ts index 47072bd..6003db8 100644 --- a/src/js/main.ts +++ b/src/js/main.ts @@ -135,7 +135,10 @@ async function loadDict() :Promise { } } +// we want to display annotations like `{f}` or `[comp.]` in different formatting const annotationRe = /\{[^}]+\}|\[[^\]]+\]/g +// words in angle brackets are common misspellings or other cross-references that should be hidden from view +const hideRe = /<.+?>/g // when the HTML page has finished loading: window.addEventListener('DOMContentLoaded', async () => { @@ -250,12 +253,15 @@ window.addEventListener('DOMContentLoaded', async () => { td0.innerHTML = td0.innerHTML.replaceAll(whatRe, '$&') // and apply special formatting to annotations: .replaceAll(annotationRe, '$&') + // and certain words should not be displayed at all: + .replaceAll(hideRe, '') tr.appendChild(td0) // right , English const td1 = document.createElement('td') td1.innerText = en.trim() td1.innerHTML = td1.innerHTML.replaceAll(whatRe, '$&') .replaceAll(annotationRe, '$&') + .replaceAll(hideRe, '') // the "feedback" button on each result if (!i && ENABLE_FEEDBACK) { const fbIcon = document.createElement('div')