-
Notifications
You must be signed in to change notification settings - Fork 11
/
theme.html
344 lines (311 loc) · 10.7 KB
/
theme.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<!DOCTYPE html>
<html lang="en">
<head>
<!-- ========== Meta Tags ========== -->
<meta charset="UTF-8" />
<meta name="description" content="TEDx NITKSurathkal" />
<meta
name="keywords"
content="TED, TEDx, TEDxNITKSurathkal, TEDx NITK, NITK, NITK Surathkal"
/>
<meta name="author" content="TEDx NITK Surathkal" />
<meta property="og:type" content="website" />
<meta
property="og:site_name"
content="TEDxNITKSurathkal | Ideas Worth Spreading"
/>
<meta
property="og:title"
content="TEDxNITKSurathkal | Ideas Worth Spreading"
/>
<meta
property="og:description"
content="TEDxNITKSurathkal is coming back for Edition 2023! See you on 6th October 2023."
/>
<meta property="og:url" content="http://www.tedxnitksurathkal.in/" />
<meta
property="og:image"
content="http://www.tedxnitksurathkal.in/assets/img/favicon.png"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
/>
<!-- ========== Title ========== -->
<title>Mosaic | TEDxNITKSurathkal</title>
<!-- ========== Favicon Ico ========== -->
<link rel="icon" href="assets/img/favicon.png" />
<!-- ========== STYLESHEETS ========== -->
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap"
rel="stylesheet"
/>
<!--- Bootstrap CSS -->
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD"
crossorigin="anonymous"
/>
<!-- 2022 Theme -->
<link rel="stylesheet" href="./assets/theme/css/style.css" />
</head>
<body>
<div class="modal" tabindex="-1" id="start-modal">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title fw-bold">INSTRUCTIONS</h2>
<button
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
<p>
1. Try to answer as many correct answers as possible
</p>
<!-- <p>
2. The faster you answer, the higher the points you
get
</p> -->
<p>2. You will lose 10 points for choosing the wrong answer</p>
<p>3. ENJOY :D</p>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-primary"
data-bs-dismiss="modal"
id="start-btn"
>
Start
</button>
</div>
</div>
</div>
</div>
<div id="end-modal" class="modal" style="display: none">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title fw-bold">CONGRATULATIONS !!!</h2>
<button
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div id="results-end" class="modal-body">
<p>Your score is: </p>
<p class="fs-1 text-center"><b id="points-end"></b></p>
<p>
Take a screenshot of this page, put it as your story on Instagram,
tag <b>@tedxnitksurathkal</b> and stand a chance to win exciting
goodies!!
</p>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-primary"
data-bs-dismiss="modal"
id="start-btn"
>
Proceed
</button>
</div>
</div>
</div>
</div>
<div class="container text-center" id="theme-reveal" style="display: none">
<img
src="assets/img/theme/hakuna.jpg"
style="padding: 50px 0"
/>
<div class="pt-3">
<p>
<em
>"In life's dance, let joy compose the rhythm, impulsiveness conduct the beat, and carefree moments choreograph a graceful masterpiece. Embrace the happiness of the unrehearsed, crafting a symphony of spontaneity on the canvas of existence."
</em
>
</p>
<p>
In life's dance, let joy compose the rhythm, impulsiveness conduct the beat, and carefree moments choreograph a graceful masterpiece. Embrace the happiness of the unrehearsed, crafting a symphony of spontaneity on the canvas of existence.
</p>
<!-- <p>
TEDxNITKSurathkal presents to you "Mind Matters." Join us on the 6th of October. Delve into the depths of the human mind with our diverse speakers as they share insights on mental health and psychology. Explore the intricate tapestry of your mind—a rich fabric woven with emotions and experiences. Join us as we unravel the complexities, understanding the significance of a sound mind in life's journey.
</p> -->
<a href="/" class="home-btn">Home</a>
<a href="/theme" class="home-btn">Play Again</a>
</div>
<img
src="assets/img/tedx-white.png"
height="80px;"
style="margin: 20px 0px"
/>
</div>
<div
class="container position-absolute top-50 start-50 translate-middle text-center"
id="reveal-game"
>
<h2 class="text-center pb-3">
Points: <span id="points" class="font-monospace">0</span>
</h2>
<div id="game-region"></div>
<div id="options" class="mt-3">
<div class="button rounded" id="button-1"></div>
<div class="button rounded" id="button-2"></div>
<div class="button rounded" id="button-3"></div>
<div class="button rounded" id="button-4"></div>
</div>
</div>
<style>
#game-region {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 40vh;
}
</style>
<!-- ========== SCRIPTS ========== -->
<!-- Bootstrap and jQuery CDN -->
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
crossorigin="anonymous"
></script>
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"
></script>
<!-- 2023 Theme -->
<script src="./assets/theme/main.js" type="module"></script>
<script src="https://unpkg.com/konva@8/konva.min.js"></script>
<!-- GTAG Script -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=UA-110715968-3"
></script>
<script type="module">
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-110715968-3');
import * as themeScript from './assets/theme/main.js';
const startModal = new bootstrap.Modal(
document.querySelector('#start-modal')
);
let endModal = new bootstrap.Modal(document.querySelector('#end-modal'));
let interval;
let imgInterval;
let round = 0;
let pixelSize = 51;
let points = 0;
let stage;
$(window).on('load', function () {
$('.loader').delay(100).fadeOut('slow');
startModal.show();
});
document
.querySelector('#start-modal')
.addEventListener('hide.bs.modal', e => {
startTimer();
startGame();
});
document
.querySelector('#end-modal')
.addEventListener('hide.bs.modal', e => {
document.querySelector('#reveal-game').style.display = 'none';
document.querySelector('#theme-reveal').style.display = 'block';
});
function startTimer() {
interval = setInterval(() => {
let pointsSpan = document.getElementById('points');
pointsSpan.innerHTML = points;
}, 100);
}
function generateNumber() {
return 1 + Math.floor(Math.random() * 4);
}
function startGame() {
let num = generateNumber();
loadImage(round, num);
loadOptions(round, num);
}
function nextRound() {
points += pixelSize;
clearInterval(imgInterval);
round += 1;
if (round === 6) {
document.querySelector('#points-end').innerHTML = points;
endModal.show();
} else {
stage.destroy();
startGame();
}
}
function wrongAnswer() {
points -= 10;
}
function loadImage(round, num) {
pixelSize = 51;
stage = new Konva.Stage({
container: 'game-region',
width: 350,
height: 280,
});
let layer = new Konva.Layer();
stage.add(layer);
Konva.Image.fromURL(
`./assets/theme/images/${themeScript.CODE[round]}/${num}.png`,
function (pic) {
layer.destroyChildren();
pic.position({
x: 0,
y: 0,
});
pic.cache();
// pic.filters([Konva.Filters.Pixelate]);
// pic.pixelSize(pixelSize);
layer.add(pic);
// imgInterval = setInterval(() => {
// pic.pixelSize(pixelSize);
// layer.batchDraw();
// pixelSize -= 1;
// if (pixelSize === 0) {
// pixelSize = 1;
// }
// }, 100);
}
);
}
function loadOptions(round, num) {
let options = document.querySelectorAll('.button');
let correct = document.querySelector(`#button-${num}`);
for (let i = 0; i < options.length; i++) {
options[i].removeEventListener('click', nextRound);
options[i].removeEventListener('click', wrongAnswer);
options[i].innerHTML =
'<p>' +
themeScript.IMAGEMAP[themeScript.CODE[round]][i + 1] +
'</p>';
if (options[i] !== correct) {
options[i].addEventListener('click', wrongAnswer);
}
}
correct.addEventListener('click', nextRound);
}
</script>
</body>
</html>