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

              
                
<html>
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>Pomodoro Clock - Free Code Camp, Advanced Front End Development Projects</title>
</head>
<body class="bg-primary">
<div class="container-fluid row text-center">
	<div class="col-lg-10 col-lg-offset-1 col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1 col-xs-10 col-xs-offset-1">
		<h1>Pomodoro Clock</h1>
		<div class="container-fluid row text-center">
			<div>
				<h3>session</h3>
				<button id="setSessionMinus" class="btn">-</button><span id="setSession">25</span><button id="setSessionPlus" class="btn">+</button>
			</div>
			<div>
				<h3>break</h3>
				<button id="setBreakMinus" class="btn">-</button><span id="breakTime">5</span><button id="setBreakPlus" class="btn">+</button>
			</div>
		</div>
	</div>
</div>
<div class="container-fluid row text-center">
	<div class="col-lg-10 col-lg-offset-1 col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1 col-xs-10 col-xs-offset-1">
		<div id="circle" class="timerStyle workTime text-center container-fluid">
			<div id="counter">--:--</div>
			<div class="timerOptions">
				<span id="pauseTimer">start</span> | <span id="resetTimer">reset</span>
			</div>
		</div>
	</div>
	<div class="container-fluid col-md-6 col-md-offset-3 col-sm-10 col-sm-offset-1 col-xs-12 text-center"><a href="http://raymondrizzo.com/Portfolio" target="blank">Raymond Rizzo</a></div>
</div>
    
<audio id="timerSound">
	  <source src="https://s3.amazonaws.com/freecodecamp/simonSound3.mp3" type="audio/mpeg">
	  Your browser does not support the audio element.
</audio>
<body>
</body>
</html>
              
            
!

CSS

              
                /* CSS Document */
a, body a:hover {
	color: #ffffff;	
}

body {
  background-color: #000000;
	color: #ffffff;
 	font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif !important;
	font-size: 14px;
	font-style: normal;
	font-variant: small-caps;
	font-weight: 500;
}

.btn {
  border-radius: 100%;
  background-color: #ffffff;
  border-color: #ffffff;
  margin: 5px;
	color: #337ab7;
}

.timerStyle {
 	border-radius: 100%;
  	height: 260px;
  	width: 260px;
  	color: #ffffff;
  	padding-top: 5%;
  	border: 15px solid #ffffff;
  	margin-top: 88px;
	font-size: 70px;
}

.timerOptions{
	font-size: 20px;
}

.workTime {
  background-color: #aa3333;
}

.breakTime {
  background-color: #33aa33;
}

.finishedTime {
  background-color: #aa33aa !important;
}

              
            
!

JS

              
                var workTime = "";
var breakTime = "";
var minuteCounter = "";
var secCounter = "";
var timeType = "work";
var pauseTimer = true;

$(document).ready(function() {
  reset();
});

function countDown() {
  if (pauseTimer === false) {
    secCounter--;

    if (secCounter === 0) {
      minuteCounter--;
      secCounter = 59;

    }

    if (minuteCounter < 0 && timeType == "work") {
      playSound();
      timeType = "break";
      minuteCounter = breakTime;
      $("#circle").removeClass("workTime");
      $("#circle").addClass("breakTime");
    } else if (minuteCounter < 0 && timeType == "break") {
      pauseTimer = true;
      $("#circle").removeClass("breakTime");
      $("#circle").addClass("finishedTime");
      window.setTimeout($("#counter").text("--:--"), 1100);
      playSound();
      timeType = "finished";
    }

    if (secCounter < 10) {
      $("#counter").text(minuteCounter + ":0" + secCounter);
    } else if (minuteCounter < 10) {
      $("#counter").text("0" + minuteCounter + ":" + secCounter);
    } else {
      $("#counter").text(minuteCounter + ":" + secCounter);
    }

    window.setTimeout(countDown, 1000);
  }

}

function playSound() {
  $('#timerSound')[0].play();
}

$("#pauseTimer").on("click", function() {
  startPause();
});

$("#resetTimer").on("click",function(){
  reset();
});

$("#setBreakMinus").on("click", function() {
  if (breakTime > 0) {
    breakTime = $("#breakTime").text();
    breakTime--;
    $("#breakTime").text(breakTime);
    console.log(breakTime);
    reset();
  }
});

$("#setBreakPlus").on("click", function() {
  if (breakTime < 60) {
    breakTime = $("#breakTime").text();
    breakTime++;
    $("#breakTime").text(breakTime);
    console.log(breakTime);
    reset();
  }
});
$("#setSessionMinus").on("click", function() {
  if (minuteCounter > 1) {
    workTime = $("#setSession").text();
    workTime--;
    $("#setSession").text(workTime);
    console.log(workTime);
    reset();
  }
});

$("#setSessionPlus").on("click", function() {
  if (minuteCounter < 60) {
    workTime = $("#setSession").text();
    workTime++;
    console.log(workTime);
    $("#setSession").text(workTime);
    reset();
  }
});

function startPause(){  
  if (pauseTimer) {
    pauseTimer = false;
    $("#pauseTimer").text("pause");
    $("#circle").removeClass("finishedTime");
    countDown();
  } else {
    pauseTimer = true;
    $("#pauseTimer").text("unpause");
    $("#circle").addClass("finishedTime");
  }
}

function reset(){
    $("#circle").removeClass("finishedTime");
    $("#circle").removeClass("breakTime");
    $("#circle").addClass("workTime");
  workTime = parseInt($("#setSession").text());
  breakTime = parseInt($("#breakTime").text())-1;
  minuteCounter = workTime;
  secCounter = "1";
  timeType = "work";
  pauseTimer = true;
  $("#counter").text("--:--");
  $("#pauseTimer").text("start");
  console.log(workTime);
  console.log(breakTime);
}
              
            
!
999px

Console