Skip to content

Commit cd8d212

Browse files
committed
adding key
1 parent 47a4f30 commit cd8d212

File tree

11 files changed

+130
-101
lines changed

11 files changed

+130
-101
lines changed

site/assets/fonts/OCR-B.ttf

35.9 KB
Binary file not shown.

site/assets/js/script.js

Lines changed: 57 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,71 @@
11

22

3+
document.addEventListener('DOMContentLoaded', function () {
4+
// get key from search params
5+
var urlParams = new URLSearchParams(window.location.search);
6+
var key = urlParams.get('key');
7+
var last = urlParams.get('last');
8+
if (!last)
9+
last = 1;
10+
setValue(last);
311

4-
// get key from search params
5-
var urlParams = new URLSearchParams(window.location.search);
6-
var key = urlParams.get('key');
7-
var last = urlParams.get('last');
8-
if (!last)
9-
last = 1;
10-
setValue(last);
12+
var minKey = '';
13+
var maxKey = '';
14+
for (var i = 0; i < 128; i++) {
15+
minKey += "0";
16+
maxKey += "f";
17+
}
18+
if (key == null) {
19+
key = minKey;
20+
}
21+
else {
22+
key = key.replace(/[^a-f0-9]/gi, '');
1123

12-
var minKey = '';
13-
var maxKey = '';
14-
for (var i = 0; i < 128; i++) {
15-
minKey += "0";
16-
maxKey += "f";
17-
}
18-
if (key == null) {
19-
key = minKey;
20-
}
21-
else {
22-
key = key.replace(/[^a-f0-9]/gi, '');
24+
key = key.padStart(128, '0');
25+
}
2326

24-
key = key.padStart(128, '0');
25-
}
27+
document.getElementById('sprite-id').value = key;
2628

2729

28-
function getRandom() {
29-
// make a random 128-digit hex number
30-
var r = "";
31-
for (var i = 0; i < 128; i++) {
32-
r += Math.floor(Math.random() * 16).toString(16);
30+
31+
32+
function getRandom() {
33+
// make a random 128-digit hex number
34+
var r = "";
35+
for (var i = 0; i < 128; i++) {
36+
r += Math.floor(Math.random() * 16).toString(16);
37+
}
38+
return r;
3339
}
34-
return r;
35-
}
36-
var uniqueID = BigInt('0x' + key).toString(36);
40+
var uniqueID = BigInt('0x' + key).toString(36);
3741

38-
function setValue(Value) {
39-
document.getElementById("numAdjust").value = Value;
40-
}
42+
function setValue(Value) {
43+
document.getElementById("numAdjust").value = Value;
44+
}
4145

42-
document.getElementById("btnRand").setAttribute("href", "?key=" + getRandom());
43-
document.getElementById("btnMinus").onclick = function () {
46+
document.getElementById("btnRand").setAttribute("href", "?key=" + getRandom());
47+
document.getElementById("btnMinus").onclick = function () {
4448

45-
var numAdjust = parseInt(document.getElementById("numAdjust").value);
46-
var numKey = BigInt("0x" + key);
47-
numKey -= BigInt(numAdjust);
48-
if (numKey < BigInt("0x" + minKey)) {
49-
numKey += maxKey;
49+
var numAdjust = parseInt(document.getElementById("numAdjust").value);
50+
var numKey = BigInt("0x" + key);
51+
numKey -= BigInt(numAdjust);
52+
if (numKey < BigInt("0x" + minKey)) {
53+
numKey += maxKey;
54+
}
55+
key = numKey.toString(16);
56+
window.location.href = "?key=" + key.padStart(128, '0') + "&last=" + numAdjust;
5057
}
51-
key = numKey.toString(16);
52-
window.location.href = "?key=" + key.padStart(128, '0') + "&last=" + numAdjust;
53-
}
54-
document.getElementById("btnPlus").onclick = function () {
58+
document.getElementById("btnPlus").onclick = function () {
5559

56-
var numAdjust = parseInt(document.getElementById("numAdjust").value);
57-
var numKey = BigInt("0x" + key);
58-
numKey += BigInt(numAdjust);
59-
if (numKey > BigInt("0x" + maxKey)) {
60-
numKey -= maxKey;
60+
var numAdjust = parseInt(document.getElementById("numAdjust").value);
61+
var numKey = BigInt("0x" + key);
62+
numKey += BigInt(numAdjust);
63+
if (numKey > BigInt("0x" + maxKey)) {
64+
numKey -= maxKey;
65+
}
66+
key = numKey.toString(16);
67+
window.location.href = "?key=" + key.padStart(128, '0') + "&last=" + numAdjust;
6168
}
62-
key = numKey.toString(16);
63-
window.location.href = "?key=" + key.padStart(128, '0') + "&last=" + numAdjust;
64-
}
69+
70+
71+
});
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ $my-font-family: "Work sans", sans-serif, "Noto Color Emoji";
77

88
$font-family-base: $my-font-family;
99

10+
1011
@import "bootstrap/functions";
1112

1213
// colors!
@@ -56,6 +57,4 @@ $font-family-base: $my-font-family;
5657

5758
@import "bootstrap/utilities/api";
5859

59-
@import "node_modules/bootstrap-icons/font/bootstrap-icons.scss";
60-
61-
@import "styles.scss";
60+
// @import "node_modules/bootstrap-icons/font/bootstrap-icons.scss";
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// {{ $ocrb := resources.Get "fonts/OCR-B.ttf" }}
2+
@font-face {
3+
font-family: "OCR-B";
4+
src: url("{{ $ocrb.RelPermalink }}") format("truetype");
5+
}
6+
7+
body {
8+
text-shadow: 0 .05rem .1rem rgba(0, 0, 0, .5);
9+
box-shadow: inset 0 0 5rem rgba(0, 0, 0, .5);
10+
}
11+
12+
.cover-container {
13+
max-width: 42em;
14+
}
15+
16+
17+
/*
18+
* Header
19+
*/
20+
21+
.nav-masthead .nav-link {
22+
color: rgba(255, 255, 255, .5);
23+
border-bottom: .25rem solid transparent;
24+
}
25+
26+
.nav-masthead .nav-link:hover,
27+
.nav-masthead .nav-link:focus {
28+
border-bottom-color: rgba(255, 255, 255, .25);
29+
}
30+
31+
.nav-masthead .nav-link+.nav-link {
32+
margin-left: 1rem;
33+
}
34+
35+
.nav-masthead .active {
36+
color: #fff;
37+
border-bottom-color: #fff;
38+
}
39+
40+
.key-font {
41+
font-family: "OCR-B";
42+
font-weight: lighter;
43+
font-size: small;
44+
45+
}

site/assets/scss/styles.scss

Lines changed: 0 additions & 32 deletions
This file was deleted.

site/hugo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ ignoreErrors = ["error-disable-taxonomy", "error-no-layout"]
3535
[[module.mounts]]
3636
source = "node_modules/bootstrap/dist/js/bootstrap.bundle.js"
3737
target = "assets/js/bootstrap.bundle.js"
38-
[[module.mounts]]
39-
source = "node_modules/bootstrap-icons/font/fonts"
40-
target = "static/css/fonts"
4138
[[module.mounts]]
4239
source = "../infinite-engine/Export/html5/bin/InfiniteEngine.js"
4340
target = "assets/js/InfiniteEngine.js"

site/layouts/_default/home.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ <h1 class="masthead-brand display-2">Infinite Pixels</h1>
1010

1111
{{ define "footer" }}
1212
<div class="d-flex flex-column justify-content-evenly " style="height: 200px;">
13-
{{/* show the current id of this sprite */}}
13+
<div class="input-group ">
14+
<span class="input-group-text" id="sprite-id-label">
15+
<i class="fa-regular fa-map-location input-group-text fa-lg" style="border:none;"></i>
16+
</span>
17+
18+
<input type="text" id="sprite-id" class="form-control key-font " value="" aria-describedby="sprite-id-label">
19+
</div>
1420

1521
<div class="d-flex">
1622
<button id="btnMinus" class="btn btn-primary btn-sm px-4">-</button>
@@ -33,7 +39,7 @@ <h1 class="masthead-brand display-2">Infinite Pixels</h1>
3339
<button class="btn btn-dark btn-seondary btn-sm" id="btnV1e10" onclick="setValue(10000000000);">1e10</button>
3440

3541
</div>
36-
<a href="" id="btnRand" class="btn btn-primary btn-sm">Random</a>
42+
<a href="" id="btnRand" class="btn btn-primary btn-sm">Random</a>
3743
</div>
3844

3945

site/layouts/partials/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<meta name="robots" content="all" />
1313

14-
{{- partialCached "head/css.html" . }}
14+
{{- partial "head/css.html" . }}
1515

1616
{{- partial "head/google.html" -}}
1717

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
{{ if hugo.IsProduction }}
32
{{ $bootstrap := resources.Get "js/bootstrap.bundle.min.js" }}
43

@@ -7,6 +6,7 @@
76
{{ else }}
87
{{ $bootstrap := resources.Get "js/bootstrap.bundle.js" }}
98

10-
<script src="{{ $bootstrap.RelPermalink }}" ></script>
9+
<script src="{{ $bootstrap.RelPermalink }}"></script>
1110

12-
{{ end}}
11+
{{ end}}
12+
<script src="https://kit.fontawesome.com/6abed6a49d.js" crossorigin="anonymous"></script>
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
<style>
22
@import url('https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&family=Work+Sans:ital@0;1&display=swap');
33
</style>
4-
4+
55
{{- $options := dict
66
"targetPath" "css/styles.css"
77
"outputStyle" "compressed"
88
"enableSourceMap" (not hugo.IsProduction)
99
-}}
10-
{{- with resources.Get "/scss/main.scss" | toCSS $options | minify -}}
11-
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" media="screen" crossorigin="anonymous" />
12-
{{- end -}}
10+
{{- $cssMain := resources.Get "scss/abstract/core.scss" | resources.ExecuteAsTemplate "scss/core.scss" . -}}
11+
{{- $cssStyles := resources.Get "scss/abstract/styles.scss" | resources.ExecuteAsTemplate "scss/styles.scss" . -}}
12+
13+
{{- $styles := slice $cssMain $cssStyles | resources.Concat "scss/main.scss" | toCSS $options | minify | fingerprint -}}
14+
15+
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen"
16+
crossorigin="anonymous">

0 commit comments

Comments
 (0)