mirror of
https://git.disroot.org/wolfree/wolfree-dockerfile
synced 2025-01-21 02:15:39 +01:00
enhance homepage performance for low-end devices
This commit is contained in:
parent
72d8b4e6be
commit
b58a94eff5
@ -1,37 +0,0 @@
|
||||
/* SPDX-License-Identifier: AGPL-3.0-or-later */
|
||||
|
||||
import React from "react";
|
||||
|
||||
export default (): React.JSX.Element => {
|
||||
const [insertIframe, setInsertIframe] = React.useState(false);
|
||||
|
||||
React.useEffect((): (() => void) => {
|
||||
const handleIframeLoad = (): (() => void) => {
|
||||
// Insert the iframe after a 3000ms delay.
|
||||
const timerId = setTimeout((): void => setInsertIframe(true), 3000);
|
||||
|
||||
// Cleanup the timer when the component unmounts.
|
||||
return (): void => clearTimeout(timerId);
|
||||
};
|
||||
|
||||
window.addEventListener("load", handleIframeLoad);
|
||||
|
||||
window.scroll(0, 0);
|
||||
|
||||
// Cleanup the event listener when the component unmounts.
|
||||
return (): void => window.removeEventListener("load", handleIframeLoad);
|
||||
}, []); // Empty dependency array means the effect runs only once after initial render.
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Use a descriptive title for accessibility */}
|
||||
{insertIframe && (
|
||||
<iframe
|
||||
title="Input Page Preloader"
|
||||
src="/input/"
|
||||
style={{ display: "none" }}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
@ -1,14 +0,0 @@
|
||||
/* SPDX-License-Identifier: AGPL-3.0-or-later */
|
||||
|
||||
import Footer from "@theme-original/Footer";
|
||||
import InputPreloader from "./InputPreloader";
|
||||
import React from "react";
|
||||
|
||||
export default (
|
||||
props: React.JSX.ElementAttributesProperty
|
||||
): React.JSX.Element => (
|
||||
<>
|
||||
<Footer {...props} />
|
||||
<InputPreloader />
|
||||
</>
|
||||
);
|
Loading…
Reference in New Issue
Block a user