-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
139 lines (118 loc) · 4.14 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!--
/*
* This file is part of Kabyle Keyboard Game. See COPYING.md for license details.
*
* @author Nabil SEMAOUNE <[email protected]>
* @copyright Nabil SEMAOUNE
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL v3)
*/
-->
<!DOCTYPE html>
<html lang="kab">
<head>
<meta charset="UTF-8">
<title>Urar s unasiw</title>
<meta name="description" content="Urar s unasiw akken ad tissineḍ akk isekkilen n Teqbaylit" />
<meta name="keywords" content="anasiw, taqbaylit, tamaziɣt, isekkilen, agemmay, urar" />
<script type="text/javascript" src="jquery/jquery-3.3.1.min.js"></script>
<link type="text/css" rel="stylesheet" href="css/style.css">
</head>
<body>
<canvas id="canvas" style="display: none;">Nesḥassef, canvas ur as-yezmir ara yiminig-a.</canvas>
<div class="content">
<span class="letter a">A</span>
<span class="letter ɛ">Ɛ</span>
<span class="letter b">B</span>
<span class="letter c">C</span>
<span class="letter č">Č</span>
<span class="letter d">D</span>
<span class="letter ḍ">Ḍ</span>
<span class="letter e">E</span>
<span class="letter f">F</span>
<span class="letter g">G</span>
<span class="letter ǧ">Ǧ</span>
<span class="letter h">H</span>
<span class="letter ḥ">Ḥ</span>
<span class="letter i">I</span>
<span class="letter j">J</span>
<span class="letter k">K</span>
<span class="letter l">L</span>
<span class="letter m">M</span>
<span class="letter n">N</span>
<span class="letter o">O</span>
<span class="letter p">P</span>
<span class="letter ɣ">Ɣ</span>
<span class="letter q">Q</span>
<span class="letter r">R</span>
<span class="letter ṛ">Ṛ</span>
<span class="letter s">S</span>
<span class="letter ṣ">Ṣ</span>
<span class="letter t">T</span>
<span class="letter ṭ">Ṭ</span>
<span class="letter u">U</span>
<span class="letter v">V</span>
<span class="letter w">W</span>
<span class="letter x">X</span>
<span class="letter y">Y</span>
<span class="letter z">Z</span>
<span class="letter ẓ">Ẓ</span>
</div>
<div id="timer">00:00</div>
<script type="text/javascript">
$(function() {
var time = 0, timer = null;
var letters = [], index = 0;
var startTimer = function() {
timer = setInterval(function() {
time++;
var min = Math.floor(time / 60);
var sec = time % 60;
$('#timer').text((min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec));
}, 1000);
};
var stopTimer = function() {
time = 0;
if (timer) {
clearInterval(timer);
}
$('#timer').text('00:00');
};
var congratulate = function() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = '#ffffff';
ctx.textAlign = 'center';
ctx.font = '20px DejaVuSansMono';
ctx.fillText('BRAVO! TEFRIḌ-TT DEG ' + $('#timer').text() + '.', window.innerWidth / 2, 200);
stopTimer();
$('#canvas').css('display', 'block');
};
$(document).keyup(function(e) {
if (e.key === 'Escape') {
letters = [];
index = 0;
$('.letter').css('color', '#BD33A4');
$('#canvas').css('display', 'none');
stopTimer();
startTimer();
}
});
$(document).keypress(function(e) {
var letter = e.key.toLowerCase();
if (! letter.match(/[a-zɛčḍǧḥɣṛṣṭẓ]/i)) {
return;
}
if (! letters.includes(letter)) {
letters[index++] = letter;
$('.' + letter).css('color', 'red');
if (letters.length === 36) {
setTimeout(congratulate, 1000);
}
}
});
startTimer();
fireworksLoop(); // Run hidden fireworks.
});
</script>
<script type="text/javascript" src="js/fireworks.js"></script>
</body>
</html>