-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
258 lines (235 loc) · 10.1 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>squareicon</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-colorpicker@3.0.3/dist/css/bootstrap-colorpicker.min.css"/>
<style>
footer {
padding-top: 2rem;
padding-bottom: 2rem;
margin-top: 3rem;
background-color: #e9ecef;
}
.colorpicker.colorpicker-popup {
user-select: none;
}
</style>
</head>
<body>
<section class="jumbotron text-center">
<div class="container">
<h1 class="jumbotron-heading">squareicon</h1>
<p class="lead text-muted">identicons with squares</p>
<p>
<a href="https://github.com/mistic100/squareicon" class="btn btn-primary btn-lg">
<img src="https://github.githubassets.com/images/modules/logos_page/Octocat.png" height=32px> GitHub</a>
</p>
</div>
</section>
<div class="container border-bottom pb-4 mb-4">
<div class="row">
<div class="col">
<h2>demos</h2>
</div>
<div class="col text-right">
<button class="btn btn-outline-primary btn-sm" type="button" onclick="refresh()">random</button>
</div>
</div>
<div class="row">
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon class="img-thumbnail"/>
<figcaption class="figure-caption">Default settings</figcaption>
</figure>
</div>
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon data-colors="1" class="img-thumbnail"/>
<figcaption class="figure-caption">One color</figcaption>
</figure>
</div>
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon data-pixels="5" class="img-thumbnail"/>
<figcaption class="figure-caption">5 pixels wide</figcaption>
</figure>
</div>
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon data-padding="16" class="img-thumbnail"/>
<figcaption class="figure-caption">With padding</figcaption>
</figure>
</div>
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon data-background="#ccc" class="img-thumbnail"/>
<figcaption class="figure-caption">With background</figcaption>
</figure>
</div>
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon data-symmetry="vertical" class="img-thumbnail"/>
<figcaption class="figure-caption">Vertical symmetry</figcaption>
</figure>
</div>
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon data-symmetry="horizontal" class="img-thumbnail"/>
<figcaption class="figure-caption">Horizontal symmetry</figcaption>
</figure>
</div>
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon data-symmetry="central" class="img-thumbnail"/>
<figcaption class="figure-caption">Central symmetry</figcaption>
</figure>
</div>
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon data-scheme="raw" class="img-thumbnail"/>
<figcaption class="figure-caption">Raw scheme</figcaption>
</figure>
</div>
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon data-scheme="light" class="img-thumbnail"/>
<figcaption class="figure-caption">Light scheme</figcaption>
</figure>
</div>
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon data-scheme="bright" class="img-thumbnail"/>
<figcaption class="figure-caption">Bright scheme</figcaption>
</figure>
</div>
<div class="col-6 col-md-3 col-lg-2 text-center">
<figure class="figure">
<img data-squareicon data-scheme="dark" class="img-thumbnail"/>
<figcaption class="figure-caption">Dark scheme</figcaption>
</figure>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col">
<h2>playground</h2>
</div>
</div>
<div class="row">
<div class="col-12 col-md-6 col-lg-4">
<form class="border rounded p-3" id="playground-form">
<div class="form-group">
<label for="id">Id</label>
<div class="input-group">
<input type="text" class="form-control" id="id" name="id">
<div class="input-group-append">
<button class="btn btn-outline-primary btn-sm" type="button"
onclick="document.querySelector('#id').value = ''; refreshPlayground();">random
</button>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col">
<label for="colors">Colors</label>
<input type="number" class="form-control" min="1" max="2" id="colors" name="colors">
</div>
<div class="form-group col">
<label for="pixels">Pixels</label>
<input type="number" class="form-control" min="2" max="16" id="pixels" name="pixels">
</div>
</div>
<div class="form-row">
<div class="form-group col">
<label for="size">Size</label>
<input type="number" class="form-control" min="1" id="size" name="size">
</div>
<div class="form-group col">
<label for="padding">Padding</label>
<input type="number" class="form-control" min="0" id="padding" name="padding">
</div>
</div>
<div class="form-row">
<div class="form-group col">
<label for="symmetry">Symmetry</label>
<select class="form-control" id="symmetry" name="symmetry">
<option>none</option>
<option>vertical</option>
<option>horizontal</option>
<option>central</option>
</select>
</div>
<div class="form-group col">
<label for="scheme">Scheme</label>
<select class="form-control" id="scheme" name="scheme">
<option>raw</option>
<option>standard</option>
<option>light</option>
<option>bright</option>
<option>dark</option>
</select>
</div>
</div>
<div class="form-group">
<label for="background">Background</label>
<input data-toggle="colorpicker" class="form-control" type="text" id="background" name="background">
</div>
<button class="btn btn-outline-danger btn-sm" type="button" onclick="defaultPlayground()">reset</button>
</form>
</div>
<div class="col-12 col-md-6 col-lg-8">
<img class="img-thumbnail" id="playground-img">
</div>
</div>
</div>
<footer>
<div class="container">
<p class="float-right">
<a href="https://www.strangeplanet.fr">strangeplanet.fr</a>
</p>
<p>© Damien "Mistic" Sorel, licenced under MIT</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.6/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-colorpicker@3.0.3/dist/js/bootstrap-colorpicker.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/randomcolor@0.5.3/randomColor.min.js"></script>
<script src="browser.js"></script>
<script>
$('[data-toggle="colorpicker"]').colorpicker();
const playgroundForm = $('#playground-form');
const playgroundImg = $('#playground-img');
function refresh(id) {
id = id || Math.random().toString(16).substr(2);
$('[data-squareicon]').each(function() {
const options = Object.assign({
id: id,
}, this.dataset);
squareicon(options).then(data => this.src = data);
});
}
function refreshPlayground() {
const options = {};
for (const data of new FormData(playgroundForm[0]).entries()) {
options[data[0]] = data[1];
}
squareicon(options).then(data => playgroundImg[0].src = data);
}
function defaultPlayground() {
for (const [key, value] of Object.entries(squareicon.DEFAULT)) {
playgroundForm.find(`[name=${key}]`).val(value);
}
playgroundForm.find('[name=id]').val('squareicon');
refreshPlayground();
}
playgroundForm.on('change', refreshPlayground);
playgroundForm.on('keyup', refreshPlayground);
refresh('squareicon');
defaultPlayground();
</script>
</body>
</html>