diff --git a/assets/font.woff2 b/assets/font.woff2 new file mode 100644 index 0000000..df73aeb Binary files /dev/null and b/assets/font.woff2 differ diff --git a/assets/retrieve.js b/assets/retrieve.js new file mode 100644 index 0000000..a77e8d4 --- /dev/null +++ b/assets/retrieve.js @@ -0,0 +1,122 @@ +document.addEventListener('contextmenu', function(event) { + event.preventDefault(); +}); + +async function fetchTemperature() { + const response = await fetch('https://language.apis.zhr1.infra.elia.network/v1/thoughts/temperature'); + return response.text(); +} + +async function fetchAndDisplay() { + const responseDiv = document.querySelector('.response'); + const statsDiv = document.querySelector('.stats'); + let buffer = ""; + let charCount = 0; + let startTime = performance.now(); + let initialText = responseDiv.textContent; + const delay = 70; + const statsDelay = 40; + let lastTemperature = "..."; + let lastTemperatureUpdateTime = 0; + + + const response = await fetch('https://language.apis.zhr1.infra.elia.network/v1/thoughts/retrieve'); + const reader = response.body.getReader(); + const decoder = new TextDecoder('utf-8'); + + + while (initialText.length > 0) { + initialText = initialText.slice(0, -1); + responseDiv.textContent = initialText; + await new Promise(resolve => setTimeout(resolve, delay)); + } + + async function updateStatsAndTemperature() { + let currentTime = (performance.now() - startTime) / 1000; + let charsPerSecond = charCount / currentTime; + + + if (currentTime - lastTemperatureUpdateTime >= 1) { + try { + lastTemperature = await fetchTemperature(); + lastTemperatureUpdateTime = currentTime; + } catch (error) { + lastTemperature = "None"; + } + } + + + statsDiv.textContent = `${charsPerSecond.toFixed(1)} chars/s, ${charCount} chars, ${currentTime.toFixed(1)}s, Temp: ${lastTemperature}°C`; + } + + + async function appendTextSmoothly(textPart) { + buffer += textPart; + + while (buffer.length > 0) { + let pos = buffer.indexOf('**'); + if (pos === 0) { + let endPos = buffer.indexOf('**', 2); + if (endPos !== -1) { + responseDiv.innerHTML += '' + buffer.substring(2, endPos) + ''; + buffer = buffer.slice(endPos + 2); + } else { + break; + } + } else { + let nextPos = pos !== -1 ? pos : buffer.length; + for (let i = 0; i < nextPos; i++) { + responseDiv.innerHTML += buffer[i]; + await new Promise(resolve => setTimeout(resolve, delay)); + charCount++; + updateStatsAndTemperature(); + } + buffer = buffer.slice(nextPos); + } + } + } + + while (true) { + const { value, done } = await reader.read(); + if (done) { + if (buffer) { + responseDiv.innerHTML += buffer; + } + break; + } + const text = decoder.decode(value, { stream: true }); + await appendTextSmoothly(text); + } + + + let statsText = statsDiv.textContent; + while (statsText.length > 0) { + statsText = statsText.slice(0, -1); + statsDiv.textContent = statsText; + await new Promise(resolve => setTimeout(resolve, statsDelay)); + } + + + await new Promise(resolve => setTimeout(resolve, 200)); + const message = '// bg video from hartnett media \\\\'; + let messageIndex = 0; + while (messageIndex < message.length) { + statsDiv.textContent += message[messageIndex]; + messageIndex++; + await new Promise(resolve => setTimeout(resolve, statsDelay)); + } +} + +document.addEventListener('DOMContentLoaded', fetchAndDisplay); + +console.log(`      ___ +     /イ フ +    | _ _| +    / ミ__xノ +  /     | +   /  ヽ  ノ + │  | | |     +/ ̄|  | | |   +| ( ̄ヽ_ヽ_)_)  +\二つ`); +console.log("hello"); \ No newline at end of file diff --git a/assets/style.css b/assets/style.css new file mode 100644 index 0000000..0ae3bb7 --- /dev/null +++ b/assets/style.css @@ -0,0 +1,119 @@ + @font-face { + font-family: 'workbench'; + src: url('../assets/font.woff2') format('woff2'); + } + + body, html { + margin: 0; + padding: 0; + width: 100%; + height: 100%; + font-family: 'workbench', sans-serif; + overflow: hidden; + } + + #background-video { + position: fixed; + top: 50%; + left: 50%; + width: auto; + height: auto; + min-width: 100%; + min-height: 101%; + transform: translate(-50%, -50%); + z-index: -1; + object-fit: cover; + object-position: center; + } + + .navbar { + background: none; + padding: 1rem; + display: flex; + justify-content: space-between; + align-items: center; + pointer-events: none; + } + + .logo { + font-size: 1.5rem; + color: #D68FD6; + text-shadow: 0 0 10px #D68FD6; + } + + .nav-links { + list-style: none; + margin: 0; + padding: 0; + display: flex; + align-items: center; + } + + .nav-links li { + margin-right: 20px; + } + + .nav-links a { + font-size: 1.2rem; + color: #D68FD6; + text-decoration: none; + transition: color 0.2s ease; + text-shadow: 0 0 3px #D68FD6; + pointer-events: initial; + letter-spacing: 1px; + } + .nav-links a:hover { + color: #d6afd6; + } + .response { + text-align: center; + font-size: 2.0rem; + color: #783F8E; + text-shadow: 0 0 10px #783F8E; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 100%; + pointer-events: none; + } + .response b { + text-shadow: 1 1 30px #783F8E; + color: #7e4a92; + } + .stats { + bottom: 0.5%; + font-size: 0.8rem; + color: rgba(128, 128, 128, 0.404); + position: absolute; + left: 50%; + transform: translateX(-50%); + pointer-events: none; + white-space: nowrap; + display: block; + } + @media (max-width: 600px) { + .navbar { + flex-direction: column; + justify-content: center; + align-items: center; + } + .nav-links { + margin-top: 1rem; + display: flex; + justify-content: center; + padding: 0; + width: 100%; + } + .logo { + display: none; + } + .nav-links li { + margin: 0 10px; + text-align: center; + } + + .response { + font-size: 1.5rem !important; + } + } \ No newline at end of file diff --git a/assets/video.mp4 b/assets/video.mp4 new file mode 100644 index 0000000..7bfab2e Binary files /dev/null and b/assets/video.mp4 differ diff --git a/icons/android-chrome-192x192.png b/icons/android-chrome-192x192.png new file mode 100644 index 0000000..4d9da26 Binary files /dev/null and b/icons/android-chrome-192x192.png differ diff --git a/icons/android-chrome-512x512.png b/icons/android-chrome-512x512.png new file mode 100644 index 0000000..7086684 Binary files /dev/null and b/icons/android-chrome-512x512.png differ diff --git a/icons/apple-touch-icon.png b/icons/apple-touch-icon.png new file mode 100644 index 0000000..4dddbbd Binary files /dev/null and b/icons/apple-touch-icon.png differ diff --git a/icons/browserconfig.xml b/icons/browserconfig.xml new file mode 100644 index 0000000..9f69bab --- /dev/null +++ b/icons/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #d68fd6 + + + diff --git a/icons/favicon-16x16.png b/icons/favicon-16x16.png new file mode 100644 index 0000000..8a3c0f7 Binary files /dev/null and b/icons/favicon-16x16.png differ diff --git a/icons/favicon-32x32.png b/icons/favicon-32x32.png new file mode 100644 index 0000000..dcf326c Binary files /dev/null and b/icons/favicon-32x32.png differ diff --git a/icons/favicon.ico b/icons/favicon.ico new file mode 100644 index 0000000..60e3605 Binary files /dev/null and b/icons/favicon.ico differ diff --git a/icons/mstile-150x150.png b/icons/mstile-150x150.png new file mode 100644 index 0000000..c745982 Binary files /dev/null and b/icons/mstile-150x150.png differ diff --git a/icons/safari-pinned-tab.svg b/icons/safari-pinned-tab.svg new file mode 100644 index 0000000..b43e418 --- /dev/null +++ b/icons/safari-pinned-tab.svg @@ -0,0 +1,322 @@ + + + + +Created by potrace 1.14, written by Peter Selinger 2001-2017 + + + + + diff --git a/icons/site.webmanifest b/icons/site.webmanifest new file mode 100644 index 0000000..1edcfef --- /dev/null +++ b/icons/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..74425ed --- /dev/null +++ b/index.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + elia's website + + + + +
+ hello +
+
+ 0 chars/s + 0 chars + 0.0s + Temp: ... +
+ + + \ No newline at end of file