From 2339edcc39bb0bd52ca0e2d39d72dcc747c798d2 Mon Sep 17 00:00:00 2001 From: ari melody Date: Fri, 17 May 2024 13:23:12 +0100 Subject: [PATCH] better caching, fixed cumulative layout shifts! --- nginx.conf | 11 ++++++++++- public/script/main.js | 7 ++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/nginx.conf b/nginx.conf index 2b959e6..99b718a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -10,7 +10,12 @@ server { client_max_body_size 0; - add_header Cache-Control "max-age=14400"; + gzip on; + gzip_types text/plain application/xml text/css application/javascript; + gzip_proxied no-cache no-store private expired auth; + gzip_min_length 1000; + + add_header Cache-Control "max-age=2628000"; server_tokens off; @@ -18,6 +23,10 @@ server { try_files $uri $uri/ $uri.html =404; rewrite ^/music/(.*)$ https://mellodoot.com/music/$1 last; } + + location ~* /img/buttons/.*.(png|ico|gif|jpg|jpeg)$ { + add_header Cache-Control "max-age=31536000"; + } location = /give_me_money { return 301 https://smokepowered.com; diff --git a/public/script/main.js b/public/script/main.js index 1b6ba1c..9bc1051 100644 --- a/public/script/main.js +++ b/public/script/main.js @@ -4,11 +4,12 @@ const hamburger = document.getElementById("header-links-toggle"); function type_out(e) { const text = e.innerText; const original = e.innerHTML; - e.innerText = ""; const delay = 25; let chars = 0; + let html = ""; function insert_char(character, parent) { + if (chars == 0) parent.innerHTML = ""; const c = document.createElement("span"); c.innerText = character; parent.appendChild(c); @@ -20,7 +21,7 @@ function type_out(e) { } function increment_char() { - const newchar = text.substring(chars - 1, chars); + const newchar = text.substring(chars, chars + 1); insert_char(newchar, e); chars++; if (chars <= text.length) { @@ -63,4 +64,4 @@ document.addEventListener("click", event => { if (!header_links.contains(event.target) && !hamburger.contains(event.target)) { header_links.classList.remove("open"); } -}); \ No newline at end of file +});