cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <div class="content">
  <div class="title" id="title">POMODORO</div>
  
  <div class="container top">
    <div class="container">
      <button id="five" class="preset">5</button>
    </div>
    <div class="container">
      <button id="twentyfive" class="preset">25</button>
    </div>
  </div>


  <div class="container">
    <button id="minus">-</button>
  </div>
  <div class="container pomocontainer">
    <button class="pomobutton" id="pomobutton">
                <div class="pomoinner" id="pomoinner"></div>
            </button>
  </div>
  <div class="container">
    <button id="plus">+</button>
  </div>
  <button id="reset" class="reset">C</button>
  
  <div class="text">Completed Pomodoros</div>
    <div class="notepad">
     
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>
    <div class="marks"></div>

    
  </div>
  
</div>

<audio id="audio1" class="audio" src="http://www.freesound.org/data/previews/337/337049_3232293-lq.mp3"></audio>

<audio id="audio0" class="audio" src="https://s3.amazonaws.com/freecodecamp/simonSound1.mp3"></audio>
            
          
!
            
              
.title {

  font-size: 200%;
  font-weight: bold;
}

.content {  
  text-align: center;
  padding: 20px;
  margin: 30px;
  font-family: sans-serif;
  font-size: 100%;
  color: grey;
  min-width: 400px;
}

button{
  border: none;
  color: white;
  font-weight: bold;
  border-radius: 50%;
  font-size: 100%;
  height: 35px;
  width: 35px;
  background-color: lightgrey;
  
}

button:hover {
  
    border: 2px solid white;
  
}


button:focus {
  outline:none;
}

.pomobutton {
  background-color: lightblue;
  height: 150px;
  width: 150px;
  margin: 0px 10px;
  font-size: 200%;
  
}

.preset {
  
  margin: 0px 35px;
  
}

.container {
  display: inline;
}

.top {
  
  display: block;
  padding-top: 40px;
}

.reset {
  display: block;
  margin: 12px auto;
}

.marks {
  padding-top: 5px;
  float: left;
  margin: 0px; 
  color: grey;
  width: 30px;
  height: 30px;  
}

.text {
  margin-top: 30px;
  text-transform: uppercase;
  color: lightgrey;
  font-size: 80%;
}

.notepad {
  border: 2px solid whitesmoke;
  margin: 0 auto;
  margin-top: 10px;
  width: 240px;
  height: 60px;
  margin-bottom: 20px;
  background-color: whitesmoke;
  border-radius: 5px;
  
}

            
          
!
            
              //import jquery
var audio0 = document.getElementById("audio0");
var audio1 = document.getElementById("audio1");
var title = document.getElementById("title");
var pomoInner = document.getElementById("pomoinner");
var pomoButton = document.getElementById("pomobutton");
var minus = document.getElementById("minus");
var plus = document.getElementById("plus");
var startMins = 25;
var mins = 25;
var secs = 0;
var timerPause = true;
var intervalId;
var marks = document.getElementsByClassName("marks");

var markCount = 0;



$(".marks").click(function() {
  if ($(this).html() == "") {
    marks[markCount].innerHTML = "●";
    markCount ++;
  } else if ($(this).html() == "●") {
    markCount --;
    marks[markCount].innerHTML = "";
  }
});


function setTo(preset) {
  startMins = preset;
  mins = preset;
  secs = 0;
  displayTime();
}

document.getElementById("five").onclick = function() {
  setTo(5);
};

document.getElementById("twentyfive").onclick = function() {
  setTo(25);
};

// update timer display function. Takes the time and makes it pretty.

function displayTime() {
  var prettySecs = secs;
  if (secs.toString().length < 2) {
    prettySecs = "0" + secs.toString();
  }

  pomoInner.innerHTML = mins + ":" + prettySecs;
}

displayTime();

// timer function - count down from mins. run multiple times using setInterval. when timer reaches zero, stop timer function and reset to default mins. ( the user set mins)

function updateTime() {
  if (timerPause === false) {
    if (secs > 0) {
      secs -= 1;
    } else if (mins > 0) {
      secs = 59;
      mins -= 1;
    } else if (mins === 0 && secs === 0) {
      mins = startMins;
      timerPause = true;
      audio1.play();
      title.innerHTML = "TIME'S UP!";
      pomoButton.style.backgroundColor = "lightblue";
      clearInterval(intervalId);
      if (startMins > 10) {
      marks[markCount].innerHTML = "●";
      markCount ++;
      }
    }

    displayTime();
  }
}

// when timer is clicked, start timer function, if timer is clicked again, pause timer function

pomoButton.onclick = function() {
  audio0.play();

  if (timerPause === true) {
    timerPause = false;
    title.innerHTML = "POMODORO-ING!";
    pomoButton.style.backgroundColor = "indianred";
    intervalId = setInterval(updateTime, 1000);
  } else {
    timerPause = true;
    title.innerHTML = "PAUSED";
    pomoButton.style.backgroundColor = "lightblue";
    clearInterval(intervalId);
  }
};

// when minus is clicked, starting mins -=1

minus.onclick = function() {
  if (mins > 0) {
    startMins = mins - 1;
    mins -= 1;
    displayTime();
  }
};

// when plus is clicked, starting mins +=1

plus.onclick = function() {
  startMins = mins + 1;
  mins += 1;
  displayTime();
};

// reset button

document.getElementById("reset").onclick = function() {
  mins = startMins;
  secs = 0;
  timerPause = true;
  title.innerHTML = "POMODORO";
  pomoButton.style.backgroundColor = "lightblue";
  clearInterval(intervalId);
  displayTime();
  

};

            
          
!
999px
Loading ..................

Console