-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
267 lines (253 loc) · 16.7 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
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Template Maker</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz"
crossorigin="anonymous"></script>
<script src="ThemeToggle.js"></script>
<link rel="stylesheet" href="index.css?v=2.0.1">
<script type="module" src="modules/UrlManager.js?v=2.0.1"></script>
<script type="module" src="modules/ProgressManager.js?v=2.0.1"></script>
<script type="module" src="index.js?v=2.0.1"></script>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="check2" viewBox="0 0 16 16">
<path
d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z">
</path>
</symbol>
<symbol id="circle-half" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 0 8 1v14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"></path>
</symbol>
<symbol id="moon-stars-fill" viewBox="0 0 16 16">
<path
d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z">
</path>
<path
d="M10.794 3.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387a1.734 1.734 0 0 0-1.097 1.097l-.387 1.162a.217.217 0 0 1-.412 0l-.387-1.162A1.734 1.734 0 0 0 9.31 6.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387a1.734 1.734 0 0 0 1.097-1.097l.387-1.162zM13.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732l-.774-.258a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L13.863.1z">
</path>
</symbol>
<symbol id="sun-fill" viewBox="0 0 16 16">
<path
d="M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z">
</path>
</symbol>
</svg>
<div class="theme-toggle dropdown end-0 m-1 position-fixed">
<button class="btn btn-link nav-link py-2 px-0 px-lg-2 dropdown-toggle d-flex align-items-center show"
id="bd-theme" type="button" aria-expanded="true" data-bs-toggle="dropdown" data-bs-display="static"
aria-label="Toggle theme">
<svg class="bi my-1 theme-icon-active">
<use href="#moon-stars-fill"></use>
</svg>
</button>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-theme-text" data-bs-popper="static">
<li>
<button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="light"
aria-pressed="false">
<svg class="bi me-2 opacity-50 theme-icon">
<use href="#sun-fill"></use>
</svg>
Light
<svg class="bi ms-auto d-none">
<use href="#check2"></use>
</svg>
</button>
</li>
<li>
<button type="button" class="dropdown-item d-flex align-items-center active" data-bs-theme-value="dark"
aria-pressed="true">
<svg class="bi me-2 opacity-50 theme-icon">
<use href="#moon-stars-fill"></use>
</svg>
Dark
<svg class="bi ms-auto d-none">
<use href="#check2"></use>
</svg>
</button>
</li>
<li>
<button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="auto"
aria-pressed="false">
<svg class="bi me-2 opacity-50 theme-icon">
<use href="#circle-half"></use>
</svg>
Auto
<svg class="bi ms-auto d-none">
<use href="#check2"></use>
</svg>
</button>
</li>
</ul>
</div>
<span id="version" class="badge bg-dark position-fixed bottom-0 end-0 m-1">v2.0.1</span>
<div class="container-fluid">
<main role="main">
<div class="container">
<h1 class="pt-5 mb-4">Generate Template for r/Place</h1>
<button id="reset" class="d-none btn btn-lg btn-outline-danger mb-3">Reset</button>
<div class="accordion mb-4" id="important-accordian">
<div class="accordion-item">
<h2 class="accordion-header" id="important-accordian-header">
<button id="important-accordion-button" class="accordion-button collapsed" type="button"
data-bs-toggle="collapse" data-bs-target="#important-accordian-body"
aria-expanded="false" aria-controls="important-accordian-body">
Important Information
</button>
</h2>
<div id="important-accordian-body" class="accordion-collapse collapse"
aria-labelledby="important-accordian">
<div class="accordion-body collapsed">
<div class="d-flex justify-content-between">
<div>
<a href="https://twitter.com/Voiture__" target="_blank">@Voiture ❤</a>
</div>
<div>
<span class="PepoTurkey emote" title="PepoTurkey"></span>
<span class="dggL emote" title="dggL"></span>
<span class="sodaSmile emote" title="sodaSmile"></span>
</div>
<div title="DGG4LYFE">😎🤙</div>
</div>
<hr>
<div>
<p>This tool runs entirely client-side, in your browser. This runs very fast in
Chrome, but for some reason FireFox takes 10x longer to process.</p>
<p>If you use a source image URL (instead of file upload) you will get a link above
your output to share your template with others.</p>
<a href="https://github.com/Voiture-0/PlaceTemplater/issues" target="_blank">Found a
bug, have an issue, or a suggestion?</a>
</div>
</div>
</div>
</div>
</div>
<div class="accordion" id="template-form-accordian">
<div class="accordion-item">
<h2 class="accordion-header" id="image-source-accordian-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse"
data-bs-target="#image-source-accordian-body" aria-expanded="false"
aria-controls="image-source-accordian-body">
Link Source Image (pixel perfect size)
</button>
</h2>
<div id="image-source-accordian-body" class="accordion-collapse collapse"
aria-labelledby="image-source-accordian">
<div class="accordion-body collapsed">
<form id="image-source-form">
<div class="row">
<div class="col-6 mb-3">
<label for="url" class="form-label"
title="Must be direct path to img and the website must not be blocking crossorigin requests">Source
image URL</label>
<div class="input-group">
<input id="url" class="form-control form-control-lg" type="url" />
<button id="load" class="btn btn-primary">Use URL</button>
</div>
</div>
<div class="col-6 mb-3">
<label for="file" class="form-label">Upload Source Image File</label>
<input id="file" class="form-control form-control-lg" type="file"
accept="image/*" />
</div>
</div>
</form>
<div class="d-flex flex-column align-items-center justify-content-center">
<div id="img-dimensions">width x height</div>
<img id="img" src="" height="56" style="min-height: 56px;" />
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="template-settings-accordian-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
data-bs-target="#template-settings-accordian-body" aria-expanded="false"
aria-controls="template-settings-accordian-body">
Template Settings
</button>
</h2>
<div id="template-settings-accordian-body" class="accordion-collapse collapse"
aria-labelledby="template-settings-accordian">
<div class="accordion-body collapsed">
<form id="template-form">
<div class="row">
<div class="col-3 mb-3 text-end">
<label for="x" class="form-label" title="yes the first number listed">Top
Left Corner <span class="fw-bold">X</span> Coordinate</label>
<input id="x" class="form-control text-end" type="number" value="0"
required />
</div>
<div class="col-3 mb-3 text-end">
<label for="y" class="form-label" title="the second number listed">Top Left
Corner <span class="fw-bold">Y</span> Coordinate</label>
<input id="y" class="form-control text-end" type="number" value="0"
required />
</div>
<div class="col-2 mb-3 text-end">
<label for="scale" class="form-label"
title="How many pixels larger should each pixel be in the template. The larger the number the easier it will be to read the coordinates.">Scale
Up Factor</label>
<input id="scale" class="form-control text-end" type="number" value="32"
min="16" max="64" required />
</div>
<div class="col-4 mb-3 m-auto">
<div id="generate-progress" class="progress flat-bottom">
<div id="generate-progress-bar"
class="progress-bar progress-bar-striped progress-bar-animated"
role="progressbar" aria-valuenow="0" aria-valuemin="0"
aria-valuemax="100" style="width: 0%"></div>
<span id="generate-progress-label"
class="progress-bar-label black-outlined"></span>
</div>
<button id="btn" class="btn btn-primary w-100 flat-top" disabled>Create</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="template-output-accordian-header">
<button id="template-output-accordian-btn" class="accordion-button collapsed" type="button"
disabled data-bs-toggle="collapse" data-bs-target="#template-output-accordian-body"
aria-expanded="false" aria-controls="template-output-accordian-body">
Output
</button>
</h2>
<div id="template-output-accordian-body" class="accordion-collapse collapse"
aria-labelledby="template-output-accordian">
<div class="accordion-body">
<div class="mb-2">
Right click, 'copy image', and paste it to your favorite
<a href="https://imgur.com/upload" target="_blank">image uploader</a>
<a id="template-link" class="px-3 fw-bold" href="/" target="_blank">Link to these
settings</a>
</div>
<div class="mb-2">
<a id="place-link" href="" target="_blank"></a>
<a id="random-place-link" class="px-3 fw-bold" href="" target="_blank">Send me to a
random pixel to color <div id="random-pixel-color"></div> <span
id="random-pixel-coords"></span></a>
</div>
<div class="overflow-auto">
<canvas id="canvas"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</body>
</html>