<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dynamic Sound with Frequency and Decibels</title>
    <style>
        #controlButton {
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
        }

        #controlButton:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
    <button id="controlButton">Play</button>

    <script>
        // Ελάχιστη και μέγιστη συχνότητα
        const minFrequency = 9000; // Ελάχιστη συχνότητα 9 kHz
        const maxFrequency = 19400; // Μέγιστη συχνότητα 19.4 kHz

        // Μέγιστο επίπεδο decibels
        const maxDecibel = 10; // Μέγιστο επίπεδο dB
        const lowFrequencyVolume = Math.pow(10, maxDecibel / 20); // Πλήρης ένταση για χαμηλή συχνότητα
        const highFrequencyVolume = Math.pow(10, (maxDecibel - 6) / 20); // Μειωμένη ένταση για υψηλή συχνότητα

        let audioContext = new (window.AudioContext || window.webkitAudioContext)();
        let oscillator;
        let gainNode;
        let isPlaying = false;
        let frequencyInterval;

        document.getElementById('controlButton').addEventListener('click', function() {
            if (!isPlaying) {
                // Δημιουργία και εκκίνηση του ταλαντωτή
                oscillator = audioContext.createOscillator();
                gainNode = audioContext.createGain();

                oscillator.type = 'square'; // Τύπος κύματος
                oscillator.connect(gainNode);
                gainNode.connect(audioContext.destination);

                oscillator.start();

                // Αλλαγή συχνότητας και έντασης σε τυχαίες τιμές
                frequencyInterval = setInterval(function() {
                    const frequency = Math.random() * (maxFrequency - minFrequency) + minFrequency;
                    const volume = frequency < 15000 ? lowFrequencyVolume : highFrequencyVolume;

                    oscillator.frequency.value = frequency;
                    gainNode.gain.value = volume;
                }, 500); // Αλλάζει συχνότητα και ένταση κάθε 500ms

                // Αλλαγή του κουμπιού σε "Pause"
                document.getElementById('controlButton').textContent = 'Pause';
                isPlaying = true;
            } else {
                // Διακοπή του ταλαντωτή
                oscillator.stop();
                oscillator.disconnect();
                gainNode.disconnect();
                clearInterval(frequencyInterval);
                isPlaying = false;

                // Αλλαγή του κουμπιού σε "Play"
                document.getElementById('controlButton').textContent = 'Play';
            }
        });
    </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>
