{"id":767,"date":"2024-01-11T09:09:14","date_gmt":"2024-01-11T16:09:14","guid":{"rendered":"https:\/\/ourcarnivorejourney.com\/?page_id=767"},"modified":"2024-01-11T20:36:38","modified_gmt":"2024-01-12T03:36:38","slug":"cheryls-water-timer-2","status":"publish","type":"page","link":"https:\/\/ourcarnivorejourney.com\/index.php\/cheryls-water-timer-2\/","title":{"rendered":"Cheryl&#8217;s Water Timer #2"},"content":{"rendered":"\n<!DOCTYPE html>\n<html>\n<head>\n    <title>Cheryl&#8217;s Water Timer #2<\/title>\n    <style>\n        body {\n            text-align: center; \/* Center alignment for all content *\/\n        }\n        .cheryls-timer-container {\n            display: inline-block;\n            padding: 0.00in 0.5in 0.5in 0.5in;\n            border: 4px solid purple; \/* Restoring the purple frame *\/\n            background-color: white;\n            margin: 0 auto; \/* Center the container *\/\n        }\n        .cheryls-timer-container h2, \n        .cheryls-timer-container #timer, \n        .cheryls-timer-container label, \n        .cheryls-timer-container button, \n        .cheryls-timer-container input {\n            color: purple;\n        }\n        .cheryls-timer-container #minutesInput, \n        .cheryls-timer-container #glassesInput {\n            width: 60%;\n            padding: 10px;\n            margin: 10px auto;\n            display: block;\n            font-size: 16px;\n            text-align: center;\n            font-weight: bold;\n            border: 1px solid purple;\n        }\n        .cheryls-timer-container button {\n            display: inline-block;\n            padding: 10px 20px;\n            margin: 5px;\n            cursor: pointer;\n            background-color: white;\n            border: 1px solid purple;\n        }\n        .cheryls-timer-container input[type=range] {\n            cursor: pointer;\n            width: 60%;\n            margin: 10px auto;\n        }\n        .digital-display {\n            font-family: 'Digital-7', monospace;\n            font-size: 24px;\n            color: #00ff00;\n            background-color: #000000;\n            border: none;\n            text-align: center;\n        }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"cheryls-timer-container\">\n        <h2>Cheryl&#8217;s Water Timer #2<\/h2>\n        <div id=\"timer\">10:00<\/div>\n\n        <input type=\"number\" id=\"minutesInput\" placeholder=\"Minutes\" value=\"10\" onchange=\"resetTimer()\">\n        <button onclick=\"startTimer()\">Start Timer<\/button>\n        <button onclick=\"resetTimer()\">Reset Timer<\/button>\n\n        <input type=\"text\" id=\"glassesInput\" class=\"digital-display\" value=\"0 Gallons\" readonly>\n        <button onclick=\"addQuart()\">Add a Quart<\/button>\n        <button onclick=\"addCup()\">Add a Cup<\/button>\n        <button onclick=\"resetGlasses()\">Reset Jars<\/button><br>\n        \n        <label for=\"volumeControl\">Volume:<\/label>\n        <input type=\"range\" id=\"volumeControl\" min=\"0\" max=\"100\" value=\"50\">\n    <\/div>\n\n    <script>\n        var countdown, tickInterval;\n        var audioContext = new (window.AudioContext || window.webkitAudioContext)();\n        var currentVolume = 0.5;\n        var totalGallons = 0; \/\/ Track total gallons consumed\n\n        document.getElementById('volumeControl').addEventListener('input', function() {\n            currentVolume = this.value \/ 100;\n        });\n\n        function startTimer() {\n            var minutes = parseInt(document.getElementById('minutesInput').value);\n            var seconds = minutes * 60;\n            clearInterval(countdown);\n            clearInterval(tickInterval);\n\n            countdown = setInterval(function() {\n                var minutes = Math.floor(seconds \/ 60);\n                var secondsRemaining = seconds % 60;\n\n                document.getElementById('timer').textContent = minutes.toString().padStart(2, '0') + \":\" + secondsRemaining.toString().padStart(2, '0');\n\n                if (--seconds < 0) {\n                    clearInterval(countdown);\n                    beepAndTick();\n                }\n            }, 1000);\n        }\n\nfunction resetTimer() {\n    clearInterval(countdown); \/\/ Clear the countdown interval\n    clearInterval(tickInterval); \/\/ Clear the tick interval for sounds\n    var minutes = parseInt(document.getElementById('minutesInput').value);\n    document.getElementById('timer').textContent = minutes.toString().padStart(2, '0') + \":00\";\n    \/\/ Removed the call to startTimer(), so the timer resets but does not start automatically.\n}\n\n\nfunction beepAndTick() {\n    \/\/ First beep\n    beep(500, 520, currentVolume * 100);\n\n    \/\/ Second beep after 500 ms\n    setTimeout(function() {\n        beep(500, 520, currentVolume * 100);\n    }, 500);\n\n    \/\/ Start the click pattern after an additional 1-second pause\n    setTimeout(function() {\n        tickInterval = setInterval(function() {\n            \/\/ Click sound\n            beep(100, 1000, currentVolume * 50);\n\n            \/\/ Second click after 500 ms\n            setTimeout(function() {\n                beep(100, 1000, currentVolume * 50);\n            }, 500);\n        }, 1500); \/\/ Repeat the click pattern every 1.5 seconds (500 ms between clicks, 1-second pause)\n    }, 1000 + 500);\n}\n\n\/\/ Ensure beep function is correctly implemented\nfunction beep(duration, frequency, volume) {\n    var oscillator = audioContext.createOscillator();\n    var gainNode = audioContext.createGain();\n\n    oscillator.connect(gainNode);\n    gainNode.connect(audioContext.destination);\n\n    gainNode.gain.value = volume * 0.01;\n    oscillator.frequency.value = frequency;\n    oscillator.type = \"square\";\n\n    oscillator.start();\n    setTimeout(function() {\n        oscillator.stop();\n    }, duration);\n}\n\n\n\n        function addQuart() {\n            totalGallons += 0.25; \/\/ Add 0.25 gallons\n            updateGlassesDisplay();\n        }\n\n        function addCup() {\n            totalGallons += 0.0625; \/\/ Add 0.0625 gallons\n            updateGlassesDisplay();\n        }\n\n        function updateGlassesDisplay() {\n            document.getElementById('glassesInput').value = totalGallons.toFixed(2) + \" Gallons\";\n        }\n\n        function resetGlasses() {\n            totalGallons = 0;\n            updateGlassesDisplay();\n        }\n    <\/script>\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Cheryl&#8217;s Water Timer #2 Cheryl&#8217;s Water Timer #2 10:00 Start Timer Reset Timer Add a Quart Add a Cup Reset Jars Volume:<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","site-transparent-header":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"class_list":["post-767","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/pages\/767","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/comments?post=767"}],"version-history":[{"count":21,"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/pages\/767\/revisions"}],"predecessor-version":[{"id":792,"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/pages\/767\/revisions\/792"}],"wp:attachment":[{"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/media?parent=767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}