-
Notifications
You must be signed in to change notification settings - Fork 0
/
intermediate_game2.html
277 lines (260 loc) · 11.8 KB
/
intermediate_game2.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Intermediate Level game-2</title>
<link rel="stylesheet" type="text/css" href="style/selectCateGory.css" />
<style>
.topcontainer {
height: 20%;
width: 1210px;
margin-left: auto;
margin-right: auto;
}
.Playarea {
float: left;
height: 40%;
width: 100%;
margin-top: 1%;
}
.downcontainer {
height: 20%;
width: 1210px;
margin-left: auto;
margin-right: auto;
}
.imageContainer {
height: 120px;
width: 120px;
background: white;
float: left;
margin-right: 1px;
margin-top: 15px;
background-size: 100% auto;
background-position: center;
background-repeat: no-repeat;
border-radius: 10px 10px 10px 10px;
box-shadow: 1px 1px 2px #ccc;
}
.leftarea {
float: left;
height: 100%;
width: 30%;
margin-left: 5%;
}
#displayimage {
float: left;
height: 100%;
width: 30%;
background: white;
}
#displayimage img {
height: 90%;
width: 90%;
display: none;
margin-left: 5%;
margin-top: 5%;
}
.rightarea {
float: left;
height: 100%;
width: 30%;
}
.scientistname {
float: left;
height: 15%;
width: 40%;
background: white;
margin: 3% 5% 0% 5%;
box-shadow: 2px 2px 2px #555;
border-radius: 5px 5px 5px 5px;
text-align: center;
cursor: pointer;
}
#back {
position: absolute;
width: 5.5%;
height: 5%;
border-bottom-right-radius: 50px;
border-top-right-radius: 50px;
box-shadow: 1px 1px 2px #ccc;
background: royalblue;
margin-top: 1.5%;
font-size: 1.5em;
}
#back a {
text-decoration: none;
text-transform: uppercase;
color: black;
}
#playagain {
position: absolute;
width: 5.5%;
height: 9%;
border-bottom-right-radius: 50px;
border-top-right-radius: 50px;
box-shadow: 1px 1px 2px #ccc;
background: royalblue;
margin-top: 4.5%;
font-size: 1.2em;
}
#playagain a {
text-decoration: none;
text-transform: uppercase;
color: black;
}
</style>
</head>
<body>
<div id="header">
<div id="userContainer">
<div id="userImage"></div>
<div class="welcome">સુસ્વાગતમ્,</div>
<div id="userName"></div>
<div id="logout" onclick="changeuser();"><a href="enterName_gujarati.html">-> નામ અને આયકન બદલો</a></div>
<div id="changeLanguage"><a href="index.html">-> ભાષા બદલો</a></div>
</div>
<div id="Heading">Edutainer's</div>
</div>
<div id="content">
<div id="back"><a href="intermediate.html">BACK</a></div>
<div id="playagain"><a href="intermediate_game2.html">Play</br>Again</a></div>
<div class="topcontainer">
<div class="imageContainer" data="" id="1" onclick="initiateimg(1)"></div>
<div class="imageContainer" data="" id="2" onclick="initiateimg(2)"></div>
<div class="imageContainer" data="" id="3" onclick="initiateimg(3)"></div>
<div class="imageContainer" data="" id="4" onclick="initiateimg(4)"></div>
<div class="imageContainer" data="" id="5" onclick="initiateimg(5)"></div>
<div class="imageContainer" data="" id="6" onclick="initiateimg(6)"></div>
<div class="imageContainer" data="" id="7" onclick="initiateimg(7)"></div>
<div class="imageContainer" data="" id="8" onclick="initiateimg(8)"></div>
<div class="imageContainer" data="" id="9" onclick="initiateimg(9)"></div>
<div class="imageContainer" data="" id="10" onclick="initiateimg(10)"></div>
</div>
<div class="Playarea">
<div class="leftarea">
<div class="scientistname" id="c1" onclick="checkimg(1)">Orville Wright and Wilbur Wright</div>
<div class="scientistname" id="c2" onclick="checkimg(2)">John J. Loud</div>
<div class="scientistname" id="c3" onclick="checkimg(3)">Claude Minie</div>
<div class="scientistname" id="c4" onclick="checkimg(4)">I-Hsing and Liang Ling-Tsan</div>
<div class="scientistname" id="c5" onclick="checkimg(5)">Volta</div>
<div class="scientistname" id="c6" onclick="checkimg(6)">Guglielmo Marconi</div>
<div class="scientistname" id="c7" onclick="checkimg(7)">Elisha G. Otis</div>
<div class="scientistname" id="c8" onclick="checkimg(8)">Elmer A. Sperry</div>
<div class="scientistname" id="c9" onclick="checkimg(9)">Dr. Charles H. Townes</div>
<div class="scientistname" id="c10" onclick="checkimg(10)">Alexander Graham Bell</div>
</div>
<div id="displayimage"></div>
<div class="rightarea">
<div class="scientistname" id="c11" onclick="checkimg(11)">Vladimir Kosme Sworykin</div>
<div class="scientistname" id="c12" onclick="checkimg(12)">Cristofori</div>
<div class="scientistname" id="c13" onclick="checkimg(13)">James Harrison</div>
<div class="scientistname" id="c14" onclick="checkimg(14)">Venice</div>
<div class="scientistname" id="c15" onclick="checkimg(15)">David Bushnell of Saybrook</div>
<div class="scientistname" id="c16" onclick="checkimg(16)">Alexander Graham Bell</div>
<div class="scientistname" id="c17" onclick="checkimg(17)">Hans Lippershe</div>
<div class="scientistname" id="c18" onclick="checkimg(18)">Thomas Alva Edison</div>
<div class="scientistname" id="c19" onclick="checkimg(19)">Ferdinand Verbiest</div>
<div class="scientistname" id="c20" onclick="checkimg(20)">Martin Cooper</div>
</div>
</div>
<div class="downcontainer">
<div class="imageContainer" data="" id="11" onclick="initiateimg(11)"></div>
<div class="imageContainer" data="" id="12" onclick="initiateimg(12)"></div>
<div class="imageContainer" data="" id="13" onclick="initiateimg(13)"></div>
<div class="imageContainer" data="" id="14" onclick="initiateimg(14)"></div>
<div class="imageContainer" data="" id="15" onclick="initiateimg(15)"></div>
<div class="imageContainer" data="" id="16" onclick="initiateimg(16)"></div>
<div class="imageContainer" data="" id="17" onclick="initiateimg(17)"></div>
<div class="imageContainer" data="" id="18" onclick="initiateimg(18)"></div>
<div class="imageContainer" data="" id="19" onclick="initiateimg(19)"></div>
<div class="imageContainer" data="" id="20" onclick="initiateimg(20)"></div>
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
<script type="text/javascript">
$(document).ready(function () {
checkOldUser();
loadGame();
});
/************************************************************************************/
var unique_random_numbers = [];
function loadGame() {
var limit = 20
, amount = 20
, lower_bound = 1
, upper_bound = 20;
if (amount > limit) limit = amount; //Infinite loop if you want more unique
//Natural numbers than existemt in a
// given range
while (unique_random_numbers.length < limit) {
var random_number = Math.round(Math.random() * (upper_bound - lower_bound) + lower_bound);
if (unique_random_numbers.indexOf(random_number) == -1) {
// Yay! new random number
unique_random_numbers.push(random_number);
}
}
// unique_random_numbers is an array containing 3 unique numbers in the given range
loadImages();
}
score = 0; /************************************************************************************/
function loadImages() {
for (i = 1; i <= 20; i++) {
$("#" + i).css("backgroundImage", "url(img/intermediate_2/" + unique_random_numbers[i - 1] + ".png");
$("#" + i).attr("data", unique_random_numbers[i - 1]);
}
}
/************************************************************************************/
function checkOldUser() {
if (getCookie("name") != "" && getCookie("icon") != "") {
setUserData();
}
else {
window.location.assign("enterNameEnglish.html");
}
}
/************************************************************************************/
function setUserData() {
document.getElementById("userName").innerHTML = getCookie("name");
if (getCookie("icon") < 10) {
document.getElementById("userImage").innerHTML = "<img src=img/icons/0" + getCookie("icon") + ".png />";
}
else {
document.getElementById("userImage").innerHTML = "<img src=img/icons/" + getCookie("icon") + ".png />";
}
}
/************************************************************************************/
function changeuser() {
document.cookie = "name=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
document.cookie = "icon=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
}
newbg = 0;
bg = "";
/************************************************************************************/
function initiateimg(num) {
bg = "img/intermediate_2/" + $("#" + num).attr("data") + ".png";
$("#" + num).css("background", "white");
document.getElementById("displayimage").innerHTML = "<img id=image src=" + bg + " />";
$("#image").fadeIn(1000);
newbg = $("#" + num).attr("data");
}
function checkimg(a) {
if (a == newbg) {
score++;
if (score <= 0) score = 0;
document.getElementById("score").innerHTML = "| Score :" + score;
$("#image").fadeOut(250);
document.getElementById("c" + a).innerHTML = " ";
}
else {
score--;
if (score <= 0) score = 0;
document.getElementById("score").innerHTML = "| Score :" + score;
$("#image").fadeOut(250);
}
setCookie("i2", score, 365);
}
</script>
</body>
</html>