-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
192 lines (183 loc) · 8.74 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
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
<!DOCTYPE html>
<html>
<head>
<link rel="author" href="humans.txt" />
<link href="styles/menu.css" rel="stylesheet" type="text/css" id="stylesheet">
<link href="styles/forkit.css" rel="stylesheet" type="text/css" id="stylesheet">
<title id='title'>Welcome to Battleships</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script src="js/ui.js"></script>
<script src="js/showdown.js"></script>
<script>
//get a random element from an array
function getRandomFromArray(ary)
{
return ary[Math.floor((Math.random()*ary.length))];
}
function getRandomName()
{
var name0 = new Array("","","","","","","","");
var name1 = new Array("BATTLE", "BOTTLE", "BITTLE", "BEETLE", "BUTTLE", "BETTLE", "847713");
var name2 = new Array("SHIP", "SHAP", "SHOP", "SHAT", "SHEP", "SHUP", "5H1P");
var name3 = new Array("S", "Z", "5", "-2.0", ".exe");
var name4 = new Array("", "", "", "", "", "?", "!");
var randomName = getRandomFromArray(name0) + getRandomFromArray(name1) + getRandomFromArray(name2) + getRandomFromArray(name3) + getRandomFromArray(name4);
return randomName;
}
function getRandomSub()
{
var mottos = new Array("like a barrel of monkeys, but battleships", "now comes in banana flavor", "\'merica!", "deathtothespacebar!!!", "full of vitamin C", "001110111101101", "hello, world",
"sweet oogly moogly", "piratebay with limits", "lord vader 2012", "dalt", "humans.txt", "[enter comment]", "one ship to rule them all", "you look sick, are you okay?!",
"well read, good sir.", "what you looking at?", "daily double", "cats... everywhere", ".....", "it\'s a game", "now with less violence", "my mom said i could make this", "i\'m married, lady",
"did you know I can move?", "i\'m a big kid now", "d00d", "so this one time...", "oh yeah", "S3cr3ts3cr3t is my password", "don't cheat!", "So good I baked it twice", "I fight for the users!",
"[witty comment here]");
var randomSub = getRandomFromArray(mottos);
return randomSub;
}
function setStyle(bool)
{
if (bool) {
sessionStorage.menuStyle = "styles/menu.css";
sessionStorage.gameStyle = "styles/game.css";
}
else {
sessionStorage.menuStyle = "styles/mmenu.css";
sessionStorage.menuStyle = "styles/mgame.css";
}
}
function switchStyles()
{
//if the style hasn't been set default to switching styles
if(typeof(sessionStorage.isStyle1) === 'undefined')
{
sessionStorage.isStyle1 = false;
}
//switch between styles
else
{
if (sessionStorage.isStyle1 === false)
{
sessionStorage.isStyle1 = true;
}
else
{
sessionStorage.isStyle1 = false;
}
}
setStyle(sessionStorage.isStyle1);
}
function setPage(pageIn, pageTo)
{
document.getElementById(pageIn).style.display = "none";
document.getElementById(pageTo).style.display = "block";
}
function controlLightBox(elementId, show)
{
if(show)
{
document.getElementById(elementId).style.display='block';
document.getElementById('lightBoxDarken').style.display='block';
}
else
{
document.getElementById(elementId).style.display='none';
document.getElementById('lightBoxDarken').style.display='none';
}
}
function setSound(bool)
{
sessionStorage.sound = bool
}
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<script>
//this code was causing the page to fail loading 1 out of every 5 tries and sometimes more
$(document).ready(function(){
$("#menu").draggable( {containment: "body"} );
});
</script>
</head>
<body>
<div id="version">
<!-- version will go here -->
</div>
<script>
UI.displayVersion('version');
</script>
<div id="menu">
<div id="main">
<div id="logo" class="rotate">
<script>
var randomName = getRandomName();
document.write(randomName);
document.getElementById('title').textContent = "Welcome to "+randomName;
</script>
</div>
<div id="motto"><script>document.write(getRandomSub());</script></div><br>
<center>
<span class="tab" onclick="setPage('main', 'play')">Play Game</span><br>
<span class="tab" onclick="controlLightBox('howto',true)">How To Play</span><br>
<span class="tab" onclick="setPage('main', 'options')">Options</span>
</center>
</div>
<div id="play" style="display:none;">
<div id="logo" class="rotate">Select Your Game!</div>
<center>
<script>
//write links to the game versions
document.write("<a class=\"tab\" href=\"game.html?mode=1&players=1&name="+randomName+"\">One Player</a><br>");
document.write("<a class=\"tab\" href=\"game.html?mode=1&players=2&name="+randomName+"\">Two Player</a><br>");
document.write("<a class=\"tab\" href=\"game.html?mode=2&players=1&name="+randomName+"\">Crazy One Player</a><br>");
document.write("<a class=\"tab\" href=\"game.html?mode=2&players=2&name="+randomName+"\">Crazy Two Player</a><br>");
</script>
<span class="tab" onclick="setPage('play', 'main')">Return to Home</span>
</center>
</div>
<div id="options" style="display:none;">
<div id="logo" class="rotate">Options</div><br><br>
<center>
<a class="tab" href="#" onclick="switchStyles()">Change Theme</a><br><br>
<a class="tab" href="#">Turn Sound On/Off</a><br><br>
<span class="tab" onclick="setPage('options', 'main')">Return to Home</span>
</center>
</div>
</div>
<div id="footer">
<p>to enjoy this game bug-free, please use
<a id="footera" href="http://abetterbrowser.org" target="_blank">a better browser</a>
</p>
</div>
<div style="position:absolute;right:5px;bottom:5px;z-index:1;">
<a href="http://www.w3.org/html/logo/" target="_blank"><img src="http://www.w3.org/html/logo/badge/html5-badge-h-css3-semantics-storage.png" width="98" height="32" alt="HTML5 Powered with CSS3 / Styling, Semantics, and Offline & Storage" title="HTML5 Powered with CSS3 / Styling, Semantics, and Offline & Storage"></a>
<a href="humans.txt" target="_blank"><img src="styles/img/humans.png" alt="humans.txt supported" width="98" height="32"></a>
</div>
<div id='previousversion'></div>
<script>
//display development info only if the dev file exists
UI.showDevInfo('version','previousversion');
</script>
<!-- The interactive forkit widget -->
<div class="forkit-curtain">
<div class="close-button"></div>
<div id="forkit-contents">
<h1>Humans.txt</h1>
</div>
<script>UI.displayHumansTXT('forkit-contents')</script>
</div>
<a class="forkit" data-text="Fork this on Github" data-text-detached="You know you want to" href="https://github.com/warricksothr/it484battleship"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork us on GitHub"></a>
<script src="js/forkit.js"></script>
<!-- all the popups are defined below here -->
<!-- how to popup -->
<div id="howto" class="lightbox_content">
<center>
<span class="tab" onclick="controlLightBox('howto',false)">Return to Home</span>
</center>
<hr>
<div id="howToContent" class="markdownContent"></div>
<script>UI.displayExternalMarkdownContent('howToContent','./docs/howTo.md')</script>
</div>
<!-- The lightbox overlay element -->
<div id="lightBoxDarken" class="lightbox_overlay"></div>
</body>
</html>