-
Notifications
You must be signed in to change notification settings - Fork 0
/
generator.html
95 lines (82 loc) · 2.02 KB
/
generator.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
<!--
script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
-->
<html>
<head>
<link rel="stylesheet" type="text/css" href="systemTemplate.css">
</head>
<body>
<script src="jquery.min.js"></script>
<script src="prototypes.js"></script>
<script src="random.js"></script>
<script src="systemTables.js"></script>
<script src="systemTemplate.js"></script>
<script src="generator.js"></script>
<script>
var generate = function() {
debug("generate");
var featureType = parseInt($("#system option:selected").val(), 10);
var featureTypeString = $("#system option:selected").text();
debug(featureTypeString);
var feature = {};
switch (featureType) {
case 1:
feature = planet(planetRoll());
clearDebug();
printPlanet(feature);
break;
case 2:
feature = gasGiant();
clearDebug();
printGasGiant(feature);
break;
case 3:
feature = asteroidBelt();
clearDebug();
printAsteroidBelt(feature);
break;
}
seed = Date.now();
}
var appendLog = function(d) {
var s = d.id;
var col = $('#history');
var entry = $("<option id='" + s + "'>" + s + " (" + d.value
+ ")</option>");
col.append(entry);
entry.click(function() {
currentDude = d;
displayDude(d);
});
entry.hover(function() {
entry.addClass("hover")
}, function() {
entry.removeClass("hover")
});
}
var debug = function(l) {
var log = $('#log').append("<div>" + l + "</div>");
}
var clearDebug = function(l) {
$('#log').empty();
};
</script>
Generate a System
<select id="system">
<option value="1">Planet</option>
<option value="2">Gas Giant</option>
<option value="3">Asteroid Belt</option>
</select>
<button onclick="generate()">Generate!</button>
<script>
seed = Date.now()
var currentDude = {};
var dudes = [];
</script>
<hr>
<div id="section-to-print" class='disp'>
<div id='log'></div>
</div>
</body>
</html>