Skip to content

Commit

Permalink
try to fix firefox android speech synthesis
Browse files Browse the repository at this point in the history
  • Loading branch information
eyaler committed Nov 10, 2024
1 parent 3629e19 commit 63a673d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
6 changes: 3 additions & 3 deletions resen/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
const p = document.createElement('p')
let span = document.createElement('span')
//span.appendChild(make_link('https://www.facebook.com/events/1191766252206270', 'אירוע השקה 30/4'))
span.appendChild(make_link('https://cda.org.il/events/who-comes-after-us/', 'אירוע השקה 21/11'))
span.appendChild(make_link('https://cda.org.il/events/who-comes-after-us/', 'אירוע השקה לגיליון קמעות 21/11'))
p.appendChild(span)
//span = document.createElement('span')
span = document.createElement('span')
//span.appendChild(make_link(page2url('open-call-kmeot'), 'קול קורא - קמעות'))
//p.appendChild(span)
p.appendChild(span)
p.classList.add('preface_he', 'banner')
document.querySelector('.author').before(p)
make_contents()
Expand Down
6 changes: 3 additions & 3 deletions resen/kaddish/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preload" href="../fonts/MiriamLibre-Regular.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="../fonts/DavidLibre-Medium.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="fonts/FtPilKahol2.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="fonts/OHSagiIdan-Regular.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="../style.css">
<link rel="stylesheet" href="style.css">
<script src="../pages.js"></script>
Expand All @@ -16,7 +16,7 @@
</head>
<body onload="document.body.style.visibility = 'visible'">
<script>make_header()</script>
<svg viewBox="-42.56683 -44.513535 295.01041 386.02707">
<svg class="mobile_wide" viewBox="-42.56683 -44.513535 295.01041 386.02707">
<image href="media/kaddish1.jpg" x="-42.56683" y="-44.513535" />
<g>
<text x="197.49046"
Expand Down Expand Up @@ -258,7 +258,7 @@
y="257.43958" />
</g></svg>

<svg viewBox="-43.49287 -43.984375 296.86249 384.96875">
<svg class="mobile_wide" viewBox="-43.49287 -43.984375 296.86249 384.96875">
<image href="media/kaddish2.jpg" x="-43.49287" y="-43.984375" />
<g>
<text
Expand Down
10 changes: 10 additions & 0 deletions resen/kaddish/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,21 @@ document.addEventListener('keydown', event => {
event.preventDefault()
})

let voices = speechSynthesis.getVoices()
if (!voices.length)
speechSynthesis.addEventListener('voiceschanged', () => voices = speechSynthesis.getVoices())

play.addEventListener('click', event => {
if (play.classList.toggle('on')) {
const utter = new SpeechSynthesisUtterance([...prefix_chars, ...document.querySelectorAll('svg text:not(:empty):not(.blink)')].map((e, i) => (e.textContent ?? e) + nikud_pisuk[i]).join(''))
console.log(utter.text)
utter.lang = 'he'
const voice = voices.find(v => v.lang.startsWith('he') || v.lang.startsWith('iw'))
if (voice) {
console.log(voice)
utter.voice = voice
utter.lang = voice.lang
}
utter.rate = .6
utter.onend = e => {if (e.charIndex && e.charIndex % utter.text.length == 0) play.click()}
speechSynthesis.speak(utter)
Expand Down
8 changes: 5 additions & 3 deletions resen/kaddish/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ g {
}

text {
font-family: ktiv;
text-anchor: end;
dominant-baseline: hanging;
font-size: .45rem;
fill: #c13a16;
font-family: ktiv;
font-size: .45rem;
scroll-margin-top: min(25rem, 50vh);
text-anchor: end;
user-select: none;
-webkit-user-select: none;
}

@keyframes blink {
Expand Down
2 changes: 1 addition & 1 deletion resen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ video::-webkit-media-controls-enclosure { /* Not supported in Firefox */
margin-inline-start: 0;
}

object {
object, .mobile_wide {
margin-inline: var(--anti_margin);
--media_width: auto;
}
Expand Down

0 comments on commit 63a673d

Please sign in to comment.