♻️ refactor: Move similar javascript inline code out of line

- Move variables oid, oid_likes out of line
- Move background-blur out of line
- Move fetch-repo code out of line
This commit is contained in:
Served Smart
2025-06-04 23:51:03 +02:00
parent 8387c6ea0a
commit 37ab1055e7
18 changed files with 100 additions and 155 deletions
+13
View File
@@ -0,0 +1,13 @@
function backgroundBlur() {
const script = document.currentScript;
const targetId = script && script.getAttribute("data-target-id") ? script.getAttribute("data-target-id")
: (console.error("data-target-id is null"), null);
window.addEventListener("scroll", () => {
const scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
const backgroundBlur = document.getElementById(targetId);
backgroundBlur.style.opacity = scroll / 300;
});
}
backgroundBlur();