templates/learn/dictionary.html.twig line 1

  1. {% extends 'base.html.twig' %}
  2. {% block title %}HYPA - Apprendre{% endblock %}
  3. {% block stylesheets %}
  4.     <link rel="stylesheet" href="{{ asset("css/reset.css") }}">
  5.     <link rel="stylesheet" href="{{ asset("css/learn/dictionary.css") }}">
  6.     <style>
  7.         html {
  8.             font-family: HanMufa,sans-serif;
  9.         }
  10.         .character {
  11.             font-family: KaiTi,sans-serif;
  12.         }
  13.     </style>
  14. {% endblock %}
  15. {% block javascripts %}
  16.     <script>
  17.         document.addEventListener('DOMContentLoaded', principale);
  18.         function principale() {
  19.             console.log('js comportements chargĂ©');
  20.             const playsoundButtons = document.querySelectorAll(".playsound")
  21.             playsoundButtons.forEach(button=>{
  22.                 button.addEventListener('click',playsound)
  23.             })
  24.             let semaphore = 1;
  25.             function resetSemaphore(){
  26.                 semaphore=1
  27.             }
  28.             function playsound(evt){
  29.                 if(semaphore) {
  30.                     semaphore=0
  31.                     let audio = new Audio(evt.currentTarget.id);
  32.                     audio.play();
  33.                     audio.addEventListener('ended',resetSemaphore)
  34.                 }
  35.             }
  36.         }
  37.     </script>
  38.     <script src="{{ asset("js/svg.js") }}"></script>
  39. {% endblock %}
  40. {% block body %}
  41.     <header>
  42.         <a href="{{ path("app_menu") }}" id="menu"><img src="{{ asset("images/nav_indicators/learn.png") }}" alt=""></a>
  43.         <h1>HYPA - Dictionnaire</h1>
  44.         <a href="{{ path("app_learn") }}">back to learn</a>
  45.     </header>
  46.     <section>
  47.         <table>
  48.             <tr>
  49.                 <td class="attribute">Character</td>
  50.                 <td class="attribute">Traceme</td>
  51.                 <td class="attribute">Path</td>
  52.                 <td class="attribute">HYPA</td>
  53.                 <td class="attribute">Radical</td>
  54.                 <td class="attribute">Listen</td>
  55.                 <td class="attribute">Course</td>
  56.             </tr>
  57.             {% for character in characters %}
  58.                 <tr  class="element">
  59.                     <td class="attribute character">{{ character.character }}</td>
  60.                     <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>
  61.                     <td class="attribute shortcutPath">
  62.                         <table class="shortcutPathTable">
  63.                             <tr>
  64.                                 {% for num in character.shortcutPath|split('') %}
  65.                                     <td><span class="number" id="number{{ num }}">{{ num }}</span></td>
  66.                                     {% if not loop.index % 2 and not loop.last %}
  67.                                         <td><span>|</span></td>
  68.                                     {% endif %}
  69.                                 {% endfor %}
  70.                             </tr>
  71.                             <tr>
  72.                                 {% if character.shortcutPath|split('')|length > 0 %}
  73.                                     <td colspan="2" class="pathDescriptor"><span>CPI</span></td>
  74.                                     <td></td>
  75.                                 {% endif %}
  76.                                 {% if character.shortcutPath|split('')|length > 2 %}
  77.                                     <td colspan="2" class="pathDescriptor"><span>CPF</span></td>
  78.                                     <td></td>
  79.                                 {% endif %}
  80.                                 {% if character.shortcutPath|split('')|length > 4 %}
  81.                                     <td colspan="2" class="pathDescriptor"><span>CLE</span></td>
  82.                                     <td></td>
  83.                                 {% endif %}
  84.                                 {% if character.shortcutPath|split('')|length > 6 %}
  85.                                     <td><span></span></td>
  86.                                 {% endif %}
  87.                             </tr>
  88.                         </table>
  89.                     </td>
  90.                     <td class="attribute">{{ character.hypa }}</td>
  91. {#                    <td class="attribute character">{{ character.tones }}</td>#}
  92.                     <td class="attribute character">{{ character.fzRadicalValue }}</td>
  93.                     <td class="attribute">
  94.                         {% if character.course %}
  95.                             {% if character.rcc %}
  96.                                     <button class="playsound" id="{{ asset("dictionary/sound/"~character.course.title~"_sons/"~character.rcc.shortcutPath~".m4a") }}">sound</button>
  97.                                 {% else %}
  98.                             {#                            <audio controls controlsList="nodownload" src="{{ asset("dictionary/sound/"~character.course.title~"_sons/"~character.shortcutPath~".m4a") }}">#}
  99.                                     <button class="playsound" id="{{ asset("dictionary/sound/"~character.course.title~"_sons/"~character.shortcutPath~".m4a") }}">sound</button>
  100.                             {#                            </audio>#}
  101.                                 {% endif %}
  102.                         {% elseif character.origin %}
  103.                             {% if character.origin.course %}
  104.                                 <button class="playsound" id="{{ asset("dictionary/sound/"~character.origin.course.title~"_sons/"~character.shortcutPath~".m4a") }}">sound</button>
  105.                             {% endif %}
  106.                         {% endif %}
  107.                     </td>
  108.                     {% if character.course %}
  109.                         <td class="attribute"><a href="{{ path("app_course_view",{"page": character.placeInCourse, "course": character.course.courseId}) }}">{{ character.course.courseId }}</a></td>
  110.                     {% elseif character.origin %}
  111.                         {% if character.origin.course %}
  112.                             <td class="attribute"><a href="{{ path("app_course_view",{"page": character.origin.placeInCourse, "course": character.origin.course.courseId}) }}">{{ character.origin.course.courseId }}</a></td>
  113.                         {% endif %}
  114.                     {% else %}
  115.                         <td class="attribute"></td>
  116.                     {% endif %}
  117.                 </tr>
  118.             {% endfor %}
  119.         </table>
  120.     </section>
  121.     <section id="page_buttons_container">
  122.         {% if course is defined %}
  123.             {% if page > 1 %}
  124.                 <a href="{{ path("app_course",{"page": page - 1, "course": course}) }}" class="page_button"> << </a>
  125.             {% endif %}
  126.             {% if page < nbpages %}
  127.                 <a href="{{ path("app_course",{"page": page + 1, "course": course}) }}" class="page_button"> >> </a>
  128.             {% endif %}
  129.         {% else %}
  130.             {% if page > 1 %}
  131.                 <a href="{{ path("app_dictionary",{"page": page - 1}) }}" class="page_button"> << </a>
  132.             {% endif %}
  133.             {% if page < nbpages %}
  134.                 <a href="{{ path("app_dictionary",{"page": page + 1}) }}" class="page_button"> >> </a>
  135.             {% endif %}
  136.         {% endif %}
  137.     </section>
  138. {% endblock %}