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.

+ 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.

            
              <!-- /*https://dl.dropboxusercontent.com/u/13022985/tomato.jpg */ -->

<body>
  <link href='https://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>

  <div class="wrapper">
    <div id="Pomodoro">
      <h1>Pomodoro</h1>

      <div id="color">
        <br>
        <div class="test">
        </div>
        <!-- modal !-->

        <!-- Modal Structure -->
        <div id="modal1" class="modal">
          <div class="modal-content">
            <h5>Input Times</h5>
            <hr>
            <div class="input-field">
              <input id="session" type="text" class="time validate" data-id="1">
              <label for="Minutes">Minutes per Pomodoro</label>
            </div>
            <div class="input-field">
              <input id="break" type="text" class="time validate" data-id="1">
              <label for="break">Minutes per Break</label>
            </div>
            <div class="modal-task ">
              <a class="btn-floating btn-large waves-effect waves-light red"><i class="material-icons" id="addTask">add</i></a>
              <a class="btn-floating btn-large waves-effect waves-light red"><i class="material-icons" id="remove">info_outline</i></a>


            </div>
          </div>
          <div class="modal-footer">
            <a href="#!" id="modal-close" class=" modal-action waves-effect waves-light btn"><i class="material-icons right">cloud</i>Enter</a>
          </div>
        </div>


        <!--       <input type="text" id="check"/> -->

        <div class="content">
          <!--      <img src="http://free-icon-download.com/modules/PDdownloads/images/screenshots/free-icon-download-tomato-clipart.png" data-option="start"/>
      <img src="http://free-icon-download.com/modules/PDdownloads/images/screenshots/free-icon-download-tomato-clipart.png" data-option="stop" />
      <img src="http://free-icon-download.com/modules/PDdownloads/images/screenshots/free-icon-download-tomato-clipart.png" data-option="reset"/>
      <img src="http://free-icon-download.com/modules/PDdownloads/images/screenshots/free-icon-download-tomato-clipart.png" data-option="increment"/> -->
          <i class="small material-icons right" id="sound">volume_off</i>
          <br>
          <h4>Studying In Progress</h4>
          <div id="circle">
            <p id="session-time">25:00</p>
            <span id="controls">Click to Start</span>
          </div>

          <div class="plus" />
          <a class="btn-floating btn-large waves-effect waves-light red"><i id="add" class="material-icons">add</i></a>
        </div>
        <div class="timer">
          <a class="waves-effect waves-red btn-large" id="start"><i class="material-icons left">cloud</i>Start</a>
          <a class="waves-effect waves-light btn-large" id="snooze"><i class="material-icons left">snooze</i>Pause</a>
        </div>
      </div>
    </div>
  </div>

  </div>
</body>
            
          
!
            
              .wrapper{
  display:flex;
  align-items: center;
  justify-content: center;
}
.timer{
  display:flex;
 justify-content:space-around;
  width:100%;
}
.modal{
  width:20%;
}
.modal-buttons{
  display:flex;
  justify-content:space-around;
}
.modal-content h4{
  color:#F26E2B;
  border-bottom: 1px solid gray;
  padding-bottom:10px;
}
.error{
 border-bottom: 2px solid red !important;
}

/* i:hover { 
    background-color: yellow;
} */

/** #90939A **/
h1{
  font:  50px/1.5 'Pacifico', Helvetica, sans-serif;
  color:#fff;
  text-align:center;
  justify-content: center;
  padding-bottom:40px;
}
h4{
  text-align:center;
  justify-content: center;
  font-family: 'Pangolin', cursive;
  color:#fff;
 
}
.break-buttons{
  height:100px;
  width:100px;
  background-color:red;
  margin:5px 5px 5px;
}
body{
  background: url("https://images.pexels.com/photos/34088/pexels-photo.jpg?w=1260&h=750&auto=compress&cs=tinysrgb") no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  
}
#Pomodoro{
  max-height: 100%;
max-width: 100%;
  padding-top:30px;   
  margin-bottom:50%;
  height:600px;
  width:400px;
  background-image:linear-gradient(45deg,#d62b31 0%, #f75851 100%);;
  box-shadow: 10px 10px 10px 5px #888888;
}


.break #Pomodoro {
  background-image: none;
  background-color: #143256;
}
.break #color{
  background-color:#fff;
}
.break .btn-large{
  background-color:#3950F3;
}
.break h4{
  color:black;
}
.background-img{
  background: url("https://images.pexels.com/photos/175837/pexels-photo-175837.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb") no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}
div img{ 
max-height: 20%;
max-width: 20%;
margin-left:10px; 
padding-top:20px;
}
#color{
  background:#ba7e7c;
  opacity:4.0;
  height:auto;
  width:400px;
}
input[type=text]{
      border-bottom: 2px solid #F26E2B;
}
.canvas{
  -webkit-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.76);
-moz-box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.76);
box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.76);
}
p{
  text-align:center;
}
#circle{
  position: flex;
  text-align:center;
  justify-content: center;
  padding-top:100px;
  
 }
#icon{
     display: flex;
    justify-content: flex-end;
}
#session-time{
  position: relative;
  top: -200px;
  left: 2px;
  width: 100%;
  font-family: 'Orbitron', sans-serif;
  font-weight:bold;
  font-size:24px;
}
#circle span{
   position: relative;
  top: -200px;
  left: 2px;
  width: 100%;
}
.btn, .btn-large{
   background-color:#e94443;
   margin-bottom:10%;
}
.plus{
  display:flex;
  justify-content: center;
  
}
.addTask{
  margin-top:10px;
 background-image: linear-gradient(45deg,#d62b31 0%, #f75851 100%);
  
  border-top: 2px solid #f86f69;
  border-bottom: 2px solid #f86f69;
  color:#fff;
  display: flex;
  justify-content: space-between;
  font-size:20px;
  padding:10px;
}
.checkbox{
/*    display: flex;
  justify-content: flex-end; */
}
#test5{
  background-color:red;
   display: flex;
  justify-content: flex-end;
}
p{
  
  margin-bottom: 3px;
}
.addTask p{
    
    margin-top: 5px;
}

[type="checkbox"]+label:before{
     top: 5px;
}
/**** Background setttings **/
.newBackground{
  background: url("https://images.pexels.com/photos/175837/pexels-photo-175837.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb") no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
   
    $('#Pomodoro').css({"background-image":"none"});
     $('#Pomodoro').css({"background-color":"#143256"});
     $('.btn-large').css({'background-color':'#3950F3'});
  
}
h5{
  display:flex;
  justify-content:flex-start;
  font-family:shared;
  color:#42c2b6;
  font-weight:bold;
  font-size:30px;
}
hr{
  margin-bottom:55px;
  
}
            
          
!
            
              $('select').material_select();

var PomodoroTimer = (function() {
  var minutes = null;
  var seconds = 60;
  var clearTimer = null;
  var countDownStart = false;
  var pressedTime = 0;
  var timeState = false;
  var timeRunning = false;
  var clickCounter = 0;
  var rateOfIncrease = 0;
  var clockSet = false;
  var circleVal = 0;
  var breakStatus = false;
  var soundStatus = false;
  var counter = $('.test').find('div').length;
  var setState = function() {
    countDownStart = true;
  };
  var stopTime = function() {
    $('#controls').text('Click to Resume');
    countDownStart = true;
    clearInterval(clearTimer);
    pressedTime = 0;
    timeState = false;
    console.log('stop time called');
  };

  var createTask = function() {

    $('input[type="text"]').each(function() {
      clickCounter++;
      if ($(this).is('#task')) {
        $('.test').append('<div class="addTask"><p>' + $(this).val() + '</p><input type="checkbox" id="checkbox' + clickCounter + '"/><label for="checkbox' + clickCounter + '"></label></div>').fadeIn(40000);
      }
      if ($(this).is('#task')) {
        $(this).remove();
         clickCounter = 0;
      }
    });
    
  }

  var addTask = function(val) {
    console.log('this is the click Counter activated when adding a task ' + clickCounter);
    if (clickCounter <= 4) {
      clickCounter++;
      $('.modal-task').before('<div class="input-field"><input placeholder="Enter Task"  data-counter="' + clickCounter + '" type="text" class="validate length" length="20" id="task"></div>');
      // Materialize.updateTextFields();
      $('.length').characterCounter();
    }
  }

  var incrementTimer = function() {
    stopTime();
    countDownStart = true;
    var timer = $('#session-time').text();
    var minuteTimer = parseInt(timer.split(':')[0]);
    var counter = minuteTimer;
    counter++;

  }
  var setClock = function() {
    console.log('set Clock has been fired');
    minutes = $('#session').val();
    rateOfIncrease = 100 / (minutes * 60 * 100);
    seconds = 00;
    clockSet = true;
    circleVal = .01;
    
  }
  var removeTask = function() {

    var dur = 5000;
     
    $('.test').find('div').first().fadeOut(dur, function() {
      $(this).attr('checked', true);
      $(this).remove();
    });
    clickCounter--;
    console.log('the value of click counter '+ clickCounter)
  };
  var startTime = function() {
    console.log('start Time');
    console.log('breaktime' + breakStatus);
    if (breakStatus == false) {
      $('h4').text('Studying in Progress');
    }
    if (clockSet === false) {
      setClock();
    }

    $('#controls').text('Click to Pause');
    timeState = true;

    if (pressedTime == 0) {
      // var timer = $('#session-time').text();
      if (seconds == 0 && minutes != 0) {
        console.log('in the conditional statement of start time before the timer starts');
        minutes--;
        seconds = 59;
      }
      pressedTime++;

      var stopTimer = setInterval(function() {

        timeState = true;
        //to reset the timer
        if (!(isNaN(seconds))) {
          seconds--;
          console.log(seconds);
        } else {
          seconds = 59;
        if(minutes > 0){
           console.log('substracted '+minutes);
           minutes--;
        }
         
                
          
         
         
         
        }
        if (minutes === 0 && seconds === 00) {
          // resetTimer();
          // circleVal = .01;
           console.log('In contiondal statement that requires minutes at 0 and seconds are 00');
           circleVal = .00;
           stopTime();
           breakTime();
        }
        circleVal += rateOfIncrease;
        $('#circle').circleProgress('value', circleVal);
        if (seconds < 10) {
          seconds = '0' + seconds;
        }

        $('#session-time').html('<p>' + minutes + ':' + seconds + '</p>');
      }, 1000);

      // clearInterval(stopTimer);
      clearTimer = stopTimer;
      pressedTime++;
    }

    return pressedTime;
  };
  var deleteTask = function(){
    clickCounter--;
  if($('input').last().attr('data-id') != '1') {
    $('input').last().remove();
  };
  }
  var setBreakDisplay = function(){
    console.log(breakStatus);
   if(breakStatus){
    $('body').addClass('break');
    $('body').addClass('background-img');
    $('h4').text('Break in Progress');
   }else{
    $('body').removeClass('break');
     $('body').removeClass('background-img');
     $('h4').text('Studying in Progress');
   }
   

  }
  var breakTime = function() {
    console.log('soundStatus '+soundStatus);
    if(soundStatus){
    $.playSound("http://54.152.253.14/sounds/341578__kimp10__success");
    }
      var counter = $('.test').find('div').length;
     console.log('this is the counter '+ counter);
    console.log('Break' + clickCounter);
    
    if (breakStatus === false) {
      breakStatus = true;
       removeTask();
    } else if (breakStatus == true) {
      breakStatus = false;
    }
    console.log('should set the break in progress');
    minutes = $('#break').val();
    seconds = 00;
    $('#session-time').html('<p>' + minutes + ':' + seconds + '</p>');
    var timer = $('#session-time').text();
    console.log('this is minutes' + minutes + ' ' + 'this is seconds' + seconds);
    rateOfIncrease = 100 / (minutes * 60 * 100);
    if(counter != 0){
       startTime();
       counter--;
       console.log('counter is at  '+ counter);
    }
    
    // startTime();
    setBreakDisplay();
  }
  var getStatus = function() {
    return timeState;
  }
  var resetForm = function(){
    console.log('reset form');
    $('input[type="text"]').each(function(){
       $(this).val('');
      $('input').last().remove();
       if ($(this).is('#task')) {
        $(this).remove();
       }
    });
      
      $('#break').val(5);
     Materialize.updateTextFields();
    
  }
  var getBreakStatus = function(){
    return breakStatus;
  }
  var setSound = function(){
    soundStatus = !soundStatus;
    if(soundStatus){
      $('#sound').text('volume_up');
      console.log(soundStatus);
      console.log('text set to volume_up');
    } else{
      $('#sound').text('volume_off');
    }
    console.log('setsound has been set'+ soundStatus);
  }
  var getTime = function() {

    return {
      minutes: minutes,
      seconds: seconds
    };

  }

  return {
    first: function(time) {
      minutes = time.minutes;
      seconds = time.seconds;
    },
    startTime: startTime,
    stopTime: stopTime,
    getTime: getTime,
    incrementTimer: incrementTimer,
    createTask: createTask,
    addTask: addTask,
    getStatus: getStatus,
    setClock: setClock,
    resetForm:resetForm,
    deleteTask:deleteTask,
    setSound:setSound,
    breakTime:breakTime,
    getBreakStatus:getBreakStatus
    
  };
})();

$('#circle').circleProgress({
  value: .00,
  size: 270,
  fill: {
    gradient: ["#ED4B48", "#ED4B48"]
  }
});

$('#userInput').keyup(function(e) {

  console.log($('#userInput').val());
  $('#task').html($('#userInput').val());
  if (e.which == 13) {
    $('#userInput').fadeOut('slow');
  }
})
$('#add').click(function() {
  $('#modal1').openModal();
});
$('#addTask').click(function() {
  var pomObj = PomodoroTimer;
  pomObj.addTask(1);
});
$('#remove').click(function() {
  var pomObj = PomodoroTimer;
  pomObj.deleteTask();
});
$('.time').on('keydown keyup change', function(e) {
  var regExp = /[a-z]/i;
  var value = String.fromCharCode(e.which) || e.key;

  // No letters
  if (regExp.test(value)) {
    e.preventDefault();
    return false;
  }
});

$('#modal-close').click(function() {
   var pomObj = PomodoroTimer;
  // $('#modal1').closeModal();
  var validated = null;
  $('input[type="text"]').each(function() {
    if ($(this).val() === '') {
      $(this).addClass('error');
    } else {
      $(this).removeClass('error');
    }
  });
  $('input[type="text"]').each(function() {
    if ($(this).hasClass('error') || $(this).hasClass('invalid')) {
      validated = true;
    } else {
      validated = false;
    }
    if($('.test').find('div').length === 0 && $('h4').text()  === 'Break in Progress'){
      pomObj.breakTime();
    }
  });
  if (validated == false) {
   
    pomObj.createTask();
    pomObj.setClock();
    $('#modal1').closeModal();
  }
});
$('#circle').click(function() {
  var pomObj = PomodoroTimer;
  var timerRunning = pomObj.getStatus();

  if (timerRunning != true && $('#break').val().length == 0) {

    $('#modal1').openModal();
  } else {
    
    pomObj.stopTime();
  }
 
})
$('#snooze').click(function(){
   var pomObj = PomodoroTimer;
 var timerRunning = pomObj.getStatus();
  if(timerRunning){
     $('#snooze').text('unpause');
    pomObj.stopTime();
  } else if($('#break').val().length != 0 && timerRunning === false){
    $('#snooze').text('Pause');
    pomObj.startTime();
  }
  
});
$('#sound').click(function(){
 var pomObj = PomodoroTimer;
   pomObj.setSound();
   
});
$('#start').click(function(){
  var pomObj = PomodoroTimer;
  var timerRunning = pomObj.getStatus();

  if (timerRunning != true && $('#break').val().length == 0) {

    $('#modal1').openModal();
  } else {
    
    pomObj.startTime();
  }

});
            
          
!
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.
Loading ..................

Console