Promodoro new

Developer
Size
3,296 Kb
Views
62,744

How do I make an promodoro new?

What is a promodoro new? How do you make a promodoro new? This script and codes were developed by Ben on 08 August 2022, Monday.

Promodoro new Previews

Promodoro new - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>promodoro new</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <header id="leftNav"> <h1>PROMODORO</h1> <h3>Session Length - <span id="sessionLength"></span> Minutes</h3> <div id="sessionControl"> <button>+</button> <button>-</button> </div> <h3>Break Length - <span id="breakLength"></span> Minutes</h3> <div id="breakControl"> <button>+</button> <button>-</button> </div> <h3>Long Break Length - <span id="longBreakLength"></span> Minutes</h3> <div id="longBreakControl"> <button>+</button> <button>-</button> </div> <div id="promodoroCycle"> <h3>Promodoro Cycle</h3> <div id="location-control"></div> </div> </header> <main> <div id="circle-clock"> <div id="innerClock"> <p><span id="clockMin"></span>:<span id=clockSec></span></p> <small>Click to start</small> </div> </div> <small id="reset">Reset</small> </main> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Promodoro new - Script Codes CSS Codes

html, body {	background-color: black;	color: white;	width: 100%;	height: 100%;
}
body {	display: flex;
}
#leftNav {	flex-basis: 30%;	display: flex;	flex-flow: column;
}
/*target children of left nav. Arrange the left bar*/
main {	flex-basis: 68%;	height: 100%;
}
/*I would like the circle to move to the center*/
#circle-clock {	margin: auto;	width: 300px;	height: 300px;	border-radius: 50%;	border: 5px solid white;	display: flex;
}
#innerClock {	margin: auto;	text-align: center;
}	#innerClock p {	font-size: 35px;	}
.selected {	background-color: blue;
}
#reset {text-align: center;}

Promodoro new - Script Codes JS Codes

const promodoro = { state:{ session: { length: 25, min: 15, max: 50 }, break: { length: 5, min: 2, max: 10 }, longBreak: { length:15, min: 10, max: 25 }, cycle: ['session', 'break','session', 'break','session', 'break', 'session', 'longBreak'], currentLocation:0, //0-7 //can I limit between 0-7? Probably with a set function. timeLeftSec: 0, clockRuns: false }, setNewLength: function(config, operator){ if(operator === '+'){ var newVal = config.length +1 if(newVal > config.max){ newVal = config.min } } else { var newVal = config.length - 1 if(newVal < config.min){ newVal = config.max } } config.length=newVal }, setCurrentLocation: function (value) { //receives a number between 0 and 7 console.log("setCurrentLocation started") if (!this.state.cycle[value]){ console.warn("Values send to setCurrentLocation must be an integer between 0 and " + this.state.cycle.length) } this.state.currentLocation = value this.state.timeLeftSec = this.state[this.state.cycle[value]].length*60 }, setClockState: function(){ this.state.clockRuns = !this.state.clockRuns }, renderLength: function (){ // config === All console.log("renderLengthChange started") $('#sessionLength').text(this.state.session.length) $('#breakLength').text(this.state.break.length) $('#longBreakLength').text(this.state.longBreak.length) }, renderLocation: function () { console.log("renderLocationStarted") let currentLocation = this.state.currentLocation var output = this.state.cycle.map(function (value, index) { let className = (index === currentLocation) ? 'selected': '' return `<div><button class="${className}" data="${index}">${value}</button ></div>` }) $('#location-control').html(output.join("")); }, renderClock: function (){ console.log("renderClock Started") let min = Math.floor(this.state.timeLeftSec/60) let sec = this.state.timeLeftSec % 60 if (sec < 10) { sec = '0' + sec } $('#clockMin').text(min) $('#clockSec').text(sec) }, lengthChange: function (config, operator){ console.log("lengthChange started"); this.setNewLength (config, operator); this.renderLength () }, changeLocation: function (newLocation){ console.log("locationChange Started") this.setCurrentLocation(newLocation); this.renderLocation ();	this.renderClock(); }, tick: function () { if (!this.state.clockRuns) { return } if (this.state.timeLeftSec === 0) { this.changeLocation(this.state.currentLocation + 1) //ideally there will also be a sound var audio = new Audio('Twinkle-sound-effect.mp3'); audio.play(); } this.state.timeLeftSec -= 1 this.renderClock() }, init: function (){ console.log('Init function started') this.renderLength() this.renderLocation() this.state.timeLeftSec=this.state.session.length*60 this.renderClock() const promodoro=this $('#sessionControl button').click(function (){ console.log('Session button clicked') let operator = this.innerText.trim() var config = promodoro.state.session promodoro.lengthChange(config, operator) }) $('#breakControl button').click(function (){ let operator = this.innerText.trim() var config = promodoro.state.break promodoro.lengthChange(config, operator) }) $('#longBreakControl button').click(function (){ let operator = this.innerText.trim() var config = promodoro.state.longBreak promodoro.lengthChange(config, operator) }) $('#location-control').on('click', 'button', function () { promodoro.changeLocation(parseInt($(this).attr('data'))) }) $('#circle-clock').click(function () { promodoro.state.clockRuns = !promodoro.state.clockRuns }) $('#reset').click(function(){ promodoro.changeLocation(promodoro.state.currentLocation); }) this.interval = setInterval(promodoro.tick.bind(promodoro), 1000) }
} promodoro.init()
Promodoro new - Script Codes
Promodoro new - Script Codes
Home Page Home
Developer Ben
Username bencarp
Uploaded August 08, 2022
Rating 3
Size 3,296 Kb
Views 62,744
Do you need developer help for Promodoro new?

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!

Ben (bencarp) Script Codes
Create amazing art & images 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!