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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <div id="wrapper" class="container-fluid">
  <div id="main">
    <div class="page-header">
      <h1 class="text-center">The Pomodoro Technique</h1>
    </div>
    <div id="lengths">

      <div id="controls">
        <div class="timer-row">
          <div id="sessionText">Session</div>
          <div id="sessionMinus" class="timer-minus"><span class="glyphicon glyphicon-minus-sign"></span></div>
          <div id="sessionLength" class="timer-length"><span>25</span></div>
          <div id="sessionPlus" class="timer-plus"><span class="glyphicon glyphicon-plus-sign"></span></div>
        </div>
        <div class="timer-row">
          <div id="breakText">Break</div>
          <div id="breakMinus" class="timer-minus"><span class="glyphicon glyphicon-minus-sign"></span></div>
          <div id="breakLength" class="timer-length"><span>5</span></div>
          <div id="breakPlus" class="timer-plus"><span class="glyphicon glyphicon-plus-sign"></span></div>
        </div>
      </div>
    </div>

    <div id="timer">
      <div id="circle">

        <div id="circle-numbers">
          <div id="circle-minutes">25</div>
          <span id="circle-colon">:</span>
          <div id="circle-seconds">00</div>
        </div>


        <div id="circle-controls">
          <div id="circle-play-pause">
            <span class="glyphicon glyphicon-play"></span>
          </div>
          <div id="circle-reset">
            <span class="glyphicon glyphicon-stop"></span>
          </div>
        </div>


        <div id="circle-text">
          <div id="timer-type">
          </div>
        </div>
      </div>
    </div>


  </div>
  <div class="push"></div>
</div>
<footer class="footer">
  <span>&copy; 2017 Developed by Manish Giri for FreeCodeCamp</span>
</footer>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Open+Sans);
@import url(https://fonts.googleapis.com/css?family=Courgette);
@import url(https://fonts.googleapis.com/css?family=Playfair+Display+SC:700italic);
@import url(https://fonts.googleapis.com/css?family=Pacifico);
@import url(https://fonts.googleapis.com/css?family=Slabo+27px);
@import url(https://fonts.googleapis.com/css?family=Playball);


body {
  /*background: url(dark_embroidery.png);*/
  /* background-color: #DADCDC; */
  
  background-color: #111;
  background-image: url(https://amvnow.files.wordpress.com/2012/01/board-black-series-texture-background-wood-wallpaper-wood-texture-wallpapers-476.jpg);
}

.page-header {
  font-family: 'Courgette', cursive;
  text-transform: uppercase;
  font-size: larger;
  color: red;
}

#controls {
  color: #20B2AA;
  font-family: 'Open Sans', sans-serif;
  padding: 10px;
  text-align: center;
  width: 400px;
  margin: 10px auto;
}

.timer-row {
  padding: 10px;
  font-size: 150%;
}

.timer-row div {
  width: 20%;
  display: inline-block;
}

#breakLength {
  color: red;
}

#sessionLength {
  color: green;
}

#timer {
  text-align: center;
  margin-top: 6%;
}

#circle {
  text-align: center;
  width: 340px;
  height: 340px;
  -webkit-border-radius: 200px;
  -moz-border-radius: 200px;
  border-radius: 170px;
  border: 3px solid #4E5F5D;
  padding: 5%;
  color: #43A78D;
  margin: 40px auto;
}

#circle-numbers {
  padding: 5px;
  margin-top: -10px;
  font-family: 'Playfair Display SC', serif;
  font-family: 'Slabo 27px', serif;
}

#circle-numbers div {
  width: 41%;
  display: inline-block;
  padding: 2px;
}

#circle-minutes {
  font-size: 600%;
}

#circle-seconds {
  font-size: 400%;
}

#circle-numbers span {
  font-size: 300%;
  padding: 6px;
}

#circle-controls {
  margin: 0px 20px 0px 20px;
}

#circle-controls div {
  width: 40%;
  display: inline-block;
  padding: 10px;
}

.timer-minus span,
.timer-plus span,
#circle-play-pause,
#circle-reset {
  cursor: pointer;
}

.timer-row div,
#circle-controls div,
#circle-text div {
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -o-user-select: none;
  user-select: none;
}

#circle-controls {
  font-size: 150%;
}

#circle-text {
  font-family: 'Open Sans', sans-serif;
  margin: 15px;
  color: #20B2AA;
  font-size: 20px;
  text-transform: uppercase;
  padding: 5px;
}

@media screen and (min-width: 1400px) {
    #circle {
    text-align: center;
    width: 500px;
    height: 500px;
    -webkit-border-radius: 250px;
    -moz-border-radius: 250px;
    border-radius: 250px;
    border: 3px solid #4E5F5D;
    padding: 5%;
    color: #43A78D;
    margin: 40px auto;
  }

  #circle-controls {
    margin: 50px 20px;
  }

  #circle-text {
    margin: 50px auto 20px auto;
    padding: 20px;
  }
}

@media screen and (max-width: 560px) {
   #circle {
    text-align: center;
    width: 300px;
    height: 300px;
    -webkit-border-radius: 150px;
    -moz-border-radius: 150px;
    border-radius: 150px;
    border: 3px solid #4E5F5D;
    padding: 5%;
    color: #43A78D;
    margin: 1 0px auto;
  }
}

/* STICKY FOOTER */
html, body {
  height: 100%;
  margin: 0;
}

#wrapper {
  min-height: 100%;

  /* Equal to height of footer */
  /* But also accounting for potential margin-bottom of last child */
  margin-bottom: -50px;
}

.footer, .push {
  height: 50px;
}

footer {
  text-align: center;
}
footer span {
  font-family: 'Courgette', cursive;
  color: rgb(67,167,141); 

  position: relative;
  top: 20px;

}

              
            
!

JS

              
                //cache variables
var $sessionMinus = $("#sessionMinus span");
var $sessionLengthString = $("#sessionLength span");
var sessionLengthNum = parseInt($sessionLengthString.text(),10);
var $sessionPlus = $("#sessionPlus span"); 

var $breakMinus = $("#breakMinus span");
var $breakLengthString = $("#breakLength span");
var breakLengthNum = parseInt($breakLengthString.text(), 10);
var $breakPlus = $("#breakPlus span");

var $circleMinutes = $("#circle-minutes");
var circleMinutesNum = parseInt($circleMinutes.text(), 10);
var $circleSeconds = $("#circle-seconds");
var circleSecondsNum = parseInt($circleSeconds.text(), 10);


var $timerStart = $("#circle-play-pause");
var $timerSpan = $("#circle-play-pause span");
var $timerPause = $("#circle-pause");
var $timerReset = $("#circle-reset");
var $timerIndicator = $("#timer-type");

var nIntervalId = null;
//indicate if play/pause
var play = false;

//indicate which type of timer
var session = true;

var clickSound = new Audio("https://dl.dropbox.com/s/ac35syrsj9za5xn/button-21.wav?dl=0");



//test
console.log("Session Length = " + sessionLengthNum);
console.log("Break Length = " + breakLengthNum);
console.log("Timer minutes = " + circleMinutesNum);
console.log("Timer seconds = " + circleSecondsNum);

//clear timer text
clearTimerText();

//click handlers
$sessionMinus.click(function() {
	if(sessionLengthNum > 1)  {
		if(play) {
			//when session minus button is clicked while timer is running
			play = false;
			$timerSpan.removeClass("glyphicon glyphicon-pause")
			$timerSpan.addClass("glyphicon glyphicon-play");
			stopTimer();
			clearTimerText();
		}
		sessionLengthNum--;
		circleMinutesNum = sessionLengthNum;
		$sessionLengthString.html(sessionLengthNum);
		$circleMinutes.html(sessionLengthNum);
		stopTimer();
		clearTimerText();
	}

});

$sessionPlus.click(function() {
		if(play) {
			//when session plus button is clicked while timer is running
			play = false;
			$timerSpan.removeClass("glyphicon glyphicon-pause")
			$timerSpan.addClass("glyphicon glyphicon-play");
			stopTimer();
			clearTimerText();
		}
	sessionLengthNum++;
	circleMinutesNum = sessionLengthNum;
	$sessionLengthString.html(sessionLengthNum);
	$circleMinutes.html(sessionLengthNum);
	stopTimer();
	clearTimerText();

});

$breakMinus.click(function() {
	if(breakLengthNum > 1) {
		breakLengthNum--;
		$breakLengthString.html(breakLengthNum);
	}

});

$breakPlus.click(function() {
	breakLengthNum++;
	$breakLengthString.html(breakLengthNum);
});

$timerStart.click(function() {
	console.log($(this).text());
	console.log("Play = " + play);
	if(play) {
		//timer is already running and 'play' is clicked
		clickSound.play();
		clearTimerText();
		console.log("Pause clicked");
		play = false;
		$timerSpan.removeClass("glyphicon glyphicon-pause")
		$timerSpan.addClass("glyphicon glyphicon-play");
		stopTimer();
	}
	else {
		//timer is paused and 'play' is clicked
		if(!session) {
			console.log("Session = " + session);
			clearTimerText();
			session = false;
			setTimerText();
		}
		else {
			console.log("Session = " + session);
			clearTimerText();
			session = true;
			setTimerText();
		}
		clickSound.play();
		setTimerText();
		play = true;
		$timerSpan.removeClass("glyphicon glyphicon-play")
		$timerSpan.addClass("glyphicon glyphicon-pause");

		startTimer();
	}
	
});



$timerReset.click(function() {
	play = false;
	clickSound.play();
	clearTimerText();
	if(!session) {
		session = true;
	}
	$timerSpan.removeClass("glyphicon glyphicon-pause")
	$timerSpan.addClass("glyphicon glyphicon-play");
	circleMinutesNum = sessionLengthNum;
	circleSecondsNum = 0;
	$circleMinutes.html(sessionLengthNum);
	$circleSeconds.html("00");
	stopTimer();

});

function startTimer() {
	nIntervalId = setInterval(changeTimer, 1000);
}

function changeTimer() {
	var minutes, seconds;
	var totalSeconds = circleMinutesNum * 60 + circleSecondsNum;
	console.log("Total Seconds = " + totalSeconds);
	if(totalSeconds > 0) {

		if(play) {
			//session = true;
			totalSeconds--;
			minutes = parseInt(totalSeconds / 60, 10);
			seconds = parseInt(totalSeconds % 60, 10);
			circleMinutesNum = minutes;
			circleSecondsNum = seconds;

			minutes = minutes < 10 ? "0" + minutes: minutes;
			seconds = seconds < 10 ? "0" + seconds: seconds;

			$circleMinutes.html(minutes);
			$circleSeconds.html(seconds);
			setTimerText();
			/*$timerIndicator.html("Session");
			$timerIndicator.css("color", "#20B2AA");*/
		}
	}
	else {

		var audio = new Audio('https://dl.dropbox.com/s/yelxwf8xc22lx9r/Alien_Siren.mp3?dl=0');
		audio.play();
		stopTimer();

		circleMinutesNum = breakLengthNum;
		circleSecondsNum = 00;
		play = true;
		if(!session) {
			session = true;
			setTimerText();
			startTimer();
		}
		else if(session) {
			session = false;
			setTimerText();
			startTimer();
		}
		
		//setTimerText();
/*
		$timerIndicator.html("Break");
		$timerIndicator.css("color", "red");*/
		//startTimer();


	}
}

function stopTimer() {
	clearInterval(nIntervalId);
}

function setTimerText() {
	if(session) {
		$timerIndicator.html("<b>Session</b>");
		$timerIndicator.css("color", "green");
	}
	else {
		$timerIndicator.html("Break");
		$timerIndicator.css("color", "red");
	}
}

function clearTimerText() {
	$timerIndicator.html("");
}
              
            
!
999px

Console