Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <body>
    <div class="container">
         <div class="row">
            <div class="col-lg-3 col-xs-4  text-center"></div>

			<div class="col-lg-3 col-xs-11 text-center" id="slider-container" >
			
			<div class="sliders">
				<h1>Alberto's Pomodoro Clock</h1>
            	<p>Session <span class="slider-session">5</span> Min.	<input id="rangeSession" type="range" min="5" max="25" value="5" step="1"  /></p>
            	<p class="pause">Pause <span class="slider-pause">5</span> Min.<input id="rangePause" type="range" min="5" max="25" value="5" step="1"  /></p>

            	</div>
           	
			</div>

            <div class="col-lg-3 col-xs-11 text-center" id="clock-container" > 
                <div id="containerSeconds"></div>
                <div id="containerMinutes"></div>  
                <button  id="startButton">Start</button>
                <button  id="pauseButton">Pause</button>
                        
            </div>    
            <div class="col-lg-3 col-xs-1" ></div>
        </div>
		
		<div class="row">
			<div class="col-lg-3 col-xs-4  text-center"></div>

			<div class="col-lg-6 col-xs-11 author" id="slider-container" >
				<p>Design and Code by Alberto D'Angelo <a href="http://www.dangelodesign.ch/showcase" target="_blank" style="color:#b8b8b8; font-weight:bold; text-decoration: underline;">(www.dangelodesign.ch)</a></p>
			</div>
			
			<div class="col-lg-3 col-xs-4  text-center"></div>
		</div>
    


	<audio id="audio" src="http://dangelodesign.ch/wp-content/uploads/freecodecamp/gong.mp3" ></audio>
    </div>
 
    </div>
              
            
!

CSS

              
                body {
  font-family: 'Ropa Sans', sans-serif;
}
.sliders {
	width: 250px;
   margin: auto;
  margin-top: 40px;
}
#clock-container {
	position:relative;
  top: 45px;
  display: block;
}

#containerSeconds {
  width: 220px;
  height: 110px;
  font-size: 30px;
  top: 0px;
  font-family: 'Oswald', sans-serif;  
  margin: auto;
}
#containerSeconds .progressbar-text {
  position: relative;
  top: 35px!important;
  padding-left: 75px !important;
}
#containerMinutes .progressbar-text {
  position: relative;
  top: -55px !important;
  padding-right: 40px !important;
}
#containerMinutes {
  margin: 20px;
  width: 180px;
  height: 90px;
  position: relative; !important;
  font-family: 'Oswald', sans-serif;
  margin: auto;
  top: -93px;
  font-size:80px;
}
h1 {
  font-family: 'Lobster', cursive;
  padding-bottom: 35px;
  text-align: left;
  font-size: 46px;
  width: 300px;
}
.row.row-btns {
    margin-top: 35px;
}
p {
  text-align: left;
  font-size: 18px;
  color:  rgb(237, 106, 90);
  font-family: 'Oswald', sans-serif;
}
p.pause {
  color:  rgb(18, 132, 28);
}
/* STYLES RANGE SLIDER */
input[type=range] {
  -webkit-appearance: none;
  margin: 10px 0;
  width: 100%;
}
input[type=range]:focus {
  outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 19px;
  cursor: pointer;
  animate: 0.2s;
  box-shadow: 1px 1px 1px #E3E6E5;
  background: #F0F0F0;
  border-radius: 14px;
  border: 0px solid #000000;
}
input[type=range]::-webkit-slider-thumb {
  box-shadow: 2px 2px 1px #B3B3B3;
  border: 0px solid #000000;
  height: 18px;
  width: 40px;
  border-radius: 12px;
  background: rgb(237, 106, 90);

  cursor: pointer;
  -webkit-appearance: none;
  margin-top: 0.5px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
  background: #F0F0F0;
}
input[type=range]::-moz-range-track {
  width: 100%;
  height: 19px;
  cursor: pointer;
  animate: 0.2s;
  box-shadow: 1px 1px 1px #E3E6E5;
  background: #F0F0F0;
  border-radius: 14px;
  border: 0px solid #000000;
}
input[type=range]::-moz-range-thumb {
  box-shadow: 2px 2px 1px #B3B3B3;
  border: 0px solid #000000;
  height: 18px;
  width: 40px;
  border-radius: 12px;
  background: rgb(237, 106, 90);
  cursor: pointer;
}
input[type=range]::-ms-track {
  width: 100%;
  height: 19px;
  cursor: pointer;
  animate: 0.2s;
  background: transparent;
  border-color: transparent;
  color: transparent;
}
input[type=range]::-ms-fill-lower {
  background: #F0F0F0;
  border: 0px solid #000000;
  border-radius: 28px;
  box-shadow: 1px 1px 1px #E3E6E5;
}
input[type=range]::-ms-fill-upper {
  background: #F0F0F0;
  border: 0px solid #000000;
  border-radius: 28px;
  box-shadow: 1px 1px 1px #E3E6E5;
}
input[type=range]::-ms-thumb {
  box-shadow: 2px 2px 1px #B3B3B3;
  border: 0px solid #000000;
  height: 18px;
  width: 40px;
  border-radius: 12px;
  background: rgb(237, 106, 90);
  cursor: pointer;
}
input[type=range]:focus::-ms-fill-lower {
  background: #F0F0F0;
}
input[type=range]:focus::-ms-fill-upper {
  background: #F0F0F0;
}


input[type=range]::-webkit-slider-thumb {
  background: rgb(18, 132, 28) !important;   
}
input[type=range]::-ms-thumb {
 
  background: rgb(18, 132, 28) !important;
}
input[type=range]::-moz-range-thumb {
  background: rgb(18, 132, 28) !important;
}




/* STYLES BUTTONS */

#startButton {
  background: rgb(237, 106, 90);
  background-image: -webkit-linear-gradient(top, rgb(237, 106, 90), #C43C2D);
  background-image: -moz-linear-gradient(top, rgb(237, 106, 90), #C43C2D);
  background-image: -ms-linear-gradient(top, rgb(237, 106, 90), #C43C2D);
  background-image: -o-linear-gradient(top, rgb(237, 106, 90), #C43C2D);
  background-image: linear-gradient(to bottom, rgb(237, 106, 90), #C43C2D);
  -webkit-border-radius: 28;
  -moz-border-radius: 28;
  border-radius: 28px;
	font-family: 'Oswald', sans-serif;
  color: #ffffff;
  font-size: 20px;
  padding: 10px 20px 10px 20px;
  border: solid #ffe3e0 9px;
  text-decoration: none;
  position: relative;
  top: -30px;
  margin-right: 5px;
  outline: none;
}


#startButton:hover {
  background: #C43C2D;
  background-image: -webkit-linear-gradient(top, #C43C2D, #C43C2D);
  background-image: -moz-linear-gradient(top, #C43C2D, #C43C2D);
  background-image: -ms-linear-gradient(top, #C43C2D, #C43C2D);
  background-image: -o-linear-gradient(top, #C43C2D, #C43C2D);
  background-image: linear-gradient(to bottom, #C43C2D, #C43C2D);
  text-decoration: none;
}

#pauseButton {
  background: #33bd3f;
  background-image: -webkit-linear-gradient(top, #33bd3f, #06730f);
  background-image: -moz-linear-gradient(top, #33bd3f, #06730f);
  background-image: -ms-linear-gradient(top, #33bd3f, #06730f);
  background-image: -o-linear-gradient(top, #33bd3f, #06730f);
  background-image: linear-gradient(to bottom, #33bd3f, #06730f);
  -webkit-border-radius: 28;
  -moz-border-radius: 28;
  border-radius: 28px;
  font-family: 'Oswald', sans-serif;
  color: #ffffff;
  font-size: 20px;
  padding: 10px 20px 10px 20px;
  border: solid #def7e0 9px;
  text-decoration: none;
  position: relative;
  top: -30px;
  outline: none;
}

#pauseButton:hover {
  background: #06730f;
  background-image: -webkit-linear-gradient(top, #06730f, #06730f);
  background-image: -moz-linear-gradient(top, #06730f, #06730f);
  background-image: -ms-linear-gradient(top, #06730f, #06730f);
  background-image: -o-linear-gradient(top, #06730f, #06730f);
  background-image: linear-gradient(to bottom, #06730f, #06730f);
  text-decoration: none;
}

.author {
	border-top: 1px solid rgba(0,0,0,0.2);
	margin-top: 30px;
}
.author p {
	margin-top: 5px;
	font-size: 14px;
	text-align: left;
	color: rgba(0,0,0,0.2);
}
              
            
!

JS

              
                
$(document).ready(function(){
 

startApp();

function startApp() {
	
	var timerDataSession 	= {"session":"yes","time":5, "colorSec": "#FCD77C", "colorMin": "#ED6A5A", "colorTxtSec":"#FCD77C", "colorTxtMin":"#ED6A5A" };
	var timerDataPause 		= {"session":"no","time":5, "colorSec": "#00D311", "colorMin": "#12841C", "colorTxtSec":"#00D311", "colorTxtMin":"#12841C"};
	

	var Clock = {
		
		totalSeconds: 0,
		timerData: {},
		countMin: 0,
		sliderActive: false,

		start: function () {

			var self = this;
			
			this.interval = setInterval(function () {
					
				
				Clock.totalSeconds += 1/60;		
				
				if(Clock.countMin == 0) {
					Clock.countMin = 1;
				}

				barSeconds.color = Clock.timerData.colorSec;
				barSeconds.path.setAttribute("stroke", Clock.timerData.colorSec);
				barSeconds.text.style.color = Clock.timerData.colorTxtSec;
		
				barMinutes.color = Clock.timerData.colorSec;
				barMinutes.path.setAttribute("stroke", Clock.timerData.colorMin);
				barMinutes.text.style.color = Clock.timerData.colorTxtMin;

				if(Clock.totalSeconds-1/60 <= 1) {
						barSeconds.animate(Clock.totalSeconds, {
							duration: 400
						});
				
				} else {
					barSeconds.animate(0);
					Clock.totalSeconds = 0;
					Clock.pause();
					if( Clock.countMin <= Clock.timerData.time + 1 ) {
						barMinutes.animate(((Clock.timerData.time / (Clock.timerData.time * Clock.timerData.time)) * Clock.countMin), {
					    duration: 400
						}, function() {
					    	
							
							if( parseInt(Clock.countMin) == parseInt(Clock.timerData.time) + 1 ) {
								
								playSound();
			
								
								if(Clock.timerData.session == "yes") {
									  
									Clock.timerData = timerDataPause;
									
								} else if(Clock.timerData.session == "no") {
									
									Clock.timerData = timerDataSession;
								}
								Clock.totalSeconds = 0;
								Clock.countMin = 0;
								barMinutes.animate(0);
								console.log("RESTART");
								Clock.start();
								
							} else {
								Clock.start();
							}								
							
						});
						
					} 
					Clock.countMin += 1;
				}
			}, 1000);
		},

		pause: function () {

			clearInterval(this.interval);
			delete this.interval;
			
		},

		resume: function () {
			if (!this.interval) 
			
			this.start();
		},
		reset: function() {
			toggleButtons(false);
			Clock.pause();
			Clock.totalSeconds = 0;
			Clock.countMin = 0;
			Clock.timerData = timerDataSession;
			barMinutes.text.innerHTML = '0';
			barSeconds.set(0);
			barMinutes.animate(0);
			
		}
	};

	Clock.timerData = timerDataSession;
	Clock.pause();
	toggleButtons(false); 

	// CONTROL BUTTONS
	$('#startButton').click(function () { Clock.start();  toggleButtons(true); playSound()});
	$('#pauseButton').click(function () { Clock.pause();  toggleButtons(false)});
	
	function toggleButtons(state) {
		if( state == true) {
			$('#startButton').attr('disabled','disabled');
			$('#pauseButton').removeAttr('disabled');
			
		} else {
			$('#startButton').removeAttr('disabled');
			$('#pauseButton').attr('disabled','disabled');		
		
		}
	}
	// SOUNDS
	function playSound(){
		var audio = document.getElementById("audio");
		audio.play();
    }
	
	// SLIDERS
	$("#rangeSession").on("change", function() {
		timerDataSession.time = $(this).val();
		$('.slider-session').html($(this).val());
		Clock.sliderActive = true;
		Clock.reset();
		
	});
	$("#rangePause").on("change", function() {
		$('.slider-pause').html($(this).val());
		timerDataPause.time = $(this).val();
		Clock.reset();
	});

	// ANIMATION
	var barSeconds = new ProgressBar.SemiCircle(containerSeconds, {
			strokeWidth: 6,
			trailColor: '#eee',
			color: "",
			trailWidth: 7,
			easing: 'easeInOut',
			svgStyle: null,
			text: {
			value: '',
			alignToBottom: false
		},
		
		// Set default step function for all animate calls
		step: function (state, bar)  {
			
			
			var value = Math.round((bar.value() * 100)/100 * 60);
			if (value === 0) {
			  	bar.setText('0');
			} else {
			  	bar.setText(value);
			}
			
			
		}
	});

	
	var barMinutes = new ProgressBar.SemiCircle(containerMinutes, {
			strokeWidth: 6,
			color: '',
			trailColor: '#eee',
			trailWidth: 1,
			easing: 'easeInOut',
			duration: 100,
			svgStyle: null,
			text: {
			value: '',
			alignToBottom: false,
		},
	
		// Set default step function for all animate calls
		step: function (state, bar) {
			
			var value = Math.round((bar.value() * 100)/100 * Clock.timerData.time);
			
			if (value === 0 ) {
			  	bar.setText('0');
				
			} else {
			  	bar.setText(value);
			}		
		} 

	});
};

	
});

              
            
!
999px

Console