123

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.

            
              <head>
  <link href='https://fonts.googleapis.com/css?family=Amatic+SC:700' rel='stylesheet' type='text/css'>
</head>
<div class="container">
<h1>Clark's Pomodoro Timer</h1>
 
  <div class="row penis">
    <button id="minusRun" class="operator">-</button>
<input class="" type='text' id='mine' value="1"></input>
  <button id="plusRun" class="operator">+</button>
  <button class="operator" id="minusBreak">-</button>
<input class="" type='text' id="break" value='1'></input>
<button class="operator" id="plusBreak">+</button>
</div>
<div class="row penis">
<button class="" id="start">start</button>
<button class="" id="pause">pause</button>
<button class="" id='breakBut'>Break</button>
<button class="" id="stop">Stop</button>
</div>
<div class="row">
<p id="para"></p>
<p id="para2"></p>
</div>
</div>
            
          
!
            
              * {
  color: black;
  
}
body {
  background: URL(http://www.color-hex.com/palettes/14756.png);
}

h1 {
  font-family: 'Amatic SC', sans-serif;
  text-align: center;
  font-size: 3.5em;
  color: #fdf5e6;
  text-shadow: 3px 3px black;
  margin-top: 70px;
}
input {
  border: 2px solid black;
  text-align: center;
  margin: 20px auto;
  font-family: 'Amatic SC', sans-serif;
  font-size: 2em;
  width: 100px;
  height: 50px;
  border-radius: 3px;
  background: #bbb;
}
button {
  padding: 5px 0px 5px 0px;
  text-transform: uppercase;
  font-family: 'Amatic SC', sans-serif;
  color: black;
  font-size: 1.35em;
  letter-spacing: 1px;
  background: #bbb;
  border: 2px solid black;
  margin-top: 20px;
  border-radius: 6px;
  width: 180px;
  margin: auto;
}
p {
  text-align: center;
  font-family: 'Amatic SC', sans-serif;
  font-size: 2.4em;
  color: #fdf5e6;
  text-shadow: 2px 2px black;
}
#para {
  margin-top: 32px;
}
.managers {
  background:none;
  border: solid 2px black;
  border-radius: 3px;
  width: 50px;
  
}
#minus {
  float: left;
}
.penis {
  text-align: center;
  margin-top: 10px;
}
.operator {
  width: 50px;
  background: #cccccc;
}
            
          
!
            
              
var timeLength;
var breakLength;
var counter=0;
var going = false;
var breaking = false;
var inInterval;
var wav = 'http://oringz.com/oringz-uploads/sounds-969-isnt-it.mp3';
var audio = new Audio(wav);


document.getElementById('start').onclick = function() {starting();};

function starting() {
  if (going==true) {}
  else {
  timeLength = Number(document.getElementById('mine').value)*60;
  breakLength = Number(document.getElementById('break').value)*60;
  going = true;
  running();}
}
document.getElementById('stop').onclick = function() {stop();};
function stop() {
  going =false;
  breaking = false;
  clearInterval(inInterval);
  counter = 0;
  document.getElementById('para').innerHTML = "Stopped, click Start to begin.";
  document.getElementById('para2').innerHTML = "";
}
document.getElementById('breakBut').onclick = function() {breakButton();};
function breakButton() {
  //if (breaking == true) {};
  
  going = false;
  breaking = true;
  clearInterval(inInterval);
  counter=0;
  breakLength = Number(document.getElementById('break').value)*60;
  timeLength = Number(document.getElementById('mine').value)*60;
  running();
  
}

document.getElementById('pause').onclick = function() {paused();};
function paused() {
  going = false;
  breaking = false;
  clearInterval(inInterval);
  document.getElementById('para').innerHTML = "PAUSED";
  document.getElementById('para2').innerHTML = "";
}

function running() {
  if (going==true) {
    inInterval = setInterval(function(){ running2() }, 1000);}
  if (breaking==true) {
    inInterval = setInterval(function(){ breakTime() }, 1000);
  }
}
function running2() {
  counter++;
  console.log(counter);
  document.getElementById('para').innerHTML = 'Get to Work!';
  document.getElementById('para2').innerHTML = (timeLength-counter) + " seconds left!";
  if (counter==timeLength) {
    console.log("finished");
    audio.play();
    document.getElementById('para').innerHTML = "Time for a break!";
    clearInterval(inInterval);
    counter = 0;
    going = false;
    breaking = true;
    running();
  }
}

function breakTime() {
  counter++;
  console.log(counter);
  document.getElementById('para').innerHTML = "On Break!";
  document.getElementById('para2').innerHTML = (breakLength-counter) + " seconds left!";
  if (counter==breakLength){
    console.log('breaks over');
    audio.play();
    document.getElementById("Break's over!");
    clearInterval(inInterval);
    counter=0;
    breaking = false;
    going = true;
    running();
  }
}

document.getElementById('minusRun').onclick = function() {minusRun();};

function minusRun() {
  
if (document.getElementById('mine').value > 1) {  document.getElementById('mine').value --;}
}

document.getElementById('plusRun').onclick = function() {plusRun();};

function plusRun() {
   document.getElementById('mine').value ++;
}

document.getElementById('minusBreak').onclick = function() {minusBreak();};

function minusBreak() {
  
if (document.getElementById('break').value > 1) {  document.getElementById('break').value --;}
}

document.getElementById('plusBreak').onclick = function() {plusBreak();};

function plusBreak() {
   document.getElementById('break').value ++;
}
            
          
!
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