Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


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


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.


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.


                <h1 id="header">Pomodoro Clock</h1>
<h3 id = "fcc">FreeCodeCamp</h3>

<div class = "row all">

  <div id = "Toggle">
<p id = "session">Session</p>
    <div class="row Tog">
<div class = "row" id = "session1">
      <button class = "btn btn-info" id="session-minus">-</button>
<p class = "nos" id = "sessionTime">25</p>
    <button class = "btn btn-info" id = "session-plus">+</button>
  </div><!--ends sesion toggle-->

<div class = "info">
  <button class = "btn btn-primary" id="button1">Start/Stop</button>
  <button class = "btn btn-danger" id="button2">Reset</button>
  <p id="time">Time</p>
  <p id = "status">Status</p>
<div id = "Toggle">
<p id = "rest">Break</p>
    <div class="row Tog">
<div class = "row" id = "rest1">
      <button class = "btn btn-info" id="rest-minus">-</button>
<p class = "nos" id = "restTime">5</p>
    <button class = "btn btn-info" id = "rest-plus">+</button>
  </div><!--ends rest toggle-->




  background-color: rgba(17,43,100,0.8);
  color: white;
  text-align: center;
  font-family: helvetica;
.all{margin: 3em 0em 0em 0em;}

h1{margin: 1em 0em}

width: 33%;

width: 33%;
margin: 0 auto;
width: 50%;

#session1{margin : auto;}
#rest1{margin: auto;}

.nos{padding: 0.2em;}



  var toggle = "";
  var timerId = "";
  var now = "";
  var endTime = "";
  var time = "";
  var paused = "";
  var type = 1; //1 for session, 0 for break;

  var session = 25;
  var rest = 5;
    function timeSwitch(data){
    var mins = parseInt(data/(1000*60));
    var secs = parseInt((data - (mins*1000*60))/1000);
      secs = "0"+secs;}
    else {secs;};
        mins = "0"+mins;}
    return(mins +"m : "+secs+"s");
  }; //ends timeSwtich function

    //toggle session time:
    if(toggle == "on"){} else{
    session = Math.min(session+1,60);

      toggle = "";
  }); //ends session plus button
    if(toggle =="on"){} else{
    session = Math.max(session-1,0);
      toggle = "";
    }); //ends session minus button
  //toggle break time:
    if(toggle == "on"){} else{
    rest = Math.min(rest+1,60);
  }); //ends break plus button
    rest = Math.max(rest-1,0);
  }); //ends break minus button

function startTimer(end, start){
 timerId = setInterval(function(){
     //ends if statement for changing type
     start = new Date().getTime();
    end = start+(type*session+(1-type)*rest)*60*1000;
     endTime = end;
   } else { //ends if statement for time elapsed
    if(type==1){$("#status").html("Session");} else {$("#status").html("Break");};
     start = new Date().getTime();
 },100); //ends set Interval
}; //ends startTimer function

        if(toggle == ""){

// timer turned on for first time
     toggle = "on";
     time = new Date().getTime();
     endTime = time+(((session*type+rest*(1-type)))*60*1000);
     startTimer(endTime, time);
} //ends first if portion for starting timer on toggle ""

else if(toggle == "on")
      {toggle = "off";
      now = new Date().getTime();
      paused = endTime - now;
       //ends else if for toggle on portion
else {
  toggle = "on";
      time = new Date().getTime();
      endTime = time + paused;  
      startTimer(endTime, time);
}; //ends toggle instruction
  }); //ends button1 click  
    toggle = "";
}); //ends get ready