Gitlab CSE Unil

pasapas.html 13 KB
Newer Older
M. Chardon's avatar
M. Chardon committed
1
2
3
4
5
6
7
8
<!DOCTYPE html>
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>@lea</title>
        <meta name="author" content="Marion CHARDON for ESC/RISET - University of Lausanne" />
        <meta name="description" content="Free Web tool for guess data" />
        <meta name="keywords" content="Cipher, Bigdata, Guess" />
        <meta charset="UTF-8" />
M. Chardon's avatar
M. Chardon committed
9
10
11
12
        <link rel="stylesheet" href="../node_modules/bootstrap3/dist/css/bootstrap.min.css" /> 
        <link rel="stylesheet" href="css/dashboard.css" />
        <link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css" />
        <link rel="stylesheet" href="../css/logo_unil.css" />
M. Chardon's avatar
M. Chardon committed
13
        <link rel="stylesheet" href="../css/main.css" />
M. Chardon's avatar
M. Chardon committed
14
15
        <script src="../node_modules/jquery/dist/jquery.min.js"></script>
        <script src="../node_modules/bootstrap3/dist/js/bootstrap.min.js"></script>
M. Chardon's avatar
M. Chardon committed
16
17
18
19
20
21
22
23
24
        <script src="js/crypto/asmcrypto.js"></script>
        <script src="js/controleur.js"></script>
        <script src="js/entities/global.js"></script>
        <script src="js/entities/modeleTwo.js"></script>
        <script src="js/entities/modeleThree.js"></script>
        <script src="js/entities/modeleFour.js"></script>
        <script src="js/entities/modeleMaskEight.js"></script>
        <script src="js/entities/resultat.js"></script>
        <script src="js/graph/d3.v4.min.js"></script>
M. Chardon's avatar
M. Chardon committed
25
26
27
28
29
30
31
32
33
        <script src="js/graph.js"></script>        
        <script src="../js/jquery.i18n/libs/CLDRPluralRuleParser/src/CLDRPluralRuleParser.js"></script>
        <script src="../js/jquery.i18n/jquery.i18n/src/jquery.i18n.js"></script>
        <script src="../js/jquery.i18n/jquery.i18n/src/jquery.i18n.messagestore.js"></script>
        <script src="../js/jquery.i18n/jquery.i18n/src/jquery.i18n.fallbacks.js"></script>
        <script src="../js/jquery.i18n/jquery.i18n/src/jquery.i18n.parser.js"></script>
        <script src="../js/jquery.i18n/jquery.i18n/src/jquery.i18n.emitter.js"></script>
        <script src="../js/jquery.i18n/jquery.i18n/src/jquery.i18n.language.js"></script>
        <script src="js/languages.js"></script>
M. Chardon's avatar
M. Chardon committed
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    </head>
    <body>
        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="../index.html"><img src="../img/g3761.png" alt="" style="height:28px;display: inline;"/>Cryptex - @lea</a>
                </div>
                <div id="navbar" class="navbar-collapse collapse">
                    <ul class="nav navbar-nav navbar-right">
M. Chardon's avatar
M. Chardon committed
49
50
                        <li><a onclick="initLang('en');"><img style="background: white; height:25px;" alt="English" src="../img/flags/english.png"/></a></li>
                        <li><a onclick="initLang('fr');"><img style="background: white;height:25px;" alt="Français" src="../img/flags/french.png"/></a></li>
M. Chardon's avatar
M. Chardon committed
51
                        <li><a href="#" data-toggle="modal" data-target="#help"><span class="i18n" data-lang="help"></span></a></li>
M. Chardon's avatar
M. Chardon committed
52
53
54
55
56
57
58
59
                    </ul>
                </div>
            </div>
        </nav>  
        <div class="container" style="margin-bottom: 70px; margin-top: 20px;">
            <div class="row">
                <div class="col-sm-3">
                    <ul class="nav nav-pills nav-stacked">
M. Chardon's avatar
M. Chardon committed
60
61
62
63
                        <li><a href="index.html"><span class="i18n" data-lang="step1"></span></a></li>
                        <li class="active"><a href="pasapas.html"><span class="i18n" data-lang="step2"></span></a></li>
                        <li><a href="understand.html"><span class="i18n" data-lang="step3"></span></a></li>
                        <li><a href="games.html"><span class="i18n" data-lang="step4"></span></a></li>
M. Chardon's avatar
M. Chardon committed
64
65
66
67
68
69
70
71
                    </ul>
                </div>
                <div class="col-sm-9" style="padding-left: 20px;">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="alert alert-info alert-dismissable">
                                <strong>Info!</strong>
                                <p>
M. Chardon's avatar
M. Chardon committed
72
                                    <span class="i18n" data-lang="step2_info"></span>
M. Chardon's avatar
M. Chardon committed
73
74
75
                                </p>
                            </div>

M. Chardon's avatar
M. Chardon committed
76
                            <span class="i18n" data-lang="step2_instru"></span>.
M. Chardon's avatar
M. Chardon committed
77
78
79
80
81
82
                            <div class="row" style="padding-bottom: 10px;padding-top: 10px;">
                                <div class="col-sm-10">
                                    <button class="btn btn-info btn-lg btnbre" onclick="insertVal(0);">0 [0]</button>
                                    <button class="btn btn-primary btn-lg btnbre" onclick="insertVal(1);">1 [1]</button>
                                </div>
                                <div class="col-sm-2">
M. Chardon's avatar
M. Chardon committed
83
                                    <button class="btn btn-default" onclick="reset();"><span class="i18n" data-lang="btn_reset"></span></button>
M. Chardon's avatar
M. Chardon committed
84
85
86
87
88
89
90
91
92
93
94
95
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12">
                                    <textarea class="form-control" readonly="readonly" id="userinput" style="font-size: large;"></textarea>
                                    <div id="userinputdiv"></div>
                                </div>
                            </div>
                            <div id='propositionPanel' style="display:none;">
                                <div class="row" style="margin-top: 20px;">
                                    <div class="col-sm-12">
                                        <ul>
M. Chardon's avatar
M. Chardon committed
96
97
                                            <li><span style="color:orange;"><span class="i18n" data-lang="orange_wrong"></span></span></li>
                                            <li><span style="color:blue;"><span class="i18n" data-lang="blue_right"></span></span></li>
M. Chardon's avatar
M. Chardon committed
98
99
                                        </ul>
                                        <div class="panel panel-default">
M. Chardon's avatar
M. Chardon committed
100
                                            <div class="panel-heading"><span class="i18n" data-lang="step2_next_ans"></span></div>
M. Chardon's avatar
M. Chardon committed
101
102
103
                                            <div class="panel-body">
                                                <div class="row">
                                                    <div class="col-sm-6">
M. Chardon's avatar
M. Chardon committed
104
                                                        <span class="i18n" data-lang="step2_proposed_value"></span>:
M. Chardon's avatar
M. Chardon committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
                                                        <input class="form-control" readonly="readonly" id="guessValue" />
                                                    </div>
                                                    <div class="col-sm-6">
                                                        <br/>
                                                        <button class="btn btn-info" onclick="valide(1);"><i class="fa fa-check" aria-hidden="true"></i> ok [o]</button>
                                                        <button class="btn btn-warning" onclick="valide(0);"><i class="fa fa-times" aria-hidden="true"></i> no [n]</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-sm-12">
                                        <div class="panel panel-primary">
M. Chardon's avatar
M. Chardon committed
120
                                            <div class="panel-heading"><span class="i18n" data-lang="perc_correct"></span></div>
M. Chardon's avatar
M. Chardon committed
121
122
123
                                            <div class="panel-body">
                                                <div class="row">
                                                    <div class="col-sm-6">
M. Chardon's avatar
M. Chardon committed
124
                                                        <span class="i18n" data-lang="tot_right"></span>:
M. Chardon's avatar
M. Chardon committed
125
126
127
                                                        <input class="form-control" readonly="readonly" id="guessValueCorrect" />
                                                    </div>
                                                    <div class="col-sm-6">
M. Chardon's avatar
M. Chardon committed
128
                                                        <span class="i18n" data-lang="10_res"></span>:
M. Chardon's avatar
M. Chardon committed
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
                                                        <input class="form-control" readonly="readonly" id="guessValueCorrect10" />
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>


        <div id="contacts" class="modal fade" role="dialog"></div>
        <div id="credits" class="modal fade" role="dialog"></div>
M. Chardon's avatar
M. Chardon committed
147
        <div id="help" class="modal fade" role="dialog"></div>
M. Chardon's avatar
M. Chardon committed
148
149
150
151
152
153
154
155
156
157
158
159
        <footer class="footer"></footer>

        <script>

            var controleur = new Controleur("pasapas");

            $(document).ready(function () {
                $('body').on('keydown', trigKeyDownInit);
            });

            function trigKeyDownInit(event) {
                event.preventDefault();
M. Chardon's avatar
M. Chardon committed
160
161
                //alert(event.which);
                if (event.which === 48 || event.which === 96) {
M. Chardon's avatar
M. Chardon committed
162
                    insertVal(0);
M. Chardon's avatar
M. Chardon committed
163
                } else if (event.which === 49 || event.which === 97) {
M. Chardon's avatar
M. Chardon committed
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
                    insertVal(1);
                }
            }

            function insertVal(val) {
                $("#userinput").val($("#userinput").val() + val);
                controleur.registerVal(val);
                var res = controleur.guestNextValue();
                if (res) {
                    $("#guessValue").val(res.valeur);
                    var controlelastValue = controleur.getControlelastValue();
                    if (controlelastValue !== null) {
                        if (controlelastValue > 0)
                            $('#userinputdiv').append('<span style="color:blue;">' + val + '</span> ');
                        else
                            $('#userinputdiv').append('<span style="color:orange;">' + val + '</span> ');
                    }
                }
                controleur.majIndices();
                if (controleur.suite.length === delaiRentention) {
                    $("#propositionPanel").show();
                    $(".btnbre").hide();
                    $("#userinput").hide();
                    $("#userinputdiv").html("");
                    for (var j = 0; j < controleur.suite.length; j++) {
                        $("#userinputdiv").append(controleur.suite[j] + " ");
                    }
                    $('body').off('keydown');
                    $('body').on('keydown', function (event) {
                        event.preventDefault();
                        if (event.which === 79) {
                            valide(1);
                        } else if (event.which === 78) {
                            valide(0);
                        }
                    });
                }
            }

            function valide(val) {
                var lastVal = parseInt($("#guessValue").val());
                if (val === 1) {
                    insertVal(lastVal);
                } else {
                    if (lastVal === 0) {
                        insertVal(1);
                    } else {
                        insertVal(0);
                    }
                }
            }

            function reset() {
                controleur.resetApi();
                $("input").each(function () {
                    $(this).val("");
                });
                $("textarea").each(function () {
                    $(this).val("");
                });
                $("#propositionPanel").hide();
                $(".btnbre").show();
                $("#userinput").show();
                $("#userinputdiv").html("");

                $('body').off('keydown');
                $('body').on('keydown', trigKeyDownInit);

                //$("#graphic").html("");
                //$("#lambda").val(0.95);
                //$("#taillemask").val(8);
                //$("#lambda").prop('disabled', false);
                //$("#taillemask").prop('disabled', false);
                //majIndices();
            }
        </script>

        <script src="../js/main.js"></script>

    </body>
</html>