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

              
                
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Pomodoro Timer</title>

    <link href="https://fonts.googleapis.com/css?family=Covered+By+Your+Grace" rel="stylesheet">

    <link rel="stylesheet" href="style.css">

</head>
<body id="body">
<div class="container text-center">
    <div class="row margin-top">
        <div class="col-md-3 col-md-offset-3 col-xs-6">
            <img class="title" src="http://icons.iconarchive.com/icons/iconicon/veggies/256/tomato-icon.png">
        </div>
        <div class="col-md-3 col-xs-6">
            <p class="title">Timer</p>
        </div>
    </div>
    <div class="row">
        <div class="col-md-5 col-md-offset-1">
            <div>
                <h1 class="clock-title">Break</h1>
            </div>
            <div class="clock break-clock"></div>
            <div>
                <button type="button" class="btn btn-lg btn-edit" id="btn-reduce-break-minute">-</button>
                <button type="button" class="btn btn-lg btn-edit margin-right" id="btn-increase-break-minute">+</button>
                <button type="button" class="btn btn-lg btn-edit" id="btn-reduce-break-second">-</button>
                <button type="button" class="btn btn-lg btn-edit" id="btn-increase-break-second">+</button>
            </div>
        </div>
        <div class="col-md-5">
            <h1 class="clock-title">Session</h1>
            <div class="clock session-clock"></div>
            <div>
                <button type="button" class="btn btn-lg btn-edit" id="btn-reduce-session-minute">-</button>
                <button type="button" class="btn btn-lg btn-edit margin-right" id="btn-increase-session-minute">+</button>
                <button type="button" class="btn btn-lg btn-edit" id="btn-reduce-session-second">-</button>
                <button type="button" class="btn btn-lg btn-edit" id="btn-increase-session-second">+</button>
            </div>
        </div>
    </div>
    <div class="row margin-top">
        <button class="btn btn-lg btn-main" id="btn-start">Start</button>
        <button class="btn btn-lg btn-main" id="btn-stop-music">Stop Music</button>
        <button class="btn btn-lg btn-main" id="btn-reset">Reset</button>

    </div>

    <p id="credit">Cute and New Beginning Music by <a href="http://www.bensound.com" target="_blank">http://www.bensound.com</a></p>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.0.1/howler.core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/flipclock/0.7.8/flipclock.min.js"></script>
<script src="script.js"></script>
</body>
</html>
              
            
!

CSS

              
                html, body {
    width: auto;
    height: auto;
    min-height: 100%;

    /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffffff+0,e5e5e5+100 */
    background: rgb(255, 255, 255); /* Old browsers */
    background: -moz-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(229, 229, 229, 1) 100%); /* FF3.6-15 */
    background: -webkit-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(229, 229, 229, 1) 100%); /* Chrome10-25,Safari5.1-6 */
    background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(229, 229, 229, 1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e5e5e5', GradientType=0); /* IE6-9 */
}

.title {
    font-size: 128px;
    font-family: 'Covered By Your Grace', cursive;
    height: 200px;
    width: 250px;
    min-height: 200px;
    line-height: 200px;
    color: #F44336;
}

.clock-title {
    font-size: 64px;
    font-family: 'Covered By Your Grace', cursive;
    color: #F44336;
}

.margin-top {
    margin-top: 20px;
}

.flip-clock-divider .flip-clock-label {
    font-size: 16px;
    font-family: 'Covered By Your Grace', cursive;
    color: #F44336;
}

.flip-clock-wrapper ul {
    background: #F44336;
}

.flip-clock-wrapper ul li a div.up:after {
    background-color: #F44336;
    background-color: rgba(0, 0, 0, 0.4);
}

.flip-clock-wrapper ul li a div div.inn {
    color: #fff;
    text-shadow: 0 1px 1px #555;
    background-color: #F44336;
}

.session-clock, .break-clock {
    display: inline-block;
    width: auto;
}

.btn-edit {
    width: 64px;
    font-size: 36px;
    color: white;
    background: #F44336;
}

.margin-right {
    margin-right: 25px;
}

.btn-main {
    width: 225px;
    font-size: 36px;
    color: white;
    background: #F44336;
    font-family: 'Covered By Your Grace', cursive;
    margin: 10px 0;
}

.btn-main:hover {
    color: white;
}

.btn-main:focus {
    color: white;
    outline: none;
}

.btn-edit:hover{
    color: white;
}

.btn-edit:focus{
    color:white;
    outline: none;
}

#credit{
    font-size: 32px;
    color: #F44336;
    font-family: 'Covered By Your Grace', cursive;
}
              
            
!

JS

              
                /**
 * Created by LEE on 2016/10/19.
 */

$(document).ready(function () {
    var startButton = $("#btn-start");
    var resetButton = $("#btn-reset");
    var stopMusicButton = $("#btn-stop-music");
    stopMusicButton.prop('disabled',true);

    //use this to resume session or break when user
    //stop then resume(start) the clock
    var sessionWasRunning = true;

    var isSessionStop = true;
    var isBreakStop = true;

    var resetSession = 1500;
    var resetBreak = 300;

    //user choice of session and break time

    var sessionTime = 1500;
    var breakTime = 300;

    var sessionOverMusic = new Howl({
        //edit this to the music you want to play
        src: ['music/bensound-cute.mp3'],
        onend: function () {
            stopMusicButton.prop('disabled',true);
        }
    });

    var breakOverMusic = new Howl({
        //edit this to the music you want to play
        src: ['music/bensound-anewbeginning.mp3'],
        onend: function () {
            stopMusicButton.disabled = true;
        }
    });

    var sessionClock = $('.session-clock').FlipClock(sessionTime, {
        clockFace: 'MinuteCounter',

        countdown: true,
        autoStart: false,

        callbacks: {
            interval: function () {
                var sessionTime = sessionClock.getTime().time;
                if (sessionTime == 0) {
                    //set time again to offset the one second difference
                    breakClock.setTime(breakTime + 1);
                    breakClock.start();
                    isBreakStop = false;

                    isSessionStop = true;
                    sessionWasRunning = false;

                    playSessionOverMusic();

                } else if (breakTime == 0 && isBreakStop) {

                    //set time for display
                    breakClock.setTime(breakTime);
                }
            }
        }
    });

    var breakClock = $('.break-clock').FlipClock(breakTime, {
        clockFace: 'MinuteCounter',

        countdown: true,
        autoStart: false,

        callbacks: {
            interval: function () {
                var breakTime = breakClock.getTime().time;

                if (breakTime == 0) {

                    //set time again to offset the one second difference
                    sessionClock.setTime(sessionTime + 1);
                    sessionClock.start();
                    isSessionStop = false;
                    sessionWasRunning = true;

                    isBreakStop = true;

                    playBreakOverMusic();

                } else if (sessionTime == 0 && isSessionStop) {

                    //set time for display
                    sessionClock.setTime(sessionTime);
                }
            }
        }
    });

    /* Edit Time Section */

    $("#btn-reduce-session-minute").click(function () {
        changeSessionTime(-60);
    });

    $("#btn-increase-session-minute").click(function () {
        changeSessionTime(60);
    });

    $("#btn-reduce-session-second").click(function () {
        changeSessionTime(-1);
    });

    $("#btn-increase-session-second").click(function () {
        changeSessionTime(1);
    });

    function changeSessionTime(time) {
        if ((sessionTime + time >= 0) && (sessionTime + time <= 6000)) {
            stopAllClocks();
            sessionTime += time;
            sessionClock.setTime(sessionTime);
        }
    }

    $("#btn-reduce-break-minute").click(function () {
        changeBreakTime(-60);
    });

    $("#btn-increase-break-minute").click(function () {
        changeBreakTime(60);
    });

    $("#btn-reduce-break-second").click(function () {
        changeBreakTime(-1);
    });

    $("#btn-increase-break-second").click(function () {
        changeBreakTime(1);
    });

    function changeBreakTime(time) {
        if ((breakTime + time >= 0) && (breakTime + time <= 6000)) {
            stopAllClocks();
            breakTime += time;
            breakClock.setTime(breakTime);
        }
    }

    /* End Edit Time Section */

    startButton.click(function () {
        if (sessionWasRunning && isSessionStop) {
            sessionClock.start();
            startButton.text("Stop");

            isSessionStop = false;
        } else if (!sessionWasRunning && isBreakStop) {
            breakClock.start();
            startButton.text("Stop");

            isBreakStop = false;
        }else if(!isSessionStop){
            sessionClock.stop();
            startButton.text("Start");

            isSessionStop = true;
            sessionWasRunning = true;
        }else if(!isBreakStop){
            breakClock.stop();
            startButton.text("Start");

            isBreakStop = true;
            sessionWasRunning = false;
        }else{

        }

    });

    resetButton.click(function () {
        //stop the countdown when reset is clicked

        stopAllClocks();

        sessionTime = resetSession;
        breakTime = resetBreak;

        sessionClock.setTime(sessionTime);
        breakClock.setTime(breakTime);
    });

    stopMusicButton.click(function () {
        sessionOverMusic.stop();
        breakOverMusic.stop();

        $(this).prop("disabled",true);
    });

    function stopAllClocks() {
        sessionClock.stop();
        isSessionStop = true;

        breakClock.stop();
        isBreakStop = true;

        startButton.text("Start");
    }

    function playSessionOverMusic() {
        stopMusicButton.prop('disabled',false);

        if (isSessionStop) {
            breakOverMusic.stop();
            sessionOverMusic.play();
        }
    }

    function playBreakOverMusic() {
        stopMusicButton.prop('disabled',false);

        if (isBreakStop) {
            sessionOverMusic.stop();
            breakOverMusic.play();
        }
    }


});


              
            
!
999px

Console