Pomodoro Timer

Developer
Size
3,599 Kb
Views
16,192

How do I make an pomodoro timer?

Pomodoro timer. . What is a pomodoro timer? How do you make a pomodoro timer? This script and codes were developed by Mihkel on 08 December 2022, Thursday.

Pomodoro Timer Previews

Pomodoro Timer - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pomodoro Timer</title> <meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Roboto:100" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <h1 class="hero">Pomodoro Timer</h1> <div class="interval-column"> <div class="work-time-container"> <h4 class="interval-type">Work</h4> <h2> <i class="material-icons icons add-icon">add_circle</i> <span class="work-time">25</span> <i class="material-icons icons minus-icon">remove_circle_outline</i> </h2> </div> <div class="break-time-container"> <h4 class="interval-type">Break</h4> <h2> <i class="material-icons icons add-icon">add_circle</i> <span class="break-time">5</span> <i class="material-icons icons minus-icon">remove_circle_outline</i> </h2> </div> </div> <div class="reset-column"> <button type="button" class="reset-btn">Reset</button> </div> <div class="pomodoro"> <h2 class="pomodoro-timer">00:00</h2> </div> <h3 class="status"></h3>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Pomodoro Timer - Script Codes CSS Codes

body {	background: #333;	font-family: 'Roboto', sans-serif;	color: #fafafa; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -ms-flex-line-pack: center; align-content: center;
}
h1,
h2,
h3,
h4 { font-weight: 100;
}
.container { width: 600px;
}
.hero {	text-align: center;	font-size: 46px;	letter-spacing: 2px;	margin-bottom: 15px;
}
.interval-column {	margin-top: 40px; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between;
}
.interval-type {	color: #bbb; text-align: center;
}
.work-time,
.break-time { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
}
.icons {	-webkit-transition: 0.1s;	transition: 0.1s;	font-size: 18px; cursor: pointer; color: #fafafa; opacity: 0.7; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
}
.icons:hover {	opacity: 1;
}
.reset-column {	margin-top: 10px;	min-height: 35px; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center;
}
.reset-btn { font-family: 'Roboto', sans-serif;	border-radius: 0;	border: 1px solid #333;	background-color: #333; color: #fafafa;	box-shadow: 0 0 5px rgba(0,0,0,0.4);	-webkit-transition: all 0.1s;	transition: all 0.1s; cursor: pointer; padding: 8px 12px; outline: none; display: none; font-size: 12px; font-weight: 100; text-transform: uppercase; letter-spacing: 0.8px;
}
.reset-btn:hover {	color: #fafafa;	background-color: #404040;
}
.pomodoro {	margin: 30px auto 0 auto;	width: 350px;	height: 350px;	border-radius: 50%;	border: 1px solid #333; background: -webkit-linear-gradient(bottom, #660000 0%, #333 0%); background: linear-gradient(to top, #660000 0%, #333 0%);	box-shadow: 0 0 5px rgba(0,0,0,0.4);	text-align: center;	display: -webkit-box;	display: -ms-flexbox;	display: flex;	-webkit-box-pack: center; -ms-flex-pack: center; justify-content: center;	-webkit-box-align: center; -ms-flex-align: center; align-items: center;	cursor: pointer;	-webkit-transition: 0.2s border-color;	transition: 0.2s border-color;
}
.pomodoro:hover {	border-color: #4d4d4d;
}
.status { margin-top: 30px; text-align: center;	display: none;
}
/* MEDIA QUERIES */
@media all and (max-width: 600px) { .container { width: auto; }
}
@media all and (max-width: 400px) {	.pomodoro {	height: 300px;	width: 300px;	}
}

Pomodoro Timer - Script Codes JS Codes

$(document).ready(function () {	var isPaused = true;	var isRunning = false;	var interval;	var $breakTime = $(".break-time");	var $workTime = $(".work-time");	var $pomodoro = $(".pomodoro");	var $timer = $(".pomodoro-timer");	var $status = $(".status");	var $resetBtn = $(".reset-btn");	var $incrementBtn = $(".add-icon");	var $decrementBtn = $(".minus-icon");	function pomodoro() {	var workTime = Number($workTime.text());	var breakTime = Number($breakTime.text());	var counter = workTime * 60;	var percentage = 0;	var tick = 100 / counter;	var color = "#660000 ";	$status.fadeIn().text("Work");	interval = setInterval(function () {	if (!isPaused) {	var minutes = Math.floor(counter / 60);	var seconds = Math.floor(counter % 60);	minutes = minutes < 10 ? "0" + minutes : minutes;	seconds = seconds < 10 ? "0" + seconds : seconds;	$timer.text(minutes + ":" + seconds);	$pomodoro.css("background", "linear-gradient(to top," + color + percentage + "%," + "#333 0%)");	percentage += tick;	counter--;	if (counter < 0 && $status.text() === "Work") {	counter = breakTime * 60;	tick = 100 / counter;	percentage = 0;	color = "#444444 ";	fadeInText("Break");	} else if (counter < 0 && $status.text() === "Break") {	counter = workTime * 60;	tick = 100 / counter;	percentage = 0;	color = "#660000 ";	fadeInText("Work");	}	}	}, 1000);	}	function fadeInText(text) {	var $status = $(".status");	$status.fadeOut(function () {	$status.text(text).fadeIn();	});	}	function giveAlert() {	alert("Pause the current Pomodoro to start a new one.");	}	function reset() {	$workTime.text(25);	$breakTime.text(5);	$timer.text("00:00");	$status.text("").hide();	$pomodoro.css("background", "");	isPaused = true;	isRunning = false;	$(this).hide();	}	function increment() {	if (isPaused) {	var $el = $(this).siblings("span");	var interval = Number($el.text());	$el.text(interval + 1);	isRunning = false;	} else {	giveAlert();	}	}	function decrease() {	if (isPaused) {	var $el = $(this).siblings("span");	var interval = Number($el.text());	if (interval > 1) $el.text(interval - 1);	isRunning = false;	} else {	giveAlert();	}	}	function startTimer() {	if (isPaused && !isRunning) {	clearInterval(interval);	isPaused = false;	isRunning = true;	$resetBtn.css("display", "block");	pomodoro();	} else if (!isPaused) {	isPaused = true;	} else {	isPaused = false;	}	}	$resetBtn.on("click", reset);	$incrementBtn.on("click", increment);	$decrementBtn.on("click", decrease);	$pomodoro.on("click", startTimer);
});
Pomodoro Timer - Script Codes
Pomodoro Timer - Script Codes
Home Page Home
Developer Mihkel
Username Krokodill
Uploaded December 08, 2022
Rating 3
Size 3,599 Kb
Views 16,192
Do you need developer help for 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!

Mihkel (Krokodill) Script Codes
Create amazing sales emails 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!