Added support for replay on click
This commit is contained in:
parent
060e9d2969
commit
6ade74df7e
@ -68,7 +68,7 @@ fn render_dialog_block(block: &DialogBlock<Parameter>) -> Markup {
|
|||||||
convert(block.lines.iter().map(|l| l.text.as_ref()), &mut content);
|
convert(block.lines.iter().map(|l| l.text.as_ref()), &mut content);
|
||||||
|
|
||||||
html! {
|
html! {
|
||||||
fieldset .visual-novel-box {
|
fieldset .visual-novel-box onclick="playCurrentAudio()" {
|
||||||
@if !block.name.is_empty() {
|
@if !block.name.is_empty() {
|
||||||
legend .character-name { (block.name) }
|
legend .character-name { (block.name) }
|
||||||
}
|
}
|
||||||
@ -359,9 +359,9 @@ fn interactive_script(total_sections: usize, base_path: &str) -> Markup {
|
|||||||
|
|
||||||
let currentAudio = null;
|
let currentAudio = null;
|
||||||
|
|
||||||
function playSectionAudio(index) {{
|
function playCurrentAudio() {{
|
||||||
const section = document.querySelector(
|
const section = document.querySelector(
|
||||||
`.selection-section[data-section-index="${{index}}"]`
|
`.selection-section[data-section-index="${{currentScene}}"]`
|
||||||
);
|
);
|
||||||
const audioElement = section?.querySelector('audio');
|
const audioElement = section?.querySelector('audio');
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ fn interactive_script(total_sections: usize, base_path: &str) -> Markup {
|
|||||||
document.getElementById('section-counter').textContent =
|
document.getElementById('section-counter').textContent =
|
||||||
`${{currentScene + 1}}/${{totalSections}}`;
|
`${{currentScene + 1}}/${{totalSections}}`;
|
||||||
|
|
||||||
if (currentScene + 1 < totalSections) playSectionAudio(currentScene);
|
if (currentScene + 1 < totalSections) playCurrentAudio();
|
||||||
}}
|
}}
|
||||||
|
|
||||||
function prev() {{
|
function prev() {{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user