templates/learn/dictionary.html.twig line 1
{% extends 'base.html.twig' %}
{% block title %}HYPA - Apprendre{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset("css/reset.css") }}">
<link rel="stylesheet" href="{{ asset("css/learn/dictionary.css") }}">
<style>
html {
font-family: HanMufa,sans-serif;
}
.character {
font-family: KaiTi,sans-serif;
}
</style>
{% endblock %}
{% block javascripts %}
<script>
document.addEventListener('DOMContentLoaded', principale);
function principale() {
console.log('js comportements chargé');
const playsoundButtons = document.querySelectorAll(".playsound")
playsoundButtons.forEach(button=>{
button.addEventListener('click',playsound)
})
let semaphore = 1;
function resetSemaphore(){
semaphore=1
}
function playsound(evt){
if(semaphore) {
semaphore=0
let audio = new Audio(evt.currentTarget.id);
audio.play();
audio.addEventListener('ended',resetSemaphore)
}
}
}
</script>
<script src="{{ asset("js/svg.js") }}"></script>
{% endblock %}
{% block body %}
<header>
<a href="{{ path("app_menu") }}" id="menu"><img src="{{ asset("images/nav_indicators/learn.png") }}" alt=""></a>
<h1>HYPA - Dictionnaire</h1>
<a href="{{ path("app_learn") }}">back to learn</a>
</header>
<section>
<table>
<tr>
<td class="attribute">Character</td>
<td class="attribute">Traceme</td>
<td class="attribute">Path</td>
<td class="attribute">HYPA</td>
<td class="attribute">Radical</td>
<td class="attribute">Listen</td>
<td class="attribute">Course</td>
</tr>
{% for character in characters %}
<tr class="element">
<td class="attribute character">{{ character.character }}</td>
<td class="attribute svg_container"><img src="{{ asset("traceme_generator/svg/"~character.shortcutPath~"5.svg") }}" alt="" onload="SVGInject(this)" viewBox="0 0 500 500" class="svg"/></td>
<td class="attribute shortcutPath">
<table class="shortcutPathTable">
<tr>
{% for num in character.shortcutPath|split('') %}
<td><span class="number" id="number{{ num }}">{{ num }}</span></td>
{% if not loop.index % 2 and not loop.last %}
<td><span>|</span></td>
{% endif %}
{% endfor %}
</tr>
<tr>
{% if character.shortcutPath|split('')|length > 0 %}
<td colspan="2" class="pathDescriptor"><span>CPI</span></td>
<td></td>
{% endif %}
{% if character.shortcutPath|split('')|length > 2 %}
<td colspan="2" class="pathDescriptor"><span>CPF</span></td>
<td></td>
{% endif %}
{% if character.shortcutPath|split('')|length > 4 %}
<td colspan="2" class="pathDescriptor"><span>CLE</span></td>
<td></td>
{% endif %}
{% if character.shortcutPath|split('')|length > 6 %}
<td><span></span></td>
{% endif %}
</tr>
</table>
</td>
<td class="attribute">{{ character.hypa }}</td>
{# <td class="attribute character">{{ character.tones }}</td>#}
<td class="attribute character">{{ character.fzRadicalValue }}</td>
<td class="attribute">
{% if character.course %}
{% if character.rcc %}
<button class="playsound" id="{{ asset("dictionary/sound/"~character.course.title~"_sons/"~character.rcc.shortcutPath~".m4a") }}">sound</button>
{% else %}
{# <audio controls controlsList="nodownload" src="{{ asset("dictionary/sound/"~character.course.title~"_sons/"~character.shortcutPath~".m4a") }}">#}
<button class="playsound" id="{{ asset("dictionary/sound/"~character.course.title~"_sons/"~character.shortcutPath~".m4a") }}">sound</button>
{# </audio>#}
{% endif %}
{% elseif character.origin %}
{% if character.origin.course %}
<button class="playsound" id="{{ asset("dictionary/sound/"~character.origin.course.title~"_sons/"~character.shortcutPath~".m4a") }}">sound</button>
{% endif %}
{% endif %}
</td>
{% if character.course %}
<td class="attribute"><a href="{{ path("app_course_view",{"page": character.placeInCourse, "course": character.course.courseId}) }}">{{ character.course.courseId }}</a></td>
{% elseif character.origin %}
{% if character.origin.course %}
<td class="attribute"><a href="{{ path("app_course_view",{"page": character.origin.placeInCourse, "course": character.origin.course.courseId}) }}">{{ character.origin.course.courseId }}</a></td>
{% endif %}
{% else %}
<td class="attribute"></td>
{% endif %}
</tr>
{% endfor %}
</table>
</section>
<section id="page_buttons_container">
{% if course is defined %}
{% if page > 1 %}
<a href="{{ path("app_course",{"page": page - 1, "course": course}) }}" class="page_button"> << </a>
{% endif %}
{% if page < nbpages %}
<a href="{{ path("app_course",{"page": page + 1, "course": course}) }}" class="page_button"> >> </a>
{% endif %}
{% else %}
{% if page > 1 %}
<a href="{{ path("app_dictionary",{"page": page - 1}) }}" class="page_button"> << </a>
{% endif %}
{% if page < nbpages %}
<a href="{{ path("app_dictionary",{"page": page + 1}) }}" class="page_button"> >> </a>
{% endif %}
{% endif %}
</section>
{% endblock %}