diff --git a/plugins/inview/main/plugin.tsx b/plugins/inview/main/plugin.tsx new file mode 100644 index 0000000..ac0453f --- /dev/null +++ b/plugins/inview/main/plugin.tsx @@ -0,0 +1,60 @@ +import { definePlugin } from "@revenge/plugin"; +import React, { useState } from "react"; + +export default definePlugin({ + name: "InView", + description: "Open WebView instead of classic browser", + + onStart() { + const originalOpen = window.open; + window.open = (url: string, name?: string) => { + showWebView(url, name || url); + }; + }, + + onStop() { + window.open = originalOpen; + }, +}); + +function showWebView(url: string, title: string) { + // React + const modal = document.createElement("div"); + document.body.appendChild(modal); + + const WebViewModal = () => { + const [visible, setVisible] = useState(true); + + if (!visible) return null; + + return ( +