Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

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.

            
              <link href='https://fonts.googleapis.com/css?family=Delius+Swash+Caps' rel='stylesheet' type='text/css'>
<body>
<div class='container'><center>
  <h1 style='font-size:50px;' class='text-center text-primary'><span class='glyphicon glyphicon-align-right' style='color:white;'></span><font style='color:white;'> KSoft</font>Pomodoro</font> <span class='glyphicon glyphicon-align-left'></span></h1>
  
  <div class='row'>
      <div class='col-md-6 text-center'>
           
           <input autofocus id='work' type='text' min=0 max=200 value='' class='form-control ins' placeholder="Enter work minutes...">
        
           <input id='break' class='form-control ins' type='text' min=0 max=100 value='' placeholder="Enter break minutes...">
           <div class='jumbotron myJumbo'>
              <h1 id='msg' class='text-center'></h1>
              <h4 id='time' class='text-center'></h4>
          </div>
      </div>
    
    <div class='col-md-6'>
        <a href='#' id='start' class='btn btn-primary center-block'><span class='glyphicon glyphicon-play'></span></a>
        <a href='#' id='pause' class='btn btn-primary center-block pause'><span class='glyphicon glyphicon-pause'></span></a>
        <a href='#' id='reset' class='btn btn-primary center-block'><span class='glyphicon glyphicon-repeat'></span></a>
    </div>
  
  </div>
  
  
</div>
  

  <h1 id='alert' class='text-center'></h1>
  </center>
</div>
</body>
            
          
!
            
              body {
  background-color:#0C2C52;
}

* {
  font-family: 'Delius Swash Caps', cursive;
}
#start, #pause, #reset {
  height:90px;
  font-size:30px;
  margin-top:10px;
  line-height:80px;
}

.jumbotron {
  margin-top:10px;
  background-color:#0C2C52;
  color:white;
  border-left:10px solid #DEE7EF;
  border-right:10px solid #5A79A5;
}
.ins {
  margin-top:10px;
}

h3 {
  font-size:35px;
  font-weight:bold;
}

.container { 
  padding:20px;

  border-left:20px solid #5A79A5;

  border-right:20px solid #DEE7EF;
  margin-top:130px;
  border-radius:50px;
  //box-shadow:0px 10px 25px #bbb;
}



            
          
!
            
              var timer;

$(document).ready(function(){
var working = false;
var active = '';
var workTime = 0;
var breakTime = 0;
checkStatus();


  //Controls if a button is disabled based on status of timer
function checkStatus() {
  if (!working) {
    $('#start').removeClass('disabled');
    $('#pause').addClass('disabled');
    $('#reset').addClass('disabled');
    } else {
    $('#pause').removeClass('disabled');
    $('#reset').removeClass('disabled');
    $('#start').addClass('disabled');
    }
}
//End Check Status
    //Function to Show Time  !!Finished!!
function showTime(time) {
   var min = Math.floor(time/60);
   var sec = Math.round(time%60);
      if (sec < 10) {
        sec = '0' + sec;
      }
      var timeString = min+':'+sec;
      $('#msg').text(timeString);
     }
  //End showTime
  //Enables the timer  !!Mostly Finished!!
function startTimer() {
  $('.jumbotron').css('visibility', 'visible');
  return setInterval(function() {
    console.log("Work Timer...")
    workTime--;
    if (workTime < 0) {
      clearInterval(timer);
      timer = breakTimer();
    } else {
      showTime(workTime);
    }
  }, 1000);
}
  //End Timer
  //What Happens when #start is pressed
 function start() {     
   if (working == true){ //This keeps it from being spammable
      return
   } //Else
  workTime = $('#work').val()*60;
    breakTime = $('#break').val()*60;
   working = true;
   checkStatus();    
    timer = startTimer();
 } 
  
  
  //What Happens when #pause/resume is pressed
  function pause() {
    clearInterval(timer);
    $('.resume').unbind().click(resume);
    $('#pause').html('Resume');
    $('#pause').addClass('resume');
    $('#pause').removeClass('pause');
    $('.resume').click(resume);
   }
  
  
  function resume(){  
    $('#pause').unbind().click(pause);
    $('#pause').html('Pause');
    $('#pause').addClass('pause');
    $('#pause').removeClass('resume');
    timer = startTimer();
    }
  //What happens when #reset is pressed
  function reset() {
   clearInterval(timer);
    working = false;
    workTime = 0;
    breakTime = 0;
    checkStatus();
    $('.jumbotron').css('visibility', 'hidden');
    $('#msg').html("");
  }
  //Break Timer
  function breakTimer() {
    $('.jumbotron').css('visibility', 'visible');
    return setInterval(function() {
      console.log("Break Timer...");
    breakTime--;
    if (breakTime < 0) {
      clearInterval(timer);
      working = false;
      start();
    } else {
      showTime(breakTime);
    }
  }, 1000);
}
  //Button Association
  $('#start').click(start);
    $('#work').keypress(function(e) {
    if(e.which == 13) {
       start();
    }
});
  //This Makes Enter Work as well to Start
  $('.pause').click(pause);
  $('#reset').click(reset); 
  
}); //End of DocReady
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console