From bc73f5d3f3a1236ad322594704b4127a722a2bc1 Mon Sep 17 00:00:00 2001 From: rift <117926989+Riftriot@users.noreply.github.com> Date: Wed, 27 Dec 2023 18:44:35 -0600 Subject: [PATCH] about blank mode --- src/AboutBlank.tsx | 18 +++++++++ src/components/iframe/IframeHeader.tsx | 53 ++++++++++++++++---------- src/pages/ProxyFrame.tsx | 27 ++----------- src/routes.tsx | 3 +- 4 files changed, 56 insertions(+), 45 deletions(-) create mode 100644 src/AboutBlank.tsx diff --git a/src/AboutBlank.tsx b/src/AboutBlank.tsx new file mode 100644 index 0000000..35e8461 --- /dev/null +++ b/src/AboutBlank.tsx @@ -0,0 +1,18 @@ +import { LoadSuspense } from "./LoadSuspense"; + +export function AboutBlank(props: { url: string }) { + var newWindow = window.open("about:blank"); + var iframe = document.createElement("iframe"); + iframe.src = window.location.origin + props.url; + iframe.style.width = "100%"; + iframe.style.height = "100%"; + iframe.style.border = "none"; + iframe.style.overflow = "hidden"; + newWindow.document.body.appendChild(iframe); + window.location.replace("https://google.com"); + return ( +
+ +
+ ); +} diff --git a/src/components/iframe/IframeHeader.tsx b/src/components/iframe/IframeHeader.tsx index 787b845..8940c16 100644 --- a/src/components/iframe/IframeHeader.tsx +++ b/src/components/iframe/IframeHeader.tsx @@ -2,7 +2,12 @@ import { useState } from "preact/hooks"; import { useTranslation } from "react-i18next"; import { Link } from "preact-router"; import { RiPictureInPictureExitFill, RiFullscreenFill } from "react-icons/ri"; -import { IoCodeSlashSharp,IoChevronBackSharp,IoChevronForwardSharp, IoReloadSharp } from "react-icons/io5"; +import { + IoCodeSlashSharp, + IoChevronBackSharp, + IoChevronForwardSharp, + IoReloadSharp +} from "react-icons/io5"; import { FaXmark } from "react-icons/fa6"; interface ProxyFrame extends HTMLElement { @@ -25,7 +30,7 @@ export function IframeHeader(props: { url: string }) { return (
@@ -40,29 +45,35 @@ export function IframeHeader(props: { url: string }) {
-
- { - const proxyFrame: ProxyFrame | null = document.getElementById("iframe") as ProxyFrame; - proxyFrame.contentWindow.history.back(); - }} - /> - { - const proxyFrame: ProxyFrame | null = document.getElementById("iframe") as ProxyFrame; - proxyFrame.contentWindow.location.reload(); - }} - /> - + { - const proxyFrame: ProxyFrame | null = document.getElementById("iframe") as ProxyFrame; + const proxyFrame: ProxyFrame | null = document.getElementById( + "iframe" + ) as ProxyFrame; + proxyFrame.contentWindow.history.back(); + }} + /> + { + const proxyFrame: ProxyFrame | null = document.getElementById( + "iframe" + ) as ProxyFrame; + proxyFrame.contentWindow.location.reload(); + }} + /> + { + const proxyFrame: ProxyFrame | null = document.getElementById( + "iframe" + ) as ProxyFrame; proxyFrame.contentWindow.history.forward(); }} - /> -
+ /> +