-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
453 lines (421 loc) · 14.9 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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Simple License Generator</title>
<meta property="og:title" content="Create Your Own Simple License" />
<meta property="og:site_name" content="Simple License Generator" />
<meta
property="og:url"
content="https://simonmeskens.github.io/SimpleLicenseCollection/"
/>
<meta
property="og:description"
content="A license generator for simple, compact licenses."
/>
<meta property="og:type" content="website" />
<meta
property="og:image"
content="https://user-images.githubusercontent.com/4284735/159537019-6ccee52c-a144-46aa-8210-6981bfe68f9c.png"
/>
<meta name="twitter:card" content="summary_large_image" />
<meta
name="twitter:image:alt"
content="A simple generator for compact licenses."
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Oswald:wght@200&family=Quicksand:wght@400;600&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css"
/>
<style>
body {
padding-inline: 4rem;
line-height: 1.4rem;
font-family: Quicksand, sans-serif;
}
h1,
h2 {
font-family: Oswald, sans-serif;
text-transform: uppercase;
color: rgb(221, 52, 0);
}
main {
display: flex;
flex-direction: row;
margin-inline-start: 2rem;
}
fieldset p {
display: flex;
flex-direction: row;
}
fieldset label,
fieldset select {
display: inline-block;
width: 10em;
}
fieldset input {
display: inline-block;
width: 15em;
}
article {
flex-basis: 1;
width: 60ch;
border: 1px solid #999;
background-color: #eee;
padding: 1rem 4rem;
margin-inline-start: 2rem;
}
.copyright-notice {
font-weight: 600;
}
.copyright,
.relicense,
.permission,
.attribution,
.patent,
.disclaimer,
.equivalent-license {
display: none;
}
.license {
display: none;
}
</style>
<script type="module">
document.getElementById("year-input").value = new Date().getFullYear();
const notEmpty = (string, fallback) =>
typeof string === "string" && string.length > 0 ? string : fallback;
const fillSlot = (name, value) =>
document
.querySelectorAll(`slot[name="${name}"]`)
.forEach((slot) => (slot.textContent = value));
const form = Object.assign(
(name) => form[name]?.value,
Object.fromEntries(
[
"contributors-input",
"year-input",
"work-select",
"copyright-select",
"relicense-select",
"permission-select",
"attribution-select",
"patent-select",
"disclaimer-select",
].map((id) => [id, document.getElementById(id)])
)
);
const get = (name) => document.querySelector(`.${name}, #${name}`);
const hide = (name) => {
const element = typeof name === "string" ? get(name) : name;
if (element) element.style.removeProperty("display");
return element;
};
const show = (name) => {
const element = typeof name === "string" ? get(name) : name;
if (element) element.style.display = "revert";
return element;
};
let licenseType = "free-license";
const license = {};
const update = () => {
fillSlot("year", notEmpty(form["year-input"].value, "«YEAR»"));
fillSlot(
"contributors",
notEmpty(form["contributors-input"].value, "«AUTHORS»")
);
fillSlot("work", notEmpty(form["work-select"].value, "work"));
fillSlot(
"work-uppercase",
notEmpty(form["work-select"].value.toUpperCase(), "WORK")
);
const copyright = form("copyright-select");
hide(license.copyright);
if (copyright === "minimal") hide("copyright-symbol");
else {
show("copyright-symbol");
license.copyright = show(copyright);
}
const relicense = form("relicense-select");
if (relicense === "yes") show("relicense");
else hide("relicense");
const permission = form("permission-select");
hide(license.permission);
license.permission = show(permission);
const attribution = form("attribution-select");
hide(license.attribution);
if (attribution === "none") hide("copyright-notice");
else {
show("copyright-notice");
license.attribution = show(attribution);
}
const patent = form("patent-select");
if (patent === "yes") show("patent");
else hide("patent");
const disclaimer = form("disclaimer-select");
hide(license.disclaimer);
license.disclaimer = show(disclaimer);
document
.querySelectorAll(".license")
.forEach((el) => el.style.removeProperty("display"));
if (
copyright !== "public-domain" &&
relicense !== "yes" &&
attribution !== "none" &&
patent === "no"
) {
licenseType = "free-license";
} else if (
copyright !== "public-domain" &&
relicense !== "yes" &&
attribution !== "none" &&
patent === "yes"
) {
licenseType = "patent-grant-license";
} else if (
copyright === "public-domain" &&
relicense !== "yes" &&
attribution !== "none" &&
patent === "no"
) {
licenseType = "public-domain-license";
} else if (
copyright !== "public-domain" &&
relicense !== "yes" &&
attribution === "none" &&
patent === "no"
) {
licenseType = "no-attribution-license";
} else licenseType = "none";
if (licenseType !== "none") {
document
.querySelectorAll("." + licenseType)
.forEach((el) => (el.style.display = "block"));
show("equivalent-license");
} else hide("equivalent-license");
};
update();
document.querySelector("form").addEventListener("change", update);
</script>
</head>
<body>
<h1>Create your own simple license</h1>
<main>
<form>
<fieldset>
<p>
<label for="contributors-input">Copyright holders: </label>
<input
type="text"
name="contributors"
id="contributors-input"
placeholder="John Doe, Jane Smith"
required
/>
</p>
<p>
<label for="year-input">Year: </label>
<input
type="text"
name="year"
id="year-input"
placeholder="YYYY"
required
/>
</p>
<p>
<label for="work-select">Type of work: </label>
<select name="work" id="work-select">
<option value="work">Work</option>
<option value="file">File</option>
<option value="software">Software</option>
<option value="project">Project</option>
</select>
</p>
<p>
<label for="copyright-select">Copyright notice: </label>
<select name="copyright" id="copyright-select">
<option value="minimal">Minimal</option>
<option value="rights-reserved">All rights reserved</option>
<option value="public-domain">Public Domain</option>
</select>
</p>
<p>
<label for="relicense-select">Re-license clause: </label>
<select name="relicense" id="relicense-select">
<option value="no">No</option>
<option value="yes">Yes</option>
</select>
</p>
<p>
<label for="permission-select">Permission clause: </label>
<select name="permission" id="permission-select">
<option value="simple-permission">Simple</option>
<option value="negative-restriction">Negative restriction</option>
</select>
</p>
<p>
<label for="attribution-select">Attribution clause: </label>
<select name="attribution" id="attribution-select">
<option value="simple-attribution">Simple</option>
<option value="minimal-attribution">Minimal</option>
<option value="none">None</option>
</select>
</p>
<p>
<label for="patent-select">Patent grant: </label>
<select name="patent" id="patent-select">
<option value="no">No</option>
<option value="yes">Yes</option>
</select>
</p>
<p>
<label for="disclaimer-select">Disclaimer clause: </label>
<select name="disclaimer" id="disclaimer-select">
<option value="minimal-disclaimer">Minimal</option>
<option value="simple-disclaimer">Simple</option>
<option value="full-disclaimer">Full</option>
</select>
</p>
<p>
<label class="equivalent-license">Similar licenses: </label>
<span>
<a
href="https://opensource.org/licenses/ISC"
class="license free-license"
>
ISC License
</a>
<a
href="https://opensource.org/licenses/MIT"
class="license free-license"
>
MIT License
</a>
<a
href="https://opensource.org/licenses/BSD-2-Clause"
class="license free-license"
>
Simplified BSD License
</a>
<a
href="https://opensource.org/licenses/0BSD"
class="license no-attribution-license"
>
Zero-clause BSD
</a>
<a
href="https://opensource.org/licenses/0BSD"
class="license no-attribution-license"
>
MIT No Attribution License
</a>
<a
href="https://creativecommons.org/publicdomain/zero/1.0/"
class="license public-domain-license"
>
CC0 License
</a>
<a
href="https://opensource.org/licenses/unlicense"
class="license public-domain-license"
>
The Unlicense
</a>
<a
href="https://opensource.org/licenses/BSDplusPatent"
class="license patent-grant-license"
>
BSD+Patent
</a>
<a
href="https://opensource.org/licenses/Apache-2.0"
class="license patent-grant-license"
>
Apache License 2.0
</a>
</span>
</p>
</fieldset>
</form>
<article>
<p class="copyright copyright-notice">
Copyright <span class="copyright" id="copyright-symbol">(c)</span>
<slot name="year">«YEAR»</slot>
<slot name="contributors">«AUTHORS»</slot>
</p>
<p class="copyright rights-reserved">All rights reserved</p>
<p class="copyright public-domain">
To the extent permitted under applicable law, worldwide, all copyright
holders fully waive their copyrights to this
<slot name="work">work</slot> and dedicate it to the public domain.
</p>
<p class="relicense">
You are allowed to re-license copies or modified copies of this work
under any other license, as long as it doesn't restrict permissions
granted by this license.
</p>
<p>
<span class="permission simple-permission">
Permission to use, copy, modify, and/or distribute this
<slot name="work">work</slot> for any purpose with or without fee is
hereby granted</span
><span class="permission negative-restriction">
You may do anything with this
<slot name="work">work</slot> that copyright law would normally
restrict</span
><span class="attribution minimal-attribution"
>, provided this license is preserved.</span
><span class="attribution simple-attribution"
>, provided that the above copyright notice and this permission
notice appear in all copies.</span
><span class="attribution no-attribution">.</span>
<span class="disclaimer minimal-disclaimer">
This <slot name="work">work</slot> is offered as-is, without any
warranty.
</span>
</p>
<p class="patent">
Any patents held by a contributor to this work, where they pertain to
this work, are subject to a royalty-free grant of license for purposes
of this work.
</p>
<p class="disclaimer simple-disclaimer">
This copy of the <slot name="work">work</slot> and all other copies in
whole or part, unless required by applicable law or agreed to in
writing, are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
</p>
<p class="disclaimer full-disclaimer">
THIS <slot name="work-uppercase">WORK</slot> IS PROVIDED "AS IS",
WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE
<slot name="work-uppercase">WORK</slot> OR THE USE OR OTHER DEALINGS
IN THE <slot name="work-uppercase">WORK</slot>.
</p>
</article>
</main>
<footer>
<a
class="github-fork-ribbon"
href="https://github.com/SimonMeskens/SimpleLicenseCollection"
data-ribbon="Fork me on GitHub"
title="Fork me on GitHub"
>
Fork me on GitHub
</a>
</footer>
</body>
</html>