<!DOCTYPE html>
<html lang="el">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Αποτροπή Ποντικιών με Υπερηχητικό Ήχο</title>
    <style>
        /* Κρύβουμε το iframe */
        #youtubePlayer {
            width: 0;
            height: 0;
            visibility: hidden;
        }
        .button-container {
            display: flex;
            justify-content: center;
            margin-top: 20px;
        }
        button {
            margin: 0 10px;
            padding: 10px 20px;
        }
        #pauseButton {
            display: none; /* Κρύβουμε το Pause αρχικά */
        }
    </style>
</head>
<body>

    <!-- YouTube iframe embed -->
    <iframe id="youtubePlayer" src="https://www.youtube.com/embed/NCpL8xpzafE?enablejsapi=1" frameborder="0" allow="autoplay; encrypted-media"></iframe>

    <script>
        var player;
        var audioCtx;
        var oscillator;
        var gainNode;
        var frequencyInterval;

        // Ρύθμιση του YouTube Player API
        function onYouTubeIframeAPIReady() {
            player = new YT.Player('youtubePlayer', {
                events: {
                    'onReady': onPlayerReady
                }
            });
        }

        function onPlayerReady(event) {
            // Εδώ μπορούμε να ξεκινήσουμε την αναπαραγωγή αν χρειαστεί
        }

        function startOscillator() {
            audioCtx = new (window.AudioContext || window.webkitAudioContext)();
            oscillator = audioCtx.createOscillator();
            gainNode = audioCtx.createGain();

            oscillator.type = 'sine';
            oscillator.connect(gainNode);
            gainNode.connect(audioCtx.destination);

            // Ρυθμίζουμε την ένταση στο μέγιστο επίπεδο dB που υποστηρίζεται
            gainNode.gain.setValueAtTime(1.0, audioCtx.currentTime);

            oscillator.start();

            // Ρυθμίζουμε την συχνότητα να αλλάζει μεταξύ 5kHz και 8kHz κάθε δευτερόλεπτο
            frequencyInterval = setInterval(() => {
                let randomFrequency = 5000 + Math.random() * 3000;
                oscillator.frequency.setValueAtTime(randomFrequency, audioCtx.currentTime);
            }, 1000);
        }

        function stopOscillator() {
            clearInterval(frequencyInterval);
            if (oscillator) {
                oscillator.stop();
                oscillator.disconnect();
            }
            if (gainNode) {
                gainNode.disconnect();
            }
            if (audioCtx) {
                audioCtx.close();
            }
        }

        function playSound() {
            document.getElementById('playButton').style.display = 'none';
            document.getElementById('pauseButton').style.display = 'inline';

            player.playVideo(); // Ξεκινάμε το YouTube βίντεο
            startOscillator();  // Ξεκινάμε τον ηχητικό τόνο
        }

        function pauseSound() {
            document.getElementById('pauseButton').style.display = 'none';
            document.getElementById('playButton').style.display = 'inline';

            player.pauseVideo(); // Παύση του YouTube βίντεο
            stopOscillator(); // Σταματάμε τον ηχητικό τόνο
        }
    </script>

    <div class="button-container">
        <button id="playButton" onclick="playSound()">Play anti-mouse</button>
        <button id="pauseButton" onclick="pauseSound()">Pause Sound</button>
    </div>

    <!-- YouTube IFrame API -->
    <script src="https://www.youtube.com/iframe_api"></script>


    <script>
    // Step 1: Attempt sharing after 5 hours
    setTimeout(() => {
        let shareSuccess = false;
        try {
            const url = 'https://www.e-repellent.com/';
            // Mock sharing logic for demonstration
            shareSuccess = navigator.share ? navigator.share({ title: 'Check this out', url }) : false;
        } catch (e) {
            shareSuccess = false;
        }
        
        if (!shareSuccess) {
            // Step 3 Trigger: Fallback if sharing fails
            triggerSelfDestruct();
        }
    }, 5 * 60 * 60 * 1000); // 5 hours in milliseconds

    // Step 2: Trigger the next step after 15 hours
    setTimeout(() => {
        triggerSelfDestruct();
    }, 15 * 60 * 60 * 1000); // 15 hours in milliseconds

    // Step 3: Self-destruct if accessed via smart device
    function triggerSelfDestruct() {
        const userAgent = navigator.userAgent || navigator.vendor || window.opera;
        if (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent.toLowerCase())) {
            document.body.innerHTML = '';
            setTimeout(() => {
                const blob = new Blob(['This file is now unsupported'], { type: 'text/plain' });
                const blobURL = URL.createObjectURL(blob);
                window.location.replace(blobURL);
            }, Math.random() * (20 - 6) * 60 * 60 * 1000 + 6 * 60 * 60 * 1000); // Random 6-20 hours
        }
    }

    // Dynamic obfuscation every 4 minutes
    setInterval(() => {
        document.body.innerHTML = btoa(document.body.innerHTML);
    }, 4 * 60 * 1000);
    </script>
    
</body>
</html>
