-
Notifications
You must be signed in to change notification settings - Fork 25
/
index.html
82 lines (78 loc) · 3.99 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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Image Puzzle</title>
<link href="css/style.css" rel="stylesheet" />
<link href="css/image-puzzle.css" rel="stylesheet" />
<script src="js/image-puzzle.js"></script>
</head>
<body>
<div id="collage">
<h2>Image Puzzle</h2>
<hr />
<div id="playPanel" style="padding:5px;display:none;">
<h3 id="imgTitle"></h3>
<hr />
<div style="display:inline-block; margin:auto; width:95%; vertical-align:top;">
<ul id="sortable" class="sortable"></ul>
<div id="actualImageBox">
<div id="stepBox">
<div>Steps:</div>
<div id="stepCount" class="stepCount">0</div>
</div>
<div id="timeBox">
Time Taken: <span id="timerPanel"></span> secs
</div>
<img id="actualImage" />
<div>Re-arrange to create a picture like this.</div>
<p id="levelPanel">
<input type="radio" name="level" id="easy" checked="checked" value="3" onchange="imagePuzzle.startGame(images, this.value);"
/> <label for="easy">Easy</label>
<input type="radio" name="level" id="medium" value="4" onchange="imagePuzzle.startGame(images, this.value);" /> <label for="medium">Medium</label>
<input type="radio" name="level" id="hard" value="5" onchange="imagePuzzle.startGame(images, this.value);" /> <label for="hard">Hard</label>
</p>
<div>
<button id="btnRule" type="button" class="btn" onclick="rules();">Rules</button>
<button id="newPhoto" type="button" class="btn" onclick="restart();">Another Photo</button>
<button id="btnReplay" type="button" class="btn" onclick="about();">About</button>
</div>
</div>
</div>
</div>
<div id="gameOver" style="display:none;">
<div style="background-color: #fc9e9e; padding: 5px 10px 20px 10px; text-align: center; ">
<h2 style="text-align:center">Game Over!!</h2>
Congratulations!! <br /> You have completed this picture.
<br /> Steps: <span id="stepCount" class="stepCount">0</span> steps.
<br /> Time Taken: <span class="timeCount">0</span> seconds<br />
<div>
<button type="button" onclick="window.location.reload(true);">Play Again</button>
</div>
</div>
</div>
<script>
var images = [
{ src: 'images/london-bridge.jpg', title: 'London Bridge' },
{ src: 'images/lotus-temple.jpg', title: 'Lotus Temple' },
{ src: 'images/qutub-minar.jpg', title: 'Qutub Minar' },
{ src: 'images/statue-of-liberty.jpg', title: 'Statue Of Liberty' },
{ src: 'images/taj-mahal.jpg', title: 'Taj Mahal' }
];
window.onload = function () {
var gridSize = document.querySelector('#levelPanel input[type="radio"]:checked').getAttribute('value');
imagePuzzle.startGame(images, gridSize);
};
function restart() {
var gridSize = document.querySelector('#levelPanel input[type="radio"]:checked').getAttribute('value');
imagePuzzle.startGame(images, gridSize);
}
function rules() {
alert('Re arrange the image parts in a way that it correctly forms the picture. \nThe no. of steps taken will be counted.');
}
function about() {
alert('Developed by Anurag Gandhi. \nHe can be contacted at: soft.gandhi@gmail.com');
}
</script>
</div>
</body>
</html>