Mercurial Hosting > lang
diff src/site.js @ 74:64e35a92d163
add translation
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 28 Aug 2025 13:31:46 -0600 |
parents | 60ebb333b40c |
children |
line wrap: on
line diff
--- a/src/site.js Thu Aug 28 05:16:32 2025 -0600 +++ b/src/site.js Thu Aug 28 13:31:46 2025 -0600 @@ -151,6 +151,15 @@ } } +function textContent(div) { + mdDiv.innerHTML = div.innerHTML; + let rts = mdDiv.querySelectorAll('rt'); + for( let rt of rts ) { + rt.remove(); + } + return mdDiv.textContent; +} + function handleMarkdown(voice,instructions) { let converter = window.markdownit(); let divs = document.querySelectorAll('[markdown]'); @@ -160,13 +169,7 @@ div.removeAttribute('markdown'); let parent = div.parentNode; if( parent.getAttribute('role')==='assistant' ) { - mdDiv.innerHTML = div.innerHTML; - let rts = mdDiv.querySelectorAll('rt'); - for( let rt of rts ) { - rt.remove(); - } - //console.log(mdDiv.textContent); - parent.querySelector('audio').src = `/tts.wav?voice=${voice}&instructions=${encodeURIComponent(instructions)}&text=${encodeURIComponent(mdDiv.textContent)}`; + parent.querySelector('audio').src = `/tts.wav?voice=${voice}&instructions=${encodeURIComponent(instructions)}&text=${encodeURIComponent(textContent(div))}`; } } }