-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
238 lines (228 loc) · 6.35 KB
/
Copy pathindex.html
File metadata and controls
238 lines (228 loc) · 6.35 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>D&D Character Generator</title>
<!-- jsPDF library for PDF generation -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<style>
body {
font-family: 'Inter', Arial, sans-serif; /* Using Inter font as per instructions */
max-width: 900px;
margin: 20px auto;
padding: 0 15px;
background-color: #f8f8f8;
color: #333;
}
h1, h2 {
text-align: center;
color: #2c3e50;
margin-bottom: 25px;
}
.question {
margin-bottom: 30px;
padding: 15px;
background-color: #ffffff;
border: 1px solid #e0e0e0;
border-radius: 8px; /* Rounded corners */
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.question label {
display: block;
font-weight: 600;
margin-bottom: 12px;
color: #34495e;
font-size: 1.1em;
}
input[type="range"] {
width: 100%;
margin-bottom: 8px;
-webkit-appearance: none;
height: 8px;
border-radius: 5px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: #3498db;
cursor: pointer;
box-shadow: 0 0 5px rgba(0,0,0,0.2);
}
input[type="range"]::-moz-range-thumb {
width: 20px;
height: 20px;
border-radius: 50%;
background: #3498db;
cursor: pointer;
box-shadow: 0 0 5px rgba(0,0,0,0.2);
}
.slider-labels {
display: flex;
justify-content: space-between;
font-size: 0.9em;
color: #555;
font-weight: 600;
user-select: none;
margin-top: 5px;
}
#character-display {
white-space: pre-wrap;
background: #ffffff;
border: 1px solid #ccc;
padding: 20px;
margin-top: 30px;
font-family: monospace;
min-height: 200px;
border-radius: 8px; /* Rounded corners */
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
overflow-x: auto; /* Prevent horizontal scrolling */
}
.input-group {
margin-bottom: 20px;
padding: 15px;
background-color: #ffffff;
border: 1px solid #e0e0e0;
border-radius: 8px; /* Rounded corners */
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.input-group label {
display: block;
font-weight: 600;
margin-bottom: 8px;
color: #34495e;
}
.input-group input[type="text"],
.input-group select {
width: calc(100% - 20px);
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 1em;
box-sizing: border-box;
}
button {
display: block;
width: 100%;
padding: 12px 20px;
margin-top: 25px;
background-color: #2ecc71; /* Green for generate */
color: white;
border: none;
border-radius: 8px; /* Rounded corners */
font-size: 1.1em;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.2s ease;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
button:hover {
background-color: #27ae60;
transform: translateY(-2px);
}
button:active {
transform: translateY(0);
}
#download-link, #download-pdf-button {
display: none; /* Hidden by default, shown by JS */
text-align: center;
margin-top: 15px;
padding: 10px 15px;
background-color: #3498db; /* Blue for download */
color: white;
text-decoration: none;
border-radius: 8px; /* Rounded corners */
font-weight: bold;
transition: background-color 0.3s ease;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
#download-pdf-button {
background-color: #e74c3c; /* Red for PDF */
border: none; /* Make it a button */
cursor: pointer;
width: 100%; /* Make it full width like other buttons */
}
#download-link:hover {
background-color: #2980b9;
}
#download-pdf-button:hover {
background-color: #c0392b;
}
#portrait-container {
margin-top: 15px;
text-align: center;
padding: 15px;
background-color: #ffffff;
border: 1px solid #e0e0e0;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
#character-portrait {
max-width: 200px;
height: auto;
border: 1px solid #ccc;
border-radius: 8px;
display: none; /* Hidden by default */
margin: 0 auto 10px auto;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
#portrait-status {
font-style: italic;
color: #777;
}
</style>
</head>
<body>
<h1>D&D Character Creator</h1>
<div class="input-group">
<label for="name">Character Name:</label>
<input type="text" id="name" placeholder="Leave blank to auto-generate" />
</div>
<div class="input-group">
<label for="gender">Character Gender:</label>
<input type="text" id="gender" placeholder="Leave blank to auto-generate" />
</div>
<div class="input-group">
<label for="level">Level:</label>
<select id="level">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</div>
<!-- Background selection remains a dropdown -->
<div class="input-group">
<label for="background-select">Background:</label>
<select id="background-select">
<!-- Options will be populated by JavaScript -->
</select>
</div>
<h2>Answer These Questions</h2>
<form id="question-form">
<div id="questions"></div>
<button type="submit">Generate Character</button>
</form>
<div class="input-group">
<button type="button" id="generate-portrait-button">Generate Portrait</button>
<div id="portrait-container">
<img id="character-portrait" src="" alt="Character Portrait">
<p id="portrait-status"></p>
</div>
</div>
<div id="character-display"></div>
<a id="download-link" download="character.txt">Download Character Sheet (TXT)</a>
<button type="button" id="download-pdf-button">Download Character Sheet (PDF)</button>
<!-- Link to your JavaScript file -->
<script src="script.js"></script>
</body>
</html>