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

              
                <body>
  <p id = "message"></p>
  <img class = "lion" src = "https://s-media-cache-ak0.pinimg.com/736x/81/a1/2a/81a12afeaed6dacc09c94ccdfa75639f.jpg">
  <button type = "button" class = "btn btn-default clock" id = "clock"onClick = "start();"> <p id = "output"></p> </button> 
  <button type = "button" class = "btn btn-default pause"onClick = "stopClock();"> PAUSE </button> 
  <button type = "button" class = "btn btn-default reset"onClick = "reset();"> RESET </button> 
  <audio id = "audio" src = "http://soundbible.com/1252-Bleep.html" preload = "auto"></audio>
  
  <div class = "param1"><p class = "param1"> BREAK LENGTH </p>
    <button class = "btn btn-default plus1" onClick = "addMinus1('+');stopClock();
"> + </button> <p id = "output1"></p><button class = "btn btn-default minus1"onClick = "addMinus1('-');stopClock();"> - </button>
  </div>
  <div class = "param2"><p class = "param2"> SESSION LENGTH </p>
  <button class = "btn btn-default plus2" onClick = "addMinus2('+');reset();stopClock();"> + </button><p id = "output2"></p><button class = "btn btn-default minus2" onClick = "addMinus2('-');reset();stopClock();"> - </button></div>
  
</body>

<!-- google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>

              
            
!

CSS

              
                body {
  background-color: black;
  margin: 50px;
}

.pause {
  color: black;
  background-color: transparent;
  font-size: 15px;
  margin-left: -290px;
  position: relative;
  border-color: transparent;
  margin-top: -80px;
}

.reset {
  margin-top: -80px;
  font-size: 15px;
  color: red;
  background-color: transparent;
  border-color: transparent;
  position: relative;
  margin-left: 10px;
}

#message {
  margin-right: 130px;
  color: beige;
  font-size: 65px;
  text-align: center;
  font-family: "Lato";
  margin-bottom: 30px;
}

.lion {
  border-radius: 130px;
  margin-left: 590px;
  opacity: 0.6;
  margin-top: -20px;
  margin-bottom: -90px;
}

.quote {
  text-align: center;
  position: relative;
  color: #fff;
  font-size: 15px;
  margin-top: 40px
}

.btn:hover,
.btn:focus,
.btn:active {
  border-color: white;
  color: black;
}

.btn.active.focus,
.btn.active:focus,
.btn.focus,
.btn:active.focus,
.btn:active:focus,
.btn:focus {
  outline: none;
}

.clock,
.clock:hover,
.clock:active,
clock:focus {
  background-color: beige;
  position: relative;
  border-color: none;
  color: black;
  font-size: 60px;
  border-radius: 200px;
  width: 400px;
  height: 400px;
  opacity: 0.8;
  margin-left: 350px;
  margin-top: -330px;
}

.param1 {
  margin-top: 400px;
  margin-left: 140px;
  margin-bottom: 50px;
  color: beige;
  font-family: 'Lato', sans-serif;
}

.param1 p {
  margin-left: -90px;
  margin-top: -530px;
  padding-bottom: 5px;
}

.param2 {
  color: beige;
  margin-left: 340px;
  margin-top: -160px;
  padding-bottom: 15px;
  font-family: 'Lato', sans-serif;
}
.param2 p {
  margin-left: -294px;
  margin-top: -400px;
  padding-bottom: 10px;
}

.plus1,
.plus1:hover {
  background-color: black;
  margin-top: -14px;
  margin-left: 25px;
  color: white;
  border-color: white;
}

.minus1,
.minus1:hover {
  background-color: black;
  margin-top: -94px;
  margin-left: -128px;
  color: white;
  border-color: white;
}

.plus2,
.plus2:hover {
  background-color: black;
  margin-top: 24px;
  margin-left: -177px;
  color: white;
  border-color: white;
}

.minus2,
.minus2:hover {
  background-color: black;
  border-color: white;
  margin-top: -100px;
  margin-left: -330px;
  color: white;
}

#output {
  font-family: 'Lato', sans-serif;
  text-align: center;
  padding-right: 20px;
  font-size: 85px;
  color: #111;
}

#output1 {
  margin-top: -44px;
  margin-left: -51px;
  color: white;
  font-size: 35px;
}

#output2 {
  color: white;
  font-size: 35px;
  margin-top: -42px;
  margin-left: -256px
}


@media only screen and (min-width: 1600px) {

  .lion{
    
    margin-left: 799px;
    margin-top: 114px;
  }
  .clock{
    
    margin-left: 595px;
  }
  
  .param2 p{
    
    margin-left: -35px;
  }
  .param1 p{
    
    margin-left: 168px;
  }
  .plus2{
    
    
    margin-left: 87px;
  }
  #output2{
      
    margin-left: 4px;
  }
  .minus2{
    
    margin-top: -109px;
    margin-left: -76px;
  }
  .plus1{
    
    margin-left: 287px;
  }
  #output1{
    
    margin-left: 214px;
  }
  .minus1{
    
    margin-left: 129px;
  }
  #message{
    
    margin-left: -101px;
  }
  .clock,
.clock:hover,
.clock:active,
clock:focus {
  
  margin-left: 550px;
}
}

@media only screen and (max-width: 768px) {

  .lion{
    
    margin-left: 799px;
    margin-top: 114px;
  }
  .clock{
    
    margin-left: 259px;
  }
  
  .param2 p{
    
    margin-left: -295px;
  }
  .param1 p{
    
    margin-left: -89px;
  }
  .plus2{
    
    
    margin-left: -172px;
  }
  #output2{
      
    margin-left: -254px;
  
  }
  .minus2{
    
    margin-top: -109px;
    margin-left: -336px;
  }
  .plus1{
    
    margin-left: 30px;
  }
  #output1{
    
    margin-left: -52px;
  }
  .minus1{
    
    margin-left: -130px;
  }
  #message{
    
    margin-right: 22px;
    margin-bottom: -87px;
    margin-top: 120px;
  }
  .clock,
.clock:hover,
.clock:active,
clock:focus {
  
  margin-left: 250px;
}
}

@media only screen and (max-width: 414px) {

  .lion{
    
    margin-left: 799px;
    margin-top: 114px;
  }
  .clock{
    
    margin-left: 259px;
  }
  
  .param2 p{
    
    margin-left: -125px;
    margin-top: -189px;
  }
  .param1 p{
    
    margin-top: -850px;
    margin-left: -151px;
  }
  .plus2{
    
    
    margin-left: -24px;
    margin-top: 22px;
  }
  #output2{
      
    margin-left: -87px;
  
  }
  .minus2{
    
    margin-top: -111px;
    margin-left: -147px;
  }
  .plus1{
    
    margin-left: -62px;
  }
  #output1{
    
    margin-left: -121px;
  }
  .minus1{
    
    margin-left: -180px;
  }
  #message{
    
    margin-right: 22px;
    margin-bottom: -87px;
    margin-top: 61px;
    width: 112%;
    font-size: 48px;
    margin-left: -20px;
  }
  .clock,
.clock:hover,
.clock:active,
clock:focus {
  
  margin-left: 250px;
}
  .clock{
    
    width: 300px;
    height: 300px;
    margin-left: 14px;
    margin-top: -220px;
  }
  .pause{
    
    margin-left: 81px;
    margin-top: -137px;
  }
  .reset{
     
    
    margin-top: -137px;
    
  }
}

@media only screen and (max-width: 320px) {

  #output{
    
    font-size: 70px;
    margin-left: 11px;
  }
  .clock{
    
    margin-left: 259px;
  }
  
  .param2 p{
    
    margin-left: -193px;
    margin-top: -189px;
  }
  .param1 p{
    
    margin-top: -828px;
    margin-left: -167px;
  }
  .plus2{
    
    
    margin-left: -113px;
    margin-top: 22px;
  }
  #output2{
      
    margin-left: -160px;
  
  }
  .minus2{
    
    margin-top: -111px;
    margin-left: -205px;
  }
  .plus1{
    
    margin-left: -88px;
  }
  #output1{
    
    margin-left: -131px;
  }
  .minus1{
    
    margin-left: -180px;
    margin-top: -97px;
  }
  #message{
    
    margin-right: 22px;
    margin-bottom: -87px;
    margin-top: 48px;
    width: 159%;
    font-size: 39px;
    margin-left: -62px;
  }
  .clock,
.clock:hover,
.clock:active,
clock:focus {
  
  margin-left: 250px;
}
  .clock{
    
    width: 250px;
    height: 250px;
    margin-left: -14px;
    margin-top: -331px;
  }
  .pause{
    
    margin-left: 35px;
    margin-top: -194px;
    font-size: 13px;
  }
  .reset{
     
    
   margin-top: -197px;
   font-size: 13px;
    
  }
}
              
            
!

JS

              
                var sessionParam = [25];
var breakParam = [5];
var clockArr = [25, ":", 0, 0];
var val1 = 0;
var min = [clockArr[0], ":", "", 60];
var mes1 = "TIME TO WORK";
var mes2 = "BREAK TIME";


function start() {
 
 document.getElementById("clock").disabled = true; document.getElementById("message").innerHTML = mes1;
  var myClock = window.setInterval(function startTime() {
   
    if (min[3] === 60 && min[0] !== 0) {

      min[0]--;
    }

    min[3]--;

    if (min[3] < 10 && min[3] >=0) {

      min[2] = 0;
    } else {

      min[2] = null;
    }

    if (min[3] === -1 || min[3] === 0 && min[0] !== 0) {
      min[3] = 59;
      min[0]--;
    } else if (min[3] === -1 && min[0] === 0) {
      min[3] = 59;

    }

 
    if(min[0] ===0 && min[3]===0){
    
    var conf = confirm("Time's up. Would you like to continue working?");
      if(conf === true){
        
        min[0] = sessionParam[0];
        document.getElementById("message").innerHTML = mes1;
      }
      else{
        min[0] = breakParam[0];
        document.getElementById("message").innerHTML = mes2;
      }
      min[3] = 0;
      
  }

    var joinString = min.join("");
    document.getElementById("output").innerHTML = joinString;
   
    this.stopClock = function() {
 document.getElementById("clock").disabled = false; window.clearInterval(myClock).bind(this);
      
    }

  }, 1000);

  
                            
  this.reset = function() {

    min[0] = clockArr[0];
    min[3] = 0;
    
  }
}

function clock(val) {

  clockArr[0] = val;
  var outStr = clockArr.join("");
  document.getElementById("output").innerHTML = outStr;

}

function addMinus1(val) {
  if (breakParam[0] === 1 && val === "-") {
    breakParam[0] = 1;
  } else {
    if (val === "-") {

      breakParam[0]--;
    } else if (val === "+") {

      breakParam[0]++;
    }

  }

  var outStr = sessionParam.join();
  document.getElementById("output1").innerHTML = breakParam[0];
}

function addMinus2(val) {

  if (sessionParam[0] === 1 && val === "-") {
    sessionParam[0] = 1;
    clockArr[0] = 1;
  } else {
    if (val === "-") {

      sessionParam[0]--;
      clockArr[0]--;
    } else if (val === "+") {

      sessionParam[0]++;
      clockArr[0]++;
    }
  }
  var outStr = sessionParam.join();
  document.getElementById("output2").innerHTML = sessionParam[0];

  clock(clockArr[0]);
  
}

clock(clockArr[0]);
addMinus2(sessionParam[0]);
addMinus1(breakParam[0]);
//probs: button interval, button alignment
              
            
!
999px

Console