-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
51 lines (51 loc) · 1.32 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
<html>
<head>
<title>WebVenture Game Engine</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
<div class="intro">
<h3>WebVenture</h3>
<p>This is an example of how to read the save game files and link to
the game and save games.
</p>
</div>
<script type="text/javascript">
$(document).ready(function(){
$.getJSON("games.js",function(games){
for (var i=0;i<games.length;i++)
{
var link=document.createElement('a');
link.href="game.html#"+escape(games[i].game);
var img=document.createElement('img');
img.src=games[i].icon;
$(link).append(img);
$(link).append(games[i].title);
$('#gamelist').append(link);
}
for (var i=0;i<localStorage.length;i++)
{
if (i==0)
{
var h2=document.createElement('h2');
$(h2).text('Saved Games:');
$('#savelist').append(h2);
}
var title=localStorage.key(i);
var game=JSON.parse(localStorage.getItem(title));
var link=document.createElement('a');
link.href="game.html#"+game.game+"?"+escape(title);
var img=document.createElement('img');
img.src='icons/'+game.game+'.png';
$(link).append(img);
$(link).append(title);
$('#savelist').append(link);
}
});
});
</script>
<div id="gamelist"></div>
<div id="savelist"></div>
</body>
</html>