'24' Pomodoro Timer

Developer
Size
4,181 Kb
Views
6,072

How do I make an '24' pomodoro timer?

Pomodoro timer for Free Code Camp course in JQuery with a 24 theme. What is a '24' pomodoro timer? How do you make a '24' pomodoro timer? This script and codes were developed by Adam on 28 November 2022, Monday.

'24' Pomodoro Timer Previews

'24' Pomodoro Timer - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>'24' Pomodoro Timer</title> <link href="https://fonts.googleapis.com/css?family=Orbitron" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="wrap"> <div class="row"> <div class="title">POMODORO<br>TIMER</div> <div class="q1"></div> <div class="q2"></div> </div> <div class="row"> <div id="pomoTime">24:00</div> <div class="start dial">START</div> <div class="q3"> <div class="dials"> <div>DURATION</div> <div class="input"> <div id="pomoMinus" class="dial">-</div> <div id="duration" class="timer">24:00</div> <div id="pomoPlus" class="dial">+</div> </div> </div> </div> <div class="q4"> <div class="dials"> <div>BREAK</div> <div class="input"> <div id="breakMinus" class="dial">-</div> <div id="breakTime" class="timer">6:00</div> <div id="breakPlus" class="dial">+</div> </div> </div> </div> </div>
</div>
<audio src="https://www.dropbox.com/s/d6mv03ysc2cr61s/24secs2.mp3?raw=1" preload></audio> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

'24' Pomodoro Timer - Script Codes CSS Codes

html { font-size: 20px;
}
@media (max-width: 900px) { html { font-size: 18px; }
}
@media (max-width: 700px) { html { font-size: 12px; }
}
@media (max-width: 500px) { html { font-size: 10px; }
}
@media (max-width: 400px) { html { font-size: 8px; }
}
body { background: black; font-family: 'Orbitron', sans-serif; color: yellow; font-style: italic; font-weight: bold; text-shadow: 2px 0px 8px #ff9400; text-align: center;
}
.wrap { width: 800px; height: 800px; margin: 0 auto; display: flex; flex-direction: column; justify-content: center;
}
@media (max-width: 900px) { .wrap { width: 700px; height: 700px; }
}
@media (max-width: 700px) { .wrap { width: 500px; height: 500px; }
}
@media (max-width: 500px) { .wrap { width: 400px; height: 400px; }
}
@media (max-width: 400px) { .wrap { width: 300px; height: 300px; }
}
.row { height: 40%; margin: 0 0 10px 0; display: flex; position: relative; justify-content: center;
}
.title { position: absolute; top: 20%; left: 25%; font-size: 3rem;
}
.q1 { height: 100%; background: linear-gradient(rgba(79, 0, 0, 0.95), rgba(79, 0, 0, 0.95)), url("https://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Il_pomodoro.jpg/330px-Il_pomodoro.jpg"); background-position: center; width: 40%; margin: 0 0 0 4%;
}
.q2 { height: 100%; background: linear-gradient(rgba(2, 0, 51, 0.95), rgba(2, 0, 51, 0.95)), url("https://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Il_pomodoro.jpg/330px-Il_pomodoro.jpg"); background-position: center; width: 40%; margin: 3% 0 0 3%;
}
.q3 { height: 100%; background: linear-gradient(rgba(22, 0, 33, 0.95), rgba(22, 0, 33, 0.95)), url("https://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Il_pomodoro.jpg/330px-Il_pomodoro.jpg"); background-position: center; width: 50%; margin: 2% 2% 0 2%; display: flex; flex-direction: column; justify-content: center;
}
.q4 { height: 100%; background: linear-gradient(rgba(51, 1, 1, 0.9), rgba(51, 1, 1, 0.9)), url("https://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Il_pomodoro.jpg/330px-Il_pomodoro.jpg"); background-position: center; margin: 5% 0 0 0; width: 35%; display: flex; flex-direction: column; justify-content: center;
}
.input { display: flex; justify-content: center;
}
.start { padding-right: 15px; display: inline-block; position: absolute; bottom: 0; left: 43%; font-size: 2rem;
}
.timer { padding: 0 2%;
}
.dials { font-size: 2rem;
}
.dial:hover { color: orange; cursor: pointer;
}
#pomoTime { width: 37%; position: absolute; top: -15%; left: 33%; font-size: 4rem; background: black; padding-right: 2%; text-align: center;
}
.break { color: orange;
}

'24' Pomodoro Timer - Script Codes JS Codes

/*******************
Pomodoro clock. Design inspiration from TV's '24'. One extra minute's break!
*******************/
$(document).ready(function() { var $pomoTime = $('#pomoTime'); var $breakTime = $('#breakTime'); var $pomoPlus = $('#pomoPlus'); var $pomoMinus = $('#pomoMinus'); var $breakMinus = $('#breakMinus'); var $breakPlus = $('#breakPlus'); var $duration = $('#duration'); var audio = document.querySelector('audio'); var timeLeft = 1440; var timeInput = 1440; var breakLeft = 360; var breakInput = 360; var start = false; var $start = $('.start'); var $dials = $('.dials'); function returnTime(t) { var mins = Math.floor(t / 60); var secs = t % 60; if (secs < 10) { secs = '0' + secs; } return { 'mins': mins, 'secs': secs }; } var startTimer; var startBreakTimer; var displayTime; function timer() { timeLeft -= 1; if (timeLeft === 0) { breakLeft = breakInput; clearInterval(startTimer); $pomoTime.addClass('break'); audio.play(); startBreakTimer = setInterval(breakTimer, 1000); } displayTime = returnTime(timeLeft); $pomoTime.text(displayTime.mins + ":" + displayTime.secs); } function breakTimer() { breakLeft -= 1; displayTime = returnTime(breakLeft); $pomoTime.text(displayTime.mins + ":" + displayTime.secs); if (breakLeft === 0) { clearInterval(startBreakTimer); timeLeft = timeInput; audio.play(); $pomoTime.removeClass('break'); startTimer = setInterval(timer, 1000); } } $pomoPlus.click(function() { timeLeft += 60; timeInput = timeLeft; displayTime = returnTime(timeLeft); $pomoTime.text(displayTime.mins + ":" + displayTime.secs); $duration.text(displayTime.mins + ":00"); }); $pomoMinus.click(function() { if (timeLeft > 60) { timeLeft -= 60; timeInput = timeLeft; displayTime = returnTime(timeLeft); $pomoTime.text(displayTime.mins + ":" + displayTime.secs); $duration.text(displayTime.mins + ":00"); } }); $breakPlus.click(function() { breakLeft += 60; breakInput = breakLeft; displayTime = returnTime(breakLeft); $breakTime.text(displayTime.mins + ":00"); }); $breakMinus.click(function() { if (breakLeft > 60) { breakLeft -= 60; breakInput = breakLeft; displayTime = returnTime(breakLeft); $breakTime.text(displayTime.mins + ":00"); } }); $start.click(function() { if (!start) { audio.play(); startTimer = setInterval(timer, 1000); $start.text("RESET"); $dials.hide(); start = true; } else { $start.text("START"); start = false; timeLeft = timeInput; breakLeft = breakInput; $pomoTime.removeClass('break'); displayTime = returnTime(timeLeft); $pomoTime.text(displayTime.mins + ":" + displayTime.secs); $dials.show(); clearInterval(startTimer); clearInterval(startBreakTimer); } });
});
'24' Pomodoro Timer - Script Codes
'24' Pomodoro Timer - Script Codes
Home Page Home
Developer Adam
Username rzencoder
Uploaded November 28, 2022
Rating 3
Size 4,181 Kb
Views 6,072
Do you need developer help for '24' Pomodoro Timer?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Adam (rzencoder) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!