Scripts definition

This commit is contained in:
Saahil dutta 2024-06-17 17:51:56 -04:00
parent fcc04890fe
commit 04ee7a0588
2 changed files with 24 additions and 1 deletions

View file

@ -1,7 +1,27 @@
import { useEffect, useRef } from "react";
import "./style.css"; import "./style.css";
export default function Background() { export default function Background() {
const domRef = useRef(null)
useEffect (() => {
const inter = setInterval(() => {
if(document.hasFocus() && domRef.current) {
//@ts-expect-error
domRef.current.style.filter = "blur(10px)"
} else {
//@ts-ignore
domRef.current.style.filter = "";
}
})
return () => {
clearInterval(inter)
}
}, []);
return ( return (
<div style={{ filter: 'blur(10px)'}}> <div style={{ filter: 'blur(10px)' }} ref={domRef}>
<ul className="background"> <ul className="background">
{new Array(49).join('.').split('.').map((_,i) => { {new Array(49).join('.').split('.').map((_,i) => {
return <li key={i} className={i % 2 === 0 ? "bg-effect" : ""}></li> return <li key={i} className={i % 2 === 0 ? "bg-effect" : ""}></li>

View file

@ -6,10 +6,13 @@ export function runTitle() {
if(document.title !== 'Come Back :(') { if(document.title !== 'Come Back :(') {
title0 = document.title title0 = document.title
} }
window.document.documentElement.className = "duration-500 ease-in-out "
if (document.hasFocus()) { if (document.hasFocus()) {
document.title = title0 || "Saahild.com" document.title = title0 || "Saahild.com"
window.document.documentElement.style.filter = ""
} else { } else {
document.title = 'Come Back :(' document.title = 'Come Back :('
window.document.documentElement.style.filter = "blur(30px)"
} }
}, 200) }, 200)