Build a Pomodoro Clock

Developer
Size
3,419 Kb
Views
10,120

How do I make an build a pomodoro clock?

What is a build a pomodoro clock? How do you make a build a pomodoro clock? This script and codes were developed by Roksana on 22 November 2022, Tuesday.

Build a Pomodoro Clock Previews

Build a Pomodoro Clock - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Build a Pomodoro Clock</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!DOCTYPE HTML>
<html lang="en">
<head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title>Exercise - Build a Pomodoro Clock</title> <link rel="stylesheet" href="main.css" type="text/css" /> <link href="https://fonts.googleapis.com/css?family=Architects+Daughter" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
</head>
<body> <header class="header"> <h1>Pomodoro Clock</h1> <h2>FreeCodeCamp</h2> </header> <div class="timers"> <p class="break-length">Break length</p> <p class="session-length">Session length</p> <div style="clear: both"></div> <div class="break-timer"> <button class="break-minus">-</button> <div class="number break-number" value="5">5</div> <button class="break-plus">+</button> </div> <button class="stop">STOP!</button> <button class="start">START</button> <div class="session-timer"> <button class="session-minus">-</button> <div class="number session-number" value="25">25</div> <button class="session-plus">+</button> </div> <div style="clear: both"></div> </div> <div class="hourglass"> <p class="action">SESSION</p> <p class="time">25:00</p> </div> <footer> <p>by <a href="#">Roksana</a></p> </footer> <script src="main.js"></script>
</body> <script src="js/index.js"></script>
</body>
</html>

Build a Pomodoro Clock - Script Codes CSS Codes

html { font-size: 62.5%; margin: 0; padding: 0;
}
body { margin: 0; padding: 0; font-family: 'Architects Daughter', cursive; font-size: 3rem; color: #E8E9EB; background-color: #270722;
}
.header { width: 100%; text-align: center;
}
.header h1 { font-size: 4.5rem; margin: 10px auto 0 auto;
}
.header h2 { font-size: 2.5rem; margin: 5px auto 0 auto;
}
.timers { margin: auto; width: 600px; margin-top: 0px;
}
.break-length { float: left; font-size: 1.8rem; margin-left: 20px;
}
.session-length { float: right; font-size: 1.8rem; margin-right: 20px;
}
.break-timer { margin-left: 5px; float: left; display: flex; align-items: center; flex-wrap: wrap;
}
.session-timer { float: right; display: flex; align-items: center;
}
.timers button { font-family: 'Architects Daughter', cursive; font-size: 5rem; color: #E8E9EB; background-color: #270722; border: none; text-align: center; margin: 0 5px;
}
.timers .stop, .timers .start { position: relative; left: 140px; top: 10px; cursor: pointer; border: 1px solid #E8E9EB; color: #270722; font-size: 1.8rem; background-color: buttonface; padding: 2px 6px 3px; border-width: 2px; border-color: buttonface; border-image: initial; border-radius: 2px;
}
.timers .start { left: 130px;
}
.timers .number { text-align: center; font-size: 5rem; margin: 0 5px;
}
.session-plus { vertical-align: baseline;
}
.hourglass { width: 300px; height: 380px; background-color: #E8E9EB; margin: 5px auto 10px auto; position: relative; overflow: hidden;
}
.hourglass:before { content: ""; width: 0; height: 0; display: block; position: absolute; z-index: 30; border-top: 180px solid transparent; border-bottom: 200px solid transparent; border-left: 120px solid #270722;
}
.hourglass:after { content: ""; width: 0; height: 0; right: 0; display: block; position: absolute; z-index: 30; border-top: 180px solid transparent; border-bottom: 200px solid transparent; border-right: 120px solid #270722;
}
.hourglass p { color: #270722; font-weight: bold; position: absolute; font-family: 'Architects Daughter', cursive;
}
.hourglass .action { left: 100px;
}
.hourglass .time { font-size: 4.8rem; left: 90px; bottom: 0px;
}
.hourglass .stop { left: 125px; bottom: 20px;
}
footer { position: fixed; right: 10px; bottom: 5px; text-align: center; color: #E8E9EB; font-size: 1.8rem;
}
footer p { margin: 0; padding: 0;
}
footer a { text-decoration: none; color: #E8E9EB;
}

Build a Pomodoro Clock - Script Codes JS Codes

var plusBreak = $(".break-plus");
var minusBreak = $(".break-minus");
var numberBreak = $(".break-number");
var valBreak = $(".break-number").attr("value");
var secondBreak = 0;
var plusSession = $(".session-plus");
var minusSession = $(".session-minus");
var numberSession = $(".session-number");
var valSession = $(".session-number").attr("value");
var secondSession = 0;
var timer = $(".time");
var hourglass = $(".hourglass");
var counter;
function refresh(number, value) { number.html(value);
}
function clickButton() { plusBreak.click(function () { valBreak++; secondBreak = 0; refresh(numberBreak, valBreak); }); minusBreak.click(function () { if (valBreak > 1) { valBreak--; } secondBreak = 0; refresh(numberBreak, valBreak); }); plusSession.click(function () { valSession++; secondSession = 0; refresh(numberSession, valSession); refresh(timer, (valSession + ":00")); }); minusSession.click(function () { if (valSession > 1) { valSession--; secondSession = 0; } refresh(numberSession, valSession); refresh(timer, (valSession + ":00")); }); $(".start").click(function () { counter = setInterval(session, 1000); $(".stop").show(); $(".break-plus, .break-minus, .session-minus, .session-plus, .start").hide(); $(".session-number, .break-number").css("margin", "0 40px"); //hourglass.click(false); to polecenie nie działa, chcę móc zablokowac możliwość klikania w klepsydrę function session() { if (secondSession > 0) { if (secondSession <= 10) { secondSession--; refresh(timer, (valSession + ":0" + secondSession)); } else { secondSession--; refresh(timer, (valSession + ":" + secondSession)); } } if (secondSession === 0) { if (valSession === 0) { clearInterval(counter); valSession = numberSession.html(); $(".action").html("BREAK!"); counter = setInterval(takeBreak, 1000); } secondSession = 60; refresh(timer, (valSession + ":00")); valSession--; } } function takeBreak() { if (secondBreak > 0) { if (secondBreak <= 10) { secondBreak--; refresh(timer, (valBreak + ":0" + secondBreak)); } else { secondBreak--; refresh(timer, (valBreak + ":" + secondBreak)); } } if (secondBreak === 0) { if (valBreak === 0) { clearInterval(counter); valBreak = numberBreak.html(); $(".action").html("SESSION"); counter = setInterval(session, 1000); } secondBreak = 60; refresh(timer, (valBreak + ":00")); valBreak--; } } }); $(".stop").click(function() { $(".break-plus, .break-minus, .session-minus, .session-plus, .start").show(); $(".session-number, .break-number").css("margin", "0"); $(".stop").hide(); clearInterval(counter); });
}
$(document).ready(function() { $(".stop").hide(); clickButton();
});
Build a Pomodoro Clock - Script Codes
Build a Pomodoro Clock - Script Codes
Home Page Home
Developer Roksana
Username roksanaop
Uploaded November 22, 2022
Rating 3
Size 3,419 Kb
Views 10,120
Do you need developer help for Build a Pomodoro Clock?

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!

Roksana (roksanaop) Script Codes
Create amazing blog posts 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!