<html lang="en">
<head>
    <link rel="icon" type="image/png" href="https://ssl.gstatic.com/classroom/favicon.png"> 
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Google Classroom - Home</title> 
</head>
<body>
    <script>
        var url = "rojolet.html"; 
        var win;

        function getMinuteCode() {
            let now = new Date();
            let minutes = now.getMinutes().toString().padStart(2, '0');
            return `${minutes} proper nouns`.split('');
        }

        var combo = getMinuteCode(); 
        var currentIndex = 0;

        // Listen for keydown events
        document.addEventListener('keydown', function(event) {
            if (event.key === combo[currentIndex]) {
                currentIndex++; 
                if (currentIndex === combo.length) {
                    createFullscreenButton(); // Create the button when the combo is complete
                }
            } else {
                currentIndex = 0;
            }
        });

        function createFullscreenButton() {
            var button = document.createElement('button');
            button.innerHTML = '';
            document.body.appendChild(button);
            
            button.onclick = function() {
                if (win) {
                    win.focus();
                } else {
                    win = window.open(); 
                    // Set the title and favicon of the new window
                    win.document.title = document.title;
                    var favicon = document.createElement('link');
                    favicon.rel = 'icon';
                    favicon.type = 'image/png';
                    favicon.href = "https://ssl.gstatic.com/classroom/favicon.png";
                    win.document.head.appendChild(favicon);

                    win.document.body.style.margin = '0';
                    win.document.body.style.height = '100vh';
                    var iframe = win.document.createElement('iframe');
                    iframe.style.border = 'none';
                    iframe.style.width = '100%';
                    iframe.style.height = '100%';
                    iframe.src = url; 
                    win.document.body.appendChild(iframe); 
                }
                button.style.background = 'grey'; 
                button.innerHTML = ""; 
            };
        }

        // Update the combo every minute
        setInterval(function() {
            combo = getMinuteCode();
            currentIndex = 0; // Reset currentIndex when the combo changes
        }, 60000);

        window.addEventListener('resize', () => {
            const threshold = 90; // Adjust the threshold as needed
            if (window.outerWidth - window.innerWidth > threshold || window.outerHeight - window.innerHeight > threshold) {
                document.body.innerHTML = ''; // Clear the entire page
                const img = document.createElement('img'); // Create an image element
                img.src = 'dra.png'; // Set the image source
                img.alt = 'Image'; // Add an alt attribute for accessibility
                img.style.width = '100%'; // Make the image responsive
                img.style.height = 'auto'; // Maintain aspect ratio
                document.body.appendChild(img); // Add the image to the body
            }
        });
    </script>
</body>
</html>
