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

              
                <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Session Length  
<br>
<form id="form">
<input type="number" id="numbox" max=100>
  
  
  <button>Submit</button>
</form>

<br>
Break Length
<br>
<input type="number" id="numbox2">


<div id="worked"></div>
<br>
<div id="worked2"></div>
<br>
<div id="worked3"></div>
<br>
<div id="worked4"></div>
<br>
<div id="load-bar-frame">
  
  <div id="load-bar">
    <div id="inside"></div>
    <div id="inside2"></div>
    
  </div>
</div>

              
            
!

CSS

              
                #load-bar-frame {
  height: 200px;
  width: 200px;
  border-radius: 100%;
  padding: 3px;
  border: 1px solid #000;
  margin: 20px auto 0 auto;
   
  display: block;
  position: absolute;
  top 20px;
  left: 60px;
}

#inside
    {
      line-height: 100px;
       margin-left: 110px;
      font-size: 150%;
    }

#inside2
    {
      line-height: 100px;
       margin-left: 110px;
      font-size: 150%;
    }


#load-bar {
  width: 100%; 
  height: 100%;
  border-radius: 100%;
   
}

              
            
!

JS

              
                $(document).ready(function (e) {
  var form = document.getElementById('form');
  $("#form").submit(function(e) {
    e.preventDefault();
     
  })
   
    var inCircle=document.getElementById('inside');
  var inCircle2=document.getElementById('inside2');
  
  var jj=0;
  
   
var q;
  
  var number=0;
  var number2=0;
  
    
  form.onsubmit = function() {
    
    
    number=document.getElementById('numbox');
    
    number2=document.getElementById('numbox2');
    
   //Number for "session"
    var variable=number.value;
    //Number for "break"
    var variable2 = number.value;
    
    
    
   var breakBool=false;
var goBack=false;
    var x=true;
  inCircle2.innerHTML=variable+":00";
    
     $worked = $("#worked");
    $circle = $("#inside2");
    $circle2 = $("#inside3");
    $worked2 = $("#worked2");
      $worked3 = $("#worked3");
      $worked4 = $("#worked4");


var per=0;
    
    var why=true;
    
    //function to use in conjunction
    //with "setTimeout
    function update() {
       
      
      
      
        var myTime = $circle.html();
        var ss = myTime.split(":");
      
      


        var dt = new Date();
        dt.setHours(0);
        dt.setMinutes(ss[0]);
        dt.setSeconds(ss[1]);
      
        var dt2 = new Date(dt.valueOf() - 1000);
        var temp = dt2.toTimeString().split(" ");
        var ts = temp[0].split(":");

        inCircle2.innerHTML=ts[1]+":"+ts[2];
        

  if (inCircle2.innerHTML=="00:00")
    
    per=0;
       
  var x=0;
  
//Increment until graph reaches 100%
  if (per<=100){
    if (breakBool==false)
      
      //Increment graph  "session" variable
 var w=(1/variable/60)*100;
    else
      //Increment graph using "break"  variable
      var w=(1/variable2/60)*100;
    
   per+=w;
   

  

 $('#load-bar').css({background: "linear-gradient(to right, #800000 "+per+"%,transparent "+per+"%, transparent 100%)"});
  }
  
  

var flag=false;
      
      
      //Function to  cycle between "session" and "break"
      function cycle(){
        
        if (breakBool==false)
          inCircle.innerHTML="<span style='color:#FF0000'> Session </span>"
        else
          inCircle.innerHTML="<span style='color:#FF0000'> Break </span>"
        
        //Switch to  "break"  when   "session" gets to 00:00 or 59:59
  if ((inCircle2.innerHTML=="00:00"  && breakBool==true && goBack==false)|| inCircle2.innerHTML=="59:59"  ){
inCircle2.innerHTML=variable+":00";
    per=0;
    breakBool=false;
    goBack=true;
    
    
}
      
    else if ((inCircle2.innerHTML=="00:00" &&  breakBool==false && goBack==true)|| inCircle2.innerHTML=="59:59"  ) {
        inCircle2.innerHTML=variable2+":00";
      per=0;
      breakBool=false;
    goBack=true;
  
      
    }
      
        
     }
        
       if (ts[2]=="00" && ts[1]=="00"&& breakBool==false ){
          
          
      inCircle2.innerHTML=variable2+":00";
          var myTime2 = $circle.html();
          
        var ss2 = myTime2.split(":");
        var dt3 = new Date();
        dt3.setHours(0);
        dt3.setMinutes(ss2[0]);
        dt3.setSeconds(ss2[1]);
      
        var dt4 = new Date(dt3.valueOf() - 1000);
        var temp2 = dt4.toTimeString().split(" ");
        var ts2 = temp2[0].split(":");
          
          
breakBool=true;    
 


          }
   cycle(); 
   
    
      
       
       
          var time=window.setTimeout(update,100);


      time;
      
    }
    
    setTimeout(update,1000);
      
}});



              
            
!
999px

Console