coloriseur.html 3.39 KB
Newer Older
Sylvain Coulange's avatar
Sylvain Coulange committed
1
2
3
4
5
6
{% load static %}
<!DOCTYPE html>
<html>
<head>
    <title>Coloriseur phonographémique</title>
    <meta charset="utf-8">
7
    <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
8
    <link rel="stylesheet" type="text/css" href="{% static 'styles/kinephones_style_v2.css'%}">
Sylvain Coulange's avatar
Sylvain Coulange committed
9
    <link rel="stylesheet" type="text/css" href="{% static 'styles/styles.css'%}">
10
    <!-- <link rel="stylesheet" type="text/css" href="{% static 'styles/kinephones_style.css'%}"> -->
Sylvain Coulange's avatar
Sylvain Coulange committed
11
12
</head>
<body>
13
14
15
16
17
    {% include 'header.html' %}
    <h2>
            <span class="phon_k">C</span><span class="phon_o_maj">o</span><span class="phon_l">l</span><span class="phon_o_maj">o</span><span class="phon_r_maj">r</span><span class="phon_i">i</span><span class="phon_z">s</span><span class="phon_9">eu</span><span class="phon_r_maj">r</span>
            <span> </span><span class="phon_f">Ph</span><span class="phon_o_maj">o</span><span class="phon_n">n</span><span class="phon_o_maj">o</span><span class="phon_g">g</span><span class="phon_r_maj">r</span><span class="phon_a">a</span><span class="phon_f">ph</span><span class="phon_e">é</span><span class="phon_m">m</span><span class="phon_i">i</span><span class="phon_k">que</span>
    </h2>
Sylvain Coulange's avatar
Sylvain Coulange committed
18

Sylvain Coulange's avatar
Sylvain Coulange committed
19
20
21
22
23
    <div class="inputDiv">
        <form action="/app/" method="post">{% csrf_token %}
            <h2>Entrer du texte à coloriser :</h2>
            <textarea name="inText">{{ data.text }}</textarea><br/>
            <input type="submit" value="Coloriser"/>
Sylvain Coulange's avatar
Sylvain Coulange committed
24
            <button formaction="/app/0">Effacer</button>
Sylvain Coulange's avatar
Sylvain Coulange committed
25
26
27
        </form>
    </div>

28
    <div class="win-black outputMainDiv">
Sylvain Coulange's avatar
Sylvain Coulange committed
29
        <h2>Résultat :</h2>
30
31
32
        <p class="output">
            {% for token in data.pphh %}{% if token == "§" %}<br/>{% elif token in ",.)]}%>"|make_list %}<span class="phon_neutre">{{ token }}</span>{% else %} <span class="tokens" id='tok{{ forloop.counter }}' onclick="changeAlign(this.id)"></span>{% endif %}{% endfor %}
        </p>
33
34
    </div>

Sylvain Coulange's avatar
Sylvain Coulange committed
35
    <div>
36
        <form method="POST">{% csrf_token %}
Sylvain Coulange's avatar
Sylvain Coulange committed
37
38
39
40
            <button formaction="/app/dico/">Éditer le dictionnaire</button>
        </form>
    </div>

41
    {% include 'footer.html' %}
42

43
44
45
    <script type="text/javascript">
        var dicoTok = {
            {% for token in data.pphh %}
46
            {% if token != "§" %}
47
                'tok{{ forloop.counter }}' : [{% for trans in token %}'{% for entree in trans %}<span class="{{entree.phon}}">{{entree.graph}}</span>{% endfor %}',{% endfor %}],
48
            {% endif %}
49
50
51
52
53
            {% endfor %}
        };

        var dicoId = {
            {% for token in data.pphh %}
54
            {% if token != "§" %}
55
                'tok{{ forloop.counter }}' : 0, 
56
            {% endif %}
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
            {% endfor %}
        }

        var tokens = document.getElementsByClassName("tokens");
        var i;
        for (i = 0; i < tokens.length; i++) {
            tokens[i].innerHTML = dicoTok[tokens[i].id][0];
            if (dicoTok[tokens[i].id].length > 1) {
                $('#'+tokens[i].id).addClass('transMult');
            };
        };

        

        function changeAlign(tok) {
            //console.log(tok);
            if (dicoId[tok] == dicoTok[tok].length-1) {
                dicoId[tok] = 0;
            } else {
                dicoId[tok] += 1;
            };
            //console.log(dicoId[tok]);
            document.getElementById(tok).innerHTML = dicoTok[tok][dicoId[tok]];

        };
    </script>


Sylvain Coulange's avatar
Sylvain Coulange committed
85
86
</body>
</html>