Skip to content

Commit f030b40

Browse files
committed
22.0 beta 4
[changelog] - added version table at the top - version titles are now links - style tweaks [general] - dependencies update - minor general changes [webutils] - new 'uuid' utility
1 parent 6dd7cde commit f030b40

10 files changed

Lines changed: 420 additions & 151 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-lock.yaml

Lines changed: 253 additions & 138 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/content/changelog.njk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ eleventyNavigation:
88

99
{% addStyle "changelog" %}
1010
{% changelog changelog %}
11+
{% include 'src/templates/snippets/top.njk' %}

src/content/collections/projects/mier.info.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ several other inspirations:
4545
- [eduardorl's portfolio](https://eduardorl.vercel.app/)
4646
- [irene mateos' awesome portfolio](https://enerimateos.com/)
4747
- [Things Of Interest](https://qntm.org/)
48+
- [nothing](https://es.nothing.tech/)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: uuid
3+
desc: 'uuid generator'
4+
redirect_from: /webutils/uuid/
5+
eleventyNavigation:
6+
key: uuid
7+
---
8+
9+
<div>
10+
<div id="uuid-options">
11+
<span class="label">version</span>
12+
<select id="uuid-version">
13+
<option value="v1">v1</option>
14+
<option value="v4" selected>v4</option>
15+
<option value="v7">v7</option>
16+
<option value="guid">guid</option>
17+
</select>
18+
</div>
19+
<span class=button id="uuid-generate">generate</span>
20+
<span class=button id="uuid-copy">copy</span>
21+
<span class="output" id="uuid-output"></span>
22+
</div>

src/static/css/app/changelog.sass

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,24 @@
2222
font-size: 0.8rem
2323
color: colors.$dark
2424

25-
h1
25+
.version-title
2626
font-size: 3rem
27+
text-decoration: none
28+
29+
&:hover
30+
background-color: inherit !important
31+
color: inherit !important
32+
33+
#versions li
34+
margin: 0.5rem 0
35+
36+
.version
37+
font-size: 1.25rem
38+
39+
.date
40+
font-style: italic
41+
font-size: 0.9rem
42+
43+
.older
44+
font-style: italic
45+
color: colors.$dark

src/static/css/index.sass

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ video#background
178178
#overlay-container
179179
position: fixed
180180
bottom: 16px
181-
left: 16px
181+
left: 47%
182182
margin-bottom: 0
183183
z-index: 2
184184

@@ -253,7 +253,6 @@ video#background
253253
*:not(:last-child)
254254
margin-right: 0.5em
255255

256-
257256
#projects
258257
display: flex
259258
flex-direction: column

src/static/js/app/uuid.js

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// UUID v1 (timestamp-based)
2+
function uuidv1() {
3+
const d = new Date().getTime();
4+
const nodeId = crypto.getRandomValues(new Uint8Array(6));
5+
let uuid = 'xxxxxxxx-xxxx-1xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
6+
const r = (d + Math.random() * 16) % 16 | 0;
7+
const v = c == 'x' ? r : (r & 0x3 | 0x8);
8+
return v.toString(16);
9+
});
10+
uuid = uuid.substr(0, 23) + nodeId.reduce((acc, byte) => acc + byte.toString(16).padStart(2, '0'), '');
11+
return uuid;
12+
}
13+
14+
// UUID v4 (random)
15+
function uuidv4() {
16+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
17+
const r = Math.random() * 16 | 0;
18+
const v = c == 'x' ? r : (r & 0x3 | 0x8);
19+
return v.toString(16);
20+
});
21+
}
22+
23+
// UUID v7 (timestamp + random)
24+
function uuidv7() {
25+
const milliseconds = Date.now();
26+
const seconds = Math.floor(milliseconds / 1000);
27+
const nanos = (milliseconds % 1000) * 1e6;
28+
29+
const timestamp = BigInt(seconds) * BigInt(1e9) + BigInt(nanos);
30+
const timestampHex = timestamp.toString(16).padStart(16, '0');
31+
32+
const randomBytes = crypto.getRandomValues(new Uint8Array(10));
33+
const randomHex = Array.from(randomBytes, (b) => b.toString(16).padStart(2, '0')).join('');
34+
35+
return `${timestampHex.substr(0, 8)}-${timestampHex.substr(8, 4)}-7${timestampHex.substr(12, 3)}-${randomHex.substr(0, 4)}-${randomHex.substr(4)}`;
36+
}
37+
38+
// GUID (Microsoft's variant of UUID)
39+
function guid() {
40+
function s4() {
41+
return Math.floor((1 + Math.random()) * 0x10000)
42+
.toString(16)
43+
.substring(1);
44+
}
45+
46+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
47+
}
48+
49+
function generate() {
50+
const version = document.getElementById('uuid-version').value;
51+
52+
let uuid = '';
53+
switch (version) {
54+
case 'v1':
55+
uuid = uuidv1();
56+
break;
57+
case 'v4':
58+
uuid = uuidv4();
59+
break;
60+
case 'v7':
61+
uuid = uuidv7();
62+
break;
63+
case 'guid':
64+
uuid = guid();
65+
break;
66+
default:
67+
uuid = 'how?';
68+
break;
69+
}
70+
71+
return uuid;
72+
}
73+
74+
window.addEventListener("load", function (event) {
75+
const copy = document.getElementById('uuid-copy');
76+
const button = document.getElementById('uuid-generate');
77+
const output = document.getElementById('uuid-output');
78+
79+
copy.addEventListener('click', function (event) {
80+
navigator.clipboard.writeText(output.value);
81+
});
82+
83+
button.addEventListener('click', function (event) {
84+
output.innerHTML = generate();
85+
});
86+
87+
output.innerHTML = generate();
88+
});

src/static/js/building/changelog.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,36 @@ const processTitle = (title) => {
3333
return content
3434
}
3535

36+
37+
const buildVersionsCollapsible = (data) => {
38+
const majors = new Set(data.map(d => d.version.major))
39+
40+
let content = '<div id="versions" class="hoverborder"><h2>versions</h2><ul>'
41+
42+
majors.forEach((major) => {
43+
const fromDate = data.filter(d => d.version.major == major).slice(-1)[0].date
44+
const toDate = data.filter(d => d.version.major == major)[0].date
45+
46+
content += `<li>
47+
<a href="#version-${major}" class="version">v${major}</a>
48+
<span class="date">${fromDate} - ${toDate}</span>
49+
</li>`
50+
})
51+
52+
content += '<li><span class="older">no info available for older versions</span></li></ul></div><hr>'
53+
return content
54+
}
55+
56+
3657
const buildChangelog = (data) => {
3758
let content = '<div id="changelog">'
3859

3960
// sort commits by version
4061
data.sort((a, b) => { return a.version.major > b.version.major ? -1 : 1 })
4162

63+
// build the versions collapsible
64+
content += buildVersionsCollapsible(data)
65+
4266
// if the current version isn't in the changelog,
4367
// add it manually to the data array
4468
checkCurrent(data)
@@ -48,7 +72,7 @@ const buildChangelog = (data) => {
4872
// if the major version has changed, add a new header
4973
if (prevMajor != d.version.major) {
5074
if (prevMajor) content += '</div><hr>'
51-
content += `<div id="version-${d.version.major}"><h1>v${d.version.major}</h1>`
75+
content += `<div id="version-${d.version.major}"><h1><a class="version-title" href="#title">v${d.version.major}</a></h1>`
5276
}
5377
prevMajor = d.version.major
5478

src/static/js/index/overlay.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import {load} from './video.js';
22
let videoElement = document.getElementById('background');
33

44
// create elements
5-
let overlay_container = document.createElement('div');
5+
let overlayContainer = document.createElement('div');
66
let overlay_box = document.createElement('div');
77
let fullscreen = document.createElement('span');
88
let stop = document.createElement('span');
99
let next = document.createElement('span');
1010
let nowplaying = document.createElement('span');
1111

1212
// set attributes
13-
overlay_container.setAttribute('id', 'overlay-container');
13+
overlayContainer.setAttribute('id', 'overlay-container');
1414
overlay_box.setAttribute('id', 'overlay-box');
1515
fullscreen.setAttribute('id', 'bg-fullscreen');
1616
stop.setAttribute('id', 'bg-stop');
@@ -34,18 +34,18 @@ fullscreen.addEventListener('click', () => {
3434
videoElement.classList.remove('fullscreen');
3535
fullscreen.classList.remove('active');
3636
overlay_box.classList.remove('active');
37-
overlay_container.style.zIndex = '2';
37+
overlayContainer.style.zIndex = '2';
3838
} else {
3939
videoElement.classList.add('fullscreen');
4040
fullscreen.classList.add('active');
4141
overlay_box.classList.add('active');
42-
overlay_container.style.zIndex = '4';
42+
overlayContainer.style.zIndex = '4';
4343
}
4444
});
4545

4646
stop.addEventListener('click', () => {
4747
videoElement.remove();
48-
overlay_container.remove();
48+
overlayContainer.remove();
4949
});
5050

5151
next.addEventListener('click', () => {
@@ -56,6 +56,6 @@ next.addEventListener('click', () => {
5656
overlay_box.appendChild(fullscreen);
5757
overlay_box.appendChild(stop);
5858
overlay_box.appendChild(next);
59-
overlay_container.appendChild(overlay_box);
60-
overlay_container.appendChild(nowplaying);
61-
document.body.appendChild(overlay_container);
59+
overlayContainer.appendChild(overlay_box);
60+
overlayContainer.appendChild(nowplaying);
61+
document.body.appendChild(overlayContainer);

0 commit comments

Comments
 (0)