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

              
                <!-- Fixed navbar -->
<nav class="navbar navbar-default">
   <div class="container">
      <div class="navbar-header">
         <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
         </button>
         <a class="navbar-brand" href="#">Task Timer</a>
     </div>
     <div id="navbar" class="collapse navbar-collapse">
        <ul class="nav navbar-nav">
            <li class="about"><a class="wide-tooltip" data-toggle="modal" data-target="#infoModal" data-hover="tooltip" data-trigger="hover" data-placement="bottom" title="About this Project" href="#"><i class="fa fa-info-circle"></i></a></li>
            <li id="nav-codepen"><a href="https://codepen.io/sonorangirl/pen/dGMZrY"><i class="fa fa-codepen"></i></a></li>
            <li id="nav-github"><a href="https://github.com/sonorangirl/Task-Timer"><i class="fa fa-github"></i></a></li>
            <li id="nav-contact"><a href="https://sonorangirl.github.io/"><i class="fa fa-envelope"></i></a></li>
        </ul>
     </div><!--/.nav-collapse -->
   </div>
</nav>

<div class="modal fade" id="infoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
   <div class="modal-dialog" role="document">
       <div class="modal-content">
           <div class="modal-header">
               <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
               <h4 class="modal-title" id="myModalLabel">About Task Timer</h4>
           </div>
           <div class="modal-body">
               <p>Task Timer is a project made for <a href="https://www.freecodecamp.com">FreeCodeCamp</a>. Based on the popular Pomodoro method, you can set times for how long you want to focus on a task on the right, and how long a break you'd like on the left. You can also make a list of the tasks you'd like to focus on below the timer and choose which task to focus on currently by selecting it. A sound will ring to remind you when the amount of time you've specified has elapsed.</p>
           </div>
           <div class="modal-footer">
               <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
           </div>
       </div>
   </div>
</div>

<!-- Begin page content -->
<div class="container-fluid">

   <div class="row header">

       <div class="col-sm-8 centered">
           <h1 class="text-center">Focus Me</h1>
       </div>

   </div>

   <div class="row">
       <div class="col-sm-8 centered">

           <div class="timer">
               <div class="row">
                   <div class="col-xs-2 time-adjust">
                       <button id="break-up" class="btn btn-small center-block"><span class="glyphicon glyphicon-triangle-top" aria-hidden="true"></span></button>
                       <p id="set-break-time" class="text-center adjust">5</p>
                       <button id="break-down" class="btn btn-small center-block"><span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span></button>
                       <p class="text-center adjust">Break Time</p>
                   </div>

                   <div class="col-xs-8">
                       <div class="clock"></div>
                       <div class="inner-clock"><p><span id="minutes">25</span> <span>:</span> <span id="seconds">00</span></p></div>
                   </div>

                   <div class="col-xs-2 time-adjust">
                       <button id="task-up" class="btn btn-small center-block"><span class="glyphicon glyphicon-triangle-top" aria-hidden="true"></span></button>
                       <p id="set-task-time" class="text-center adjust">25</p>
                       <button id="task-down" class="btn btn-small center-block"><span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span></button>
                       <p class="text-center adjust">Task Time</p>
                   </div>
               </div>
           </div> 
                    
           <div class="status">
               <div class="row">
                   <div class="col-sm-8 centered">
                       <h3 id="status-message" class="text-center">Add a Task Below</h3>
                   </div>
               </div>
           </div> 

           <div class="controls">
               <div class="row centered">
                   <div class="col-xs-4 control-start">
                       <button id="start" class="btn btn-small">Start</button>
                       <button id="unpaused" class="btn btn-small paused">Start</button>
                   </div>
                   <div class="col-xs-4 control-stop">
                       <button id="stop" class="btn btn-small">Stop</button>
                   </div>
                   <div class="col-xs-4 control-reset">
                       <button id="reset" class="btn btn-small">Reset</button>
                   </div>
               </div>
           </div>

       </div>
   </div>
            
   <div class="tasks">
       <div class="row">
          <h3 class="text-center">My Tasks</h3>
           <div class="col-xs-10 col-sm-8 centered">

               <div class="input-group" name="newTask">
                   <input type="text" name="taskItem" class="form-control" id="taskItemInput"placeholder="New Task">
                   <span class="input-group-btn">
                       <button id="add-task" class="btn btn-default" type="button">Add Task</button>
                   </span>
               </div><!-- /input-group -->

               <div id="list" class="row">
                   <div class="col-xs-7">
                       <ul class="task-list"> 
                       </ul>
                   </div>
                   <div class="col-xs-5">
                       <div class="task-options">
                       </div>
                   </div> 
               </div>

           </div>
       </div>
   </div>
            
 </div> <!-- end container-fluid -->

<footer class="footer">
   <div class="container">
       <p class="text-muted">Made by Erin Manahan for <a href="https://freecodecamp.com">FreeCodeCamp</a>.</p>
   </div>
</footer>



              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Oldenburg|Catamaran:400,700,100");
.srt {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px; }

.centered {
  float: none;
  margin-left: auto;
  margin-right: auto; }

html, body {
  position: relative;
  height: 100%;
  /* Margin bottom by footer height */
  margin-bottom: 60px; }

img {
  width: 100%; }

* {
  box-sizing: border-box; }

body {
  height: 100%;
  font-family: "Oldenburg", Helvetica, Arial, sans-serif;
  background-color: #2A52B7;
  /* Margin bottom by footer height */
  margin-bottom: 60px; }

h1,
h2,
h3,
h4,
h5 {
  font-family: "Oldenburg", Helvetica, Arial, sans-serif;
  color: #F6F8F2; }

p {
  font-family: "Catamaran", sans-serif;
  color: #F6F8F2; }

body > .container-fluid {
  padding: 60px 15px 0;
  background-image: linear-gradient(#2A52B7, #41A6AF); }

.container-fluid .text-muted {
  margin: 20px 0; }

a {
  color: #F6F8F2; }

button {
  text-align: center; }

.btn:focus, a:focus {
  outline: none !important;
  color: #F6F8F2; }

.container-fluid {
  min-height: 100%; }

.navbar {
  height: 70px;
  background-color: transparent;
  background: transparent;
  border: none;
  color: #F6F8F2;
  z-index: 100;
  margin-bottom: 0;
  border-radius: 0;
  transition: background-color 1s ease 0s; }

.navbar-default .navbar-brand {
  margin-top: 10px;
  margin-left: 10px;
  color: #F6F8F2;
  font-weight: 400; }
  .navbar-default .navbar-brand:hover {
    color: #41A6AF; }
.navbar-default .navbar-nav > li > a {
  color: #F6F8F2;
  font-weight: 500;
  font-size: 1em;
  text-transform: lowercase;
  margin: 10px 5px 5px 5px;
  border-radius: 5px; }
  @media (max-width: 768px) {
    .navbar-default .navbar-nav > li > a {
      text-align: center;
      color: #2A52B7; } }
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:active, .navbar-default .navbar-nav > li > a:focus {
  color: #41A6AF;
  border: 1px solid #41A6AF; }
  @media (max-width: 768px) {
    .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:active, .navbar-default .navbar-nav > li > a:focus {
      color: #F6F8F2;
      border-color: #F6F8F2; } }
.navbar-default .navbar-nav > li > a:visited {
  text-decoration: none; }
.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus {
  background-color: transparent;
  color: #41A6AF; }
.navbar-default .navbar-toggle {
  border-color: #F6F8F2; }
  .navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus {
    color: #2A52B7;
    background-color: #41A6AF; }
    .navbar-default .navbar-toggle:hover .icon-bar, .navbar-default .navbar-toggle:focus .icon-bar {
      background-color: #F6F8F2; }
  .navbar-default .navbar-toggle .icon-bar {
    background-color: #F6F8F2; }
  .navbar-default .navbar-toggle .colapsed {
    color: #2A52B7;
    background-color: #41A6AF; }
.navbar-default .navbar-collapse.collapse.in ul {
  color: #2A52B7;
  background-color: #41A6AF; }

.header {
  margin-top: -5em;
  margin-bottom: 2em; }

.time-adjust {
  padding-top: 7.5em; }
  .time-adjust button {
    background-color: #41A6AF;
    border-radius: 30%; }
    .time-adjust button:hover {
      background-color: #2A52B7;
      border-color: #F6F8F2; }
    .time-adjust button span {
      color: #F6F8F2; }
  .time-adjust p {
    font-family: "Oldenburg", Helvetica, Arial, sans-serif;
    color: #F6F8F2; }

.adjust {
  padding: 10px;
  font-size: 1.2em;
  font-style: bold;
  margin-top: 10px; }

.clock {
  height: 300px;
  width: 300px;
  max-width: 100%;
  border-radius: 50%;
  border: 5px solid #F6F8F2;
  margin: 0 auto;
  background-color: #41A6AF;
  text-align: center;
  font-size: 6em;
  margin-top: 20px;
  margin-bottom: .25em;
  -webkit-transition: 5s linear;
  -moz-transition: 5s linear;
  -ms-transition: 5s linear;
  -o-transition: 5s linear;
  transition: 5s linear; }

.inner-clock {
  margin: 0 auto;
  margin-top: -300px; }
  .inner-clock p {
    text-align: center;
    font-size: 5em;
    padding-top: 1.2em;
    color: #2A52B7; }
    .inner-clock p span {
      font-family: "Oldenburg", Helvetica, Arial, sans-serif;
      font-size: 80%; }

.status {
  padding-bottom: 2em; }

.paused {
  display: none; }

.controls {
  margin: 0 auto;
  margin-bottom: 20px;
  display: flex;
  padding: 1em; }
  .controls button {
    color: #41A6AF;
    background-color: #2A52B7;
    border-color: #41A6AF; }
    .controls button:hover {
      background-color: #41A6AF;
      color: #F6F8F2;
      border-color: #F6F8F2; }

.tasks {
  color: #2A52B7;
  margin-left: -15px;
  margin-right: -15px; }
  .tasks h3 {
    margin-top: 40px; }
  .tasks .input-group {
    padding: 2em; }
    .tasks .input-group #taskItemInput {
      background-color: #41A6AF;
      border: solid 3px #2A52B7;
      color: #2A52B7;
      height: 38px; }
    .tasks .input-group #add-task {
      background-color: #2A52B7;
      color: #41A6AF;
      border: solid 3px #2A52B7; }
      .tasks .input-group #add-task:hover {
        color: #F6F8F2; }
    .tasks .input-group input::-webkit-input-placeholder {
      color: #F6F8F2 !important; }
    .tasks .input-group input:-moz-placeholder {
      /* Firefox 18- */
      color: #F6F8F2 !important; }
    .tasks .input-group input::-moz-placeholder {
      /* Firefox 19+ */
      color: #F6F8F2 !important; }
    .tasks .input-group input:-ms-input-placeholder {
      color: #F6F8F2 !important; }
  .tasks #list ul {
    margin-bottom: 14%; }
    .tasks #list ul .task-container {
      display: inline-block; }
    .tasks #list ul .item {
      font-size: 1.4em; }
  .tasks #list .btn-group {
    margin-bottom: .25em; }
    .tasks #list .btn-group:first-child {
      margin-top: -.5em; }
    .tasks #list .btn-group .btn {
      padding: 2px 6px;
      background-color: #41A6AF;
      border-color: #F6F8F2;
      color: #F6F8F2; }
      .tasks #list .btn-group .btn:hover {
        background-color: #F6F8F2;
        color: #41A6AF; }

.footer {
  position: relative;
  bottom: 0;
  width: 100%;
  /* Set the fixed height of the footer here */
  height: 60px;
  clear: both;
  padding-top: 20px;
  background-color: #2A52B7; }
  .footer p {
    color: #41A6AF; }
    .footer p a {
      color: #41A6AF; }
      .footer p a:hover {
        color: #F6F8F2; }

.modal-content {
  background-color: #F6F8F2; }
  .modal-content p {
    color: #41A6AF; }
  .modal-content a {
    color: #F6F8F2; }
  .modal-content .modal-footer button {
    background-color: #2A52B7;
    color: #F6F8F2; }

/*# sourceMappingURL=main.css.map */

              
            
!

JS

              
                $(document).ready(function() {


////Set Time Control Buttons////

//breaks
var breakTime = 5;
var breakValue = $('#set-break-time');

var increaseBreak = $('#break-up').click(function() {
	breakTime += 1;
	breakValue.html(breakTime);
});

var decreaseBreak = $('#break-down').click(function() {
	if (breakTime != 1) {
		breakTime -= 1;
		breakValue.html(breakTime);
	}
});

//tasks
var taskTime = 25;
var taskValue = $('#set-task-time');

var increaseTask = $('#task-up').click(function() {
	taskTime += 1;
	taskValue.html(taskTime);
});

var decreaseTask = $('#task-down').click(function() {
	if (taskTime != 1) {
		taskTime -= 1;
		taskValue.html(taskTime);
	}
});



////Timer Functionality////

var minutes;
var seconds;
var isBreak = false;
var engage;
var count;

var currentMin = $('#minutes').html();
var currentSec = $('#seconds').html();

//Adds zeros in front of single digit numbers
function zeros() {

	if (seconds < 10) {
        seconds = '0' + seconds;
    }

    if (minutes < 10) {
        minutes = '0' + minutes;
    }
}

//Plays audio file for the user when timer is completed
var audio = new Audio('interactive_alert_tone.mp3');
// audio.play();

//Check if on a task or a break
function getCurrentTime() {
	
	if (isBreak) {
		count = $('#set-break-time').html();
		$('#status-message').html('Well Done! Take a break!');
	} else {
		count = $('#set-task-time').html();
		$('#status-message').html('Add a task below');
	}

	return parseInt(count, 10);
}

function countdown() {

	count -= 1;

	//Find the current seconds and minutes
	seconds = Math.floor(count%60);
	minutes = Math.floor(count/60);

	//Change html to display new time
	zeros();
	$('#minutes').html(minutes);
	$('#seconds').html(seconds);

	//Change isBreak value
	if (count === 0) {
		audio.play();
		clearInterval(engage);
      //resets border to original size
		$('.clock').css('border-width', '5px');

		if (isBreak) {
			isBreak = false;
		} else {
			isBreak = true;
		}

		count = getCurrentTime() * 60;

		timer();

	}
}

function timer() {
	engage = setInterval(countdown, 1000);
}

//// Set Control Buttons ////

var start = $('#start').click(function() {
	count = getCurrentTime() * 60;
	timer();
	
	//sets transition duration for border animation equal to count
	$('.clock').css({
        'border-width': '150px',
        'webkit-transition-duration' : count + 's',
        '-moz-transition-duration' : count + 's',
		'-ms-transition-duration' : count + 's',
		'-o-transition-duration': count + 's',
        'transition-duration': count + 's'
    });
});

var stop = $('#stop').click(function() {
	clearInterval(engage);
	$('#start').addClass('paused');
	$('#unpaused').removeClass('paused');
	
	//pauses border transition
	var border = $('.clock').css('border-width');
	$('.clock').css({
		'-webkit-transition' : 'none',
		'-moz-transition' : 'none',
		'-ms-transition' : 'none',
		'-o-transition': 'none',
		'transition': 'none',
		'border-width': border
	});
});

var unpause = $('#unpaused').click(function() {
	timer();
	$('#start').removeClass('paused');
	$('#unpaused').addClass('paused');
	
	//restarts border transition
	$('.clock').css({
        'border-width': '150px',
        'webkit-transition' : count + 's linear',
        '-moz-transition' : count + 's linear',
		'-ms-transition' : count + 's linear',
		'-o-transition': count + 's linear',
        'transition': count + 's linear'
    });
});

var reset = $('#reset').click(function() {
	clearInterval(engage);
	count = getCurrentTime() * 60;
	seconds = Math.floor(count%60);
	minutes = Math.floor(count/60);

	//Change html to display new time
	zeros();
	$('#minutes').html(minutes);
	$('#seconds').html(seconds);

	//resets border to original size
	$('.clock').css('border-width', '5px');
});

   //Add tasks to list
	function getTask() {
		var addTask = $('input[name=taskItem]').val();
    
		event.preventDefault();
		$('.task-list').append('<li class="item">' + addTask + '</li>');
		$('.task-options').append('<div class="btn-group pull-right" role="group" aria-label="task-options"><button type="button" class="btn btn-default select">select</button><button type="button" class="btn btn-default completed">completed</button><button type="button" class="btn btn-default delete">delete</button></div>');
		
		//set input field back to nothing
		$('input[name=taskItem]').val("");
	}

	$('#add-task').click(function() {
		getTask();
	});

	$('#taskItemInput').keypress( function(key) {
		if (key.which == 13) {
			console.log('Add task by return key');
			getTask();
		}
	});
	
   //// Task Buttons ////

	//Select task and add to status
	$(".task-options").on("click", ".select", function(){
		
		var indexOfTask = $('.select').index(this);

		var selectTask = $('.task-list li').eq(indexOfTask);

		console.log('function working, index of task is ' + indexOfTask);
		
		var taskName = selectTask.html();

		$('#status-message').html(taskName);

	});
	

	//Show task as completed by striking through task
	$(".task-options").on("click", ".completed", function(){
		
		var indexOfTask = $('.completed').index(this);

		var selectTask = $('.task-list li').eq(indexOfTask);

		console.log('function working, index of task is ' + indexOfTask);
		
		selectTask.css('text-decoration', 'line-through');

	});


    //Delete tasks from list
	$(".task-options").on("click", ".delete", function(){
		
		var indexOfTask = $('.delete').index(this);

		var selectTask = $('.task-list li').eq(indexOfTask);

		console.log('function working, index of task is ' + indexOfTask);
		
		selectTask.remove();

		//select the button group and delete it also

		$(this).parent().remove();

	});
   
}); // end document.ready




              
            
!
999px

Console