Download frontend/pages/_document.jsx from masp307/DefakeNet: direct link, hf CLI and curl.
- Browser
- Download file 732 Bytes
-
https://huggingface.co/spaces/masp307/DefakeNet/resolve/main/frontend/pages/_document.jsx
- Command line
-
hf download hf://spaces/masp307/DefakeNet/frontend/pages/_document.jsx
-
curl -L -o _document.jsx https://huggingface.co/spaces/masp307/DefakeNet/resolve/main/frontend/pages/_document.jsx
732 Bytes
| import { Html, Head, Main, NextScript } from 'next/document'; | |
| // Ensures the correct theme class is applied before the app paints | |
| const themeInitScript = `(() => { | |
| try { | |
| const stored = localStorage.getItem('theme'); | |
| const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; | |
| const theme = stored || (prefersDark ? 'dark' : 'light'); | |
| if (theme === 'dark') document.documentElement.classList.add('dark'); | |
| } catch (e) {} | |
| })();`; | |
| export default function Document() { | |
| return ( | |
| <Html lang="en"> | |
| <Head /> | |
| <body> | |
| <script dangerouslySetInnerHTML={{ __html: themeInitScript }} /> | |
| ); | |
| } | |