|
@@ -1,63 +0,0 @@
|
1
|
|
-<strong>Fails / Requêtes :</strong> <span id="fail">0</span>/<span id="tries">0</span><br />
|
2
|
|
-Délai entre deux requêtes : <input type="text" id="ms" maxlength="4" style="width:40px" value="1" />ms <input type="submit" id="go" value="Go!" /><br />
|
3
|
|
-<p>Fail si :
|
4
|
|
- <ul>
|
5
|
|
- <li>Noms de catégories identiques</li>
|
6
|
|
- <li>Une (au moins) catégorie vide</li>
|
7
|
|
- <li>Pas assez de questions</li>
|
8
|
|
- <li>Pas assez de thèmes</li>
|
9
|
|
- </ul>
|
10
|
|
-</p>
|
11
|
|
-
|
12
|
|
-<script src="js/jquery-2.1.4.min.js"></script>
|
13
|
|
-<script>
|
14
|
|
-var tries = 0;
|
15
|
|
-var fail = 0;
|
16
|
|
-var goon = false;
|
17
|
|
-var delay = 1;
|
18
|
|
-
|
19
|
|
-function yolo() {
|
20
|
|
- tries++;
|
21
|
|
- $.ajax({
|
22
|
|
- async: false,
|
23
|
|
- url: './api/',
|
24
|
|
- dataType: 'json',
|
25
|
|
- success: function(json) {
|
26
|
|
- var questions = 0;
|
27
|
|
- var themes = json.cat1.themes.length + json.cat2.themes.length;
|
28
|
|
- json.cat1.themes.forEach(function(theme) {
|
29
|
|
- question += theme.questions.length;
|
30
|
|
- });
|
31
|
|
- json.cat2.themes.forEach(function(theme) {
|
32
|
|
- question += theme.questions.length;
|
33
|
|
- });
|
34
|
|
- if(json.cat1.nom_cat === json.cat2.nom_cat || json.cat1.nom_cat === "" || json.cat2.nom_cat === ""
|
35
|
|
- || questions < 2*2*3 || themes < 2*2) {
|
36
|
|
- fail++;
|
37
|
|
- }
|
38
|
|
- }
|
39
|
|
- })
|
40
|
|
-
|
41
|
|
- $("#fail").html(fail);
|
42
|
|
- $("#tries").html(tries);
|
43
|
|
- if(goon) window.setTimeout(yolo, delay);
|
44
|
|
-}
|
45
|
|
-
|
46
|
|
-$("#go").on("click", function() {
|
47
|
|
- if(!goon) $("#go").val("Stop!");
|
48
|
|
- if(goon) $("#go").val("Go!");
|
49
|
|
- delay = $("#ms").val()
|
50
|
|
- goon = !goon;
|
51
|
|
- yolo();
|
52
|
|
-});
|
53
|
|
-
|
54
|
|
-$(document).on("keypress", function(event) {
|
55
|
|
- if(event.which === 32) {
|
56
|
|
- if(!goon) $("#go").val("Stop!");
|
57
|
|
- if(goon) $("#go").val("Go!");
|
58
|
|
- delay = $("#ms").val()
|
59
|
|
- goon = !goon;
|
60
|
|
- yolo();
|
61
|
|
- }
|
62
|
|
-});
|
63
|
|
-</script>
|