commit 997e70841ef8e4421c32f971e1cdee8575edc5cb Author: BinaryDigitDev Date: Mon Oct 14 11:48:35 2024 -0400 changed files diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..ff72b68 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Kyle Lewis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b1cd854 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# Pomodoro Countdown Timer + +I've forked Bear's awesome [pomodoro-timer](https://github.com/SpectacledBear/pomodoro-timer) project and added styling with [PaperCSS](https://www.getpapercss.com/) and a new alarm sound from [Pixabay](https://pixabay.com/sound-effects/?utm_source=link-attribution&utm_medium=referral&utm_campaign=music&utm_content=6402). Tomato favicon via [Twemoji](https://github.com/twitter/twemoji). + + +
+ +I created this simple HTML page to assist me in using the Pomodoro technique. It provides a countdown timer based on the three activities outlined in this technique. + +For more information on the Pomodoro technique, please check its [website](http://pomodorotechnique.com/). + +## Licensing + +For more information on licensing for this code, please read the LICENSE.txt file included in this repository. + +The alarm sound is licensed using a [CC BY-NC 4.0 license](http://creativecommons.org/licenses/by-nc/4.0/). The original file was downloaded from http://www.orangefreesounds.com/alarm-clock-ringing/. diff --git a/asset/alarm-clock-short.mp3 b/asset/alarm-clock-short.mp3 new file mode 100644 index 0000000..8798c42 Binary files /dev/null and b/asset/alarm-clock-short.mp3 differ diff --git a/asset/alarmclock.mp3 b/asset/alarmclock.mp3 new file mode 100644 index 0000000..eee094b Binary files /dev/null and b/asset/alarmclock.mp3 differ diff --git a/asset/android-chrome-192x192.png b/asset/android-chrome-192x192.png new file mode 100644 index 0000000..ab7a0d2 Binary files /dev/null and b/asset/android-chrome-192x192.png differ diff --git a/asset/android-chrome-512x512.png b/asset/android-chrome-512x512.png new file mode 100644 index 0000000..33da136 Binary files /dev/null and b/asset/android-chrome-512x512.png differ diff --git a/asset/apple-touch-icon.png b/asset/apple-touch-icon.png new file mode 100644 index 0000000..00630ad Binary files /dev/null and b/asset/apple-touch-icon.png differ diff --git a/asset/favicon-16x16.png b/asset/favicon-16x16.png new file mode 100644 index 0000000..e5ca6ae Binary files /dev/null and b/asset/favicon-16x16.png differ diff --git a/asset/favicon-32x32.png b/asset/favicon-32x32.png new file mode 100644 index 0000000..e34e596 Binary files /dev/null and b/asset/favicon-32x32.png differ diff --git a/asset/favicon.ico b/asset/favicon.ico new file mode 100644 index 0000000..f72770d Binary files /dev/null and b/asset/favicon.ico differ diff --git a/asset/geometricbg.png b/asset/geometricbg.png new file mode 100644 index 0000000..1318b68 Binary files /dev/null and b/asset/geometricbg.png differ diff --git a/asset/site.webmanifest b/asset/site.webmanifest new file mode 100644 index 0000000..45dc8a2 --- /dev/null +++ b/asset/site.webmanifest @@ -0,0 +1 @@ +{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..753a56f --- /dev/null +++ b/index.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + + +
+

Game Switch Timer

+
+ +
+ +
+ + + +
+ + + + +
+ + + + diff --git a/pomodoro.css b/pomodoro.css new file mode 100644 index 0000000..e101221 --- /dev/null +++ b/pomodoro.css @@ -0,0 +1,32 @@ +html { + background-image: url("asset/geometricbg.png"); + background-color: black; +} + +#timer label { + font-size: xx-large; +} + +#container button { + margin: 8px 0px; +} + +#container { + position: fixed; + left: 50%; + text-align: center; + padding: 10px; + transform: translate(-50%, 0%); +} + +#controls { + margin: 10px; +} + +footer { + position: fixed; + left: 0; + bottom: 0; + width: 100%; + text-align: center; +} \ No newline at end of file diff --git a/pomodoro.js b/pomodoro.js new file mode 100644 index 0000000..38aa8d0 --- /dev/null +++ b/pomodoro.js @@ -0,0 +1,64 @@ +/*jslint esversion: 6 */ +let timerEventId; + +function publishTimer(timer) { + "use strict"; + + const timerElement = document.getElementById("timerText"); + timerElement.innerHTML = timer; + document.title = "[" + timer + "] Pomodoro Timer"; +} + +function stopTimer() { + const alarmElement = document.getElementById("alarm"); + + clearInterval(timerEventId); + alarmElement.pause(); + publishTimer('00:00'); +}; + +function countdown(interval) { + "use strict"; + + const alarmElement = document.getElementById("alarm"); + + let endTime; + + function formatTimeSegment(segment) { + if (segment.toString().length < 2) { + segment = "0" + segment; + } + + return segment; + }; + + function setTimer() { + let formattedTime, timeLeft, hours, minutes, seconds; + timeLeft = new Date(endTime - Date.now()); + + if (timeLeft.getTime() < 1000) { + formattedTime = "00:00"; + publishTimer(formattedTime); + clearInterval(timerEventId); + alarmElement.currentTime = 0; + alarmElement.play(); + } else { + hours = timeLeft.getUTCHours(); + minutes = formatTimeSegment(timeLeft.getUTCMinutes()); + seconds = formatTimeSegment(timeLeft.getUTCSeconds()); + formattedTime = (hours ? hours + ":" + minutes : minutes) + ":" + seconds; + publishTimer(formattedTime); + } + }; + + clearInterval(timerEventId); + alarmElement.pause(); + endTime = Date.now() + (1000 * interval) + 1000; + timerEventId = setInterval(setTimer, 100); +}; + +window.onload = function () { + "use strict"; + + stopTimer(); +};