<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>About:Blank Cloaker</title>

    <style>
        button {
            padding: 10px 20px;
            font-size: 18px;
            margin-top: 10px;
            cursor: pointer;
        }

        input {
            padding: 10px;
            font-size: 18px;
        }

        iframe {
            width: 100%;
            height: 100%;
            border: none;
        }

        * {
            background-color: black;
            color: rgb(196, 196, 196);
            font-family: monospace;
        }

        input,
        button {
            background-color: #131313;
            border: #0a0a0a;
            border-width: 3px;
            border-radius: 3px;
            border-style: solid;
            margin: 1.4px;
            cursor: pointer;
        }
    </style>

<link href="./prism.css" rel="stylesheet" />
</head>

<body>
    <h2>About:Blank Cloaker</h2>
    <p>Enter details below, and it will open in a new about:blank page (Be sure to copy the whole url with the https)</p>
    <form id="cloakerForm">
        <label for="cloakUrl">URL:</label>
        <input type="url" id="cloakUrl" placeholder="Enter URL" required><br>
        <label for="cloakTitle">Title:</label>
        <input type="text" id="cloakTitle" placeholder="Enter title" required><br>
        <label for="cloakFav">Favicon URL:</label>
        <input type="url" id="cloakFav" placeholder="Enter favicon URL"><br>
        <button type="button" onclick="openAboutBlank()">Open</button>
        <button type="button" onclick="setGoogleDefaults()">Set Google Defaults</button>
        <button type="button" onclick="setGdriveDefaults()">Set Google Drive Defaults</button>
     </form>

    <script>
        function openAboutBlank() {
            let win = window.open();
            let frame = win.document.createElement("iframe");
            frame.style = "height:100vh;width:100vw;position:absolute;top:0;left:0;border:none";
            frame.src = document.querySelector("#cloakUrl").value;
            win.document.body.append(frame);
            win.document.title = document.querySelector("#cloakTitle").value;
            let faviconUrl = document.querySelector('#cloakFav').value;
            if (faviconUrl) {
                win.document.head.innerHTML += `<link rel="icon" href="${faviconUrl}">`;
            }
        }

        function setGoogleDefaults() {
            document.querySelector('#cloakTitle').value = 'Google';
            document.querySelector('#cloakFav').value = 'https://www.google.com/favicon.ico';
        }
        function setGdriveDefaults() {
            document.querySelector('#cloakTitle').value = 'Google Drive';
            document.querySelector('#cloakFav').value = 'https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png';
        }
    </script>
</body>

</html>