css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

            
              
<body class="shadowwhite ">

    <div class="inline mainbox  ">

        <div style="width: 200px; height:100px; margin: 100px">
            <h5 id="break-label" class="centertext">Break Length</h5>
            <div class="inline minibox ">
                <div class="btn enlarge" id="break-increment">+</div>
                <div class="centertext enlarge" id="break-length" >5</div>
                <div class="btn enlarge" id="break-decrement">-</div>
            </div>
        </div>
      <h5 class="btn inline" id="reset">Reset</h5>
        <div style="width: 200px; height:100px; margin: 100px">
            <h5 class="centertext "  id="session-label" >Session length</h5>
            <div class="inline minibox">
                <div class="btn enlarge" id="session-increment">+</div> 
                <div class="centertext enlarge " id="session-length">25</div>
                <div class="btn  enlarge" id="session-decrement">-</div>
            </div>
        </div>
    </div>

    <div>

        <div id="start_stop" class="btn circle centertext">

            <div  id="timer-label">Session</div>
            <div id="time-left">25:00</div>
        </div>
     
    </div>
    

<span class=" Monsieur_La_Doulaisefont" style="padding-left: 200px; font-size:70pt "> Pomodoro</span>
<audio id="beep" src="http://soundbible.com/grab.php?id=1758&type=wav"></audio>

</body>
            
          
!
            
              .circle {
    margin: -65px 44% ;
    width:  200px ;
    height: 200px;
    border-radius: 100px 100px 100px 100px;
    -moz-border-radius: 100px 100px 100px 100px;
    text-align: center;
    border:3px  solid olivedrab;
    vertical-align :middle;
    padding: 10px 10px;
  font-size: 250%;
 
}
.enlarge{
    font-size: 25pt;
  
}
.minibox{
    width: 90%;
    height: 50px;
}
.mainbox{
    width: 100%;
  height: 140px; 
}
.inline{
     display: flex;
    padding: 20px;
   margin: 10px;
   justify-content: center;
   align-items: center;
  /* border: 1px solid darkgreen;*/
}


.centertext{
   text-align: center;
}
.shadowwhite{
    color: #000000 ;
    text-shadow: 2px 2px 1px white;
}
.btn1{
    height: 40px;
background-color: transparent;}
.break{
    background-size: cover;
   margin-top: 100px;
    background-repeat: no-repeat;
    background-image: url('https://st.depositphotos.com/1152339/3601/i/950/depositphotos_36011057-stock-photo-time-concept-break-time-on.jpg');
}
.work{
background-size: cover;
   margin-top: 100px;
    background-repeat: no-repeat;
    background-image: url('http://cdn.wonderfulengineering.com/wp-content/uploads/2014/10/motivational-wallpaper-17.jpg');
}

button :visited, :focus :active{ 
    outline: 0;
}
.Monsieur_La_Doulaisefont{
    font-family: 'Monsieur La Doulaise', cursive;
}
#reset{
    font-size: 200%;
}
            
          
!
            
              $(document).ready(function () {
    var Session_length = 25;
      $('#session-length').text(Session_length);
    var Countdownlength = Session_length;
    var  rebootBoo = false;
    var stoppedBoo = true;
    circlecolor = 'green';
    var breakPhase = false;
    var Break_length = 5;
  $('#break-length').text(  Break_length );
    var circleheigth = $('#start_stop').height();
    var coundowntimeMs;
    var last_time = new Date();
    var stop_time = new Date();
    var restart_time = new Date();
    var pausetimeMS = 0;
    var coundowntime = new Date();
    $('body').addClass('work') ;
    const welcomeaudiourl = 'http://soundbible.com/grab.php?id=1758&type=wav';
    const breakudiourl ='http://soundbible.com/grab.php?id=2218&type=wav';
    
    $('body').toggleClass('back1') ;
    $('#reset').click(function () { 
        $('#beep')[0].pause();
           $('#beep')[0].currentTime = 0;
       timerstopfunc();
       rebootBoo= true;
      reboot ();
       breakPhase= false; 
       Break_length = 5;
       $('#break-length').text( Break_length);
       Session_length = 25;
        $('#session-length').text( Session_length);
             Countdownlength = Session_length;
        $('body').toggleClass('back1') ;
       coundowntime = new Date();
       $('#start_stop').css('background-image', 'none' );
      $('#timer-label').text("Session");
          $('#time-left').text("25:00"); 
       stoppedBoo =true;
       coundowntimeMs =0;
       circlecolor = 'green';
       $('#start_stop').css('border','3px  solid '+ circlecolor );
         $('body').addClass('work') ;
                    $('body').removeClass('break');
     });


  var timer;
    $('#start_stop').click(function () {
    
        iniciation();

    });
    function iniciation() {

        if (stoppedBoo === false) {
            stoppedBoo = true;
            stop_time = new Date();
            timerstopfunc();

        } else {
            stoppedBoo = false;
            restart_time = new Date();
            pausetimeMS += restart_time.getTime() - stop_time.getTime();

            if (breakPhase === false) {
                reboot (Session_length);                 
                    $('#timer-label').text("Session");  
                     Countdownlength = Session_length ;
                    // playSound(welcomeaudiourl);
                    $('#beep')[0].play();
                     $('body').addClass('work') ;
                     $('body').removeClass('break');
                                    }else{
                    reboot (Break_length);
                    $('#timer-label').text('Break');
                    Countdownlength =Break_length; 
                    playSound(breakudiourl);
                    $('body').addClass('break') ;
                    $('body').removeClass('work');
                }
               
              
            coundowntime.setMinutes(Countdownlength);
            coundowntime.setSeconds(0);
            coundowntimeMs = coundowntime.getTime();

            timerfunc();

        }
    }
    function reboot (BreakorSession){
 if (rebootBoo=== true) {
        last_time = new Date();
        stop_time = new Date();
        restart_time = new Date();
        pausetimeMS = 0;
        rebootBoo=false;
     
    } 

    }
   
    function timerstopfunc() {
        window.clearInterval(timer);

    }

    function timerfunc() {
        timer = window.setInterval(disp, 1000);
    }

    function disp() {

        var date = new Date();
        var dateMS = date.getTime();
        var lastMS = last_time.getTime();

        var diff = dateMS - lastMS;
        //nastavený čas 25 min mínus rozdiel medzi dvomi časmi plus pauza
        diff = pausetimeMS + coundowntimeMs - diff;
        var outdate = new Date(diff);
        
        var min = outdate.getMinutes();
        var sec =  outdate.getSeconds();
       
       var first =((min* 60 )+sec);
       var second=(Countdownlength * 60)
        var circlePercent = ((min* 60 +sec) / (Countdownlength * 60))*100;
        $('#start_stop').css('background-image', 'linear-gradient( transparent ' +
            circlePercent + '%,' + circlecolor + ' ' + (100 - circlePercent) + '% )');
             var timeshort =(min < 10 ? '0' : '') + min + String.fromCharCode(58) +  (sec < 10 ? '0' : '') + sec;
             $('#time-left').text(timeshort);
        if (min == 0 && sec == 0 && breakPhase === false) {
            breakPhase = true;
            Countdownlength = Break_length;
            circlecolor = 'darkorchid';
            timerstopfunc();stoppedBoo = true;rebootBoo=true;
            iniciation(); $('#start_stop').css('border','3px  solid '+ circlecolor );
        } else if (min == 0 && sec == 0 && breakPhase === true) {
            breakPhase = false;
            Countdownlength = Session_length;
            circlecolor = 'green'; rebootBoo=true;
            iniciation(); $('#start_stop').css('border', '3px  solid '+circlecolor );
            timerstopfunc();stoppedBoo = true;
            iniciation();
        }
    }




    $('#break-increment').click(function () {

        if (Break_length <60) Break_length++;
         changeBreak_length();
     });
 
     $('#break-decrement').click(function () {
         if (Break_length > 1) Break_length--;
         changeBreak_length();
     });
 
     function changeBreak_length() {
         $('#break-length').text(Break_length);
     }
     $('#session-increment').click(function () {
         if (stoppedBoo === true) {
            if (Session_length <60) Session_length++;
          
             changeSession_Length();
         }
     });
 
     $('#session-decrement').click(function () {
         if (stoppedBoo === true) {
             if (Session_length > 1) Session_length--;
             changeSession_Length();
         }
     });
 
     function changeSession_Length() {
         $('#session-length').text(Session_length);
         $('#time-left').text(Session_length+':00');
 
         last_time = new Date();
         stop_time = new Date();
         restart_time = new Date();
         pausetimeMS = 0;
         timerstopfunc();
     }
 

    function playSound(url) {
        var a = new Audio(url);
        a.play();
    }
});
            
          
!
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