{"id":688,"date":"2023-12-29T13:54:17","date_gmt":"2023-12-29T20:54:17","guid":{"rendered":"https:\/\/ourcarnivorejourney.com\/?page_id=688"},"modified":"2024-01-11T20:31:20","modified_gmt":"2024-01-12T03:31:20","slug":"cheryl","status":"publish","type":"page","link":"https:\/\/ourcarnivorejourney.com\/index.php\/cheryl\/","title":{"rendered":"Cheryl&#8217;s Water Timer"},"content":{"rendered":"\n<!DOCTYPE html>\n<html>\n<head>\n    <title>Cheryl&#8217;s Water Timer<\/title>\n    <style>\n        body {\n            text-align: center;\n        }\n        .cheryls-timer-container {\n            display: inline-block;\n            padding: 0.00in 0.50in 0.00in 0.50in;\n            border: 6px solid purple;\n            background-color: white;\n            margin: 0 auto;\n        }\n        .cheryls-timer-container h2, \n        .cheryls-timer-container #timer {\n    color: purple;\n    font-size: 64px; \/* Double the font size *\/\n} \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: 80%;\n            padding: 10px;\n            margin: 10px auto;\n            display: block;\n            font-size: 24px;\n            text-align: center;\n            font-weight: bold;\n            border: 3px 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: 2px solid purple;\n        }\n        .cheryls-timer-container input[type=range] {\n            cursor: pointer;\n            width: 80%;\n            margin: 10px auto;\n        }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"cheryls-timer-container\">\n        <h2>Cheryl&#8217;s Water Timer<\/h2>\n        <div id=\"timer\">00:00<\/div>\n\n        <input type=\"number\" id=\"minutesInput\" placeholder=\"Minutes\" value=\"10\" onchange=\"updateInitialTimerDisplay()\">\n        <button onclick=\"startTimer()\">Start Timer<\/button>\n        <button onclick=\"resetTimer()\">Reset Timer<\/button><br><br>\n\n        <input type=\"text\" id=\"glassesInput\" value=\"0 Gallons, 1 Quart\" readonly>\n        <button onclick=\"addQuartJar()\">Add a Quart Jar<\/button>\n        <button onclick=\"resetGlasses()\">Reset Jars<\/button><br><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\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            if (countdown) clearInterval(countdown);\n            if (tickInterval) clearInterval(tickInterval);\n\n            countdown = setInterval(function() {\n                var minutes = parseInt(seconds \/ 60, 10);\n                var secondsRemaining = parseInt(seconds % 60, 10);\n\n                minutes = minutes < 10 ? \"0\" + minutes : minutes;\n                secondsRemaining = secondsRemaining < 10 ? \"0\" + secondsRemaining : secondsRemaining;\n\n                document.getElementById('timer').textContent = minutes + \":\" + secondsRemaining;\n\n                if (--seconds < 0) {\n                    clearInterval(countdown);\n                    beep(500, 520, currentVolume * 100);\n                    startTick();\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\n\n\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(audioContext.currentTime);\n    oscillator.stop(audioContext.currentTime + (duration * 0.001));\n\n    \/\/ Delayed second beep with double the pause\n    setTimeout(function() {\n        oscillator = audioContext.createOscillator();\n        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(audioContext.currentTime);\n        oscillator.stop(audioContext.currentTime + (duration * 0.001));\n    }, 2 * duration); \/\/ Double the pause duration\n}\n\n        function startTick() {\n            tickInterval = setInterval(function() {\n                beep(100, 1000, currentVolume * 50);\n            }, 4000);\n        }\n\n        function addQuartJar() {\n            var currentText = document.getElementById('glassesInput').value;\n            var matches = currentText.match(\/(\\d+) Gallon(s)?, (\\d+) Quart(s)?\/);\n            var gallons = parseInt(matches[1], 10);\n            var quarts = parseInt(matches[3], 10);\n\n            quarts++; \/\/ Increment the quarts\n            if (quarts >= 4) {\n                gallons++;\n                quarts -= 4; \/\/ Reset quarts after converting to a gallon\n            }\n\n            updateGlassesCount(gallons, quarts);\n        }\n\n        function updateGlassesCount(gallons, quarts) {\n            var displayText = gallons + \" Gallon\" + (gallons === 1 ? \"\" : \"s\") + \", \" + quarts + \" Quart\" + (quarts === 1 ? \"\" : \"s\");\n            document.getElementById('glassesInput').value = displayText;\n        }\n\n        function resetGlasses() {\n            updateGlassesCount(0, 1);\n        }\n\n        function updateInitialTimerDisplay() {\n            var minutes = document.getElementById('minutesInput').value.padStart(2, '0');\n            document.getElementById('timer').textContent = minutes + \":00\";\n        }\n\n        \/\/ Initialize timer display\n        updateInitialTimerDisplay();\n    <\/script>\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Cheryl&#8217;s Water Timer Cheryl&#8217;s Water Timer 00:00 Start Timer Reset Timer Add a Quart Jar 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-688","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/pages\/688","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=688"}],"version-history":[{"count":31,"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/pages\/688\/revisions"}],"predecessor-version":[{"id":791,"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/pages\/688\/revisions\/791"}],"wp:attachment":[{"href":"https:\/\/ourcarnivorejourney.com\/index.php\/wp-json\/wp\/v2\/media?parent=688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}