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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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>
<head>
  <title>STAR WARS CL0CK</title>

  <link href="https://fonts.googleapis.com/css?family=Bungee|Bungee+Shade|Covered+By+Your+Grace" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:800" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
  <div class="page">
    <header>
      <h1>STAR WARS CL0CK</h1>
    </header>

    <h4>
      MAY THE FORCE BE WITH YOU 
      <span id="clock">Clock goes here</span>
    </h4>

    <img id="lolcat" src="https://fortunedotcom.files.wordpress.com/2015/03/mv5bmty5mjuyoduxof5bml5banbnxkftztcwntmxmza4na-_v1__.jpg" alt="lolcat">

    <blockquote id="timeEvent">This is where time events are reported</blockquote>


    set Wake Up Time
    <select id="wakeUpTimeSelector">
      <option value="1">1 AM - 2AM</option>
      <option value="2">2 AM - 3AM</option>
      <option value="3">3 AM - 4AM</option>
      <option value="4">4 AM - 5AM</option>
      <option value="5">5 AM - 6AM</option>
      <option value="6">6 AM - 7AM</option>
      <option value="7">7 AM - 8AM</option>
      <option value="8" selected>8 AM - 9AM</option>
      <option value="9">9 AM - 10AM</option>
      <option value="10">10 AM - 11AM</option>
      <option value="11">11 AM - 12PM</option>
      <option value="12">12 PM - 1PM</option>
      <option value="13">1 PM - 2PM</option>
      <option value="14">2 PM - 3PM</option>
      <option value="15">3 PM - 4PM</option>
      <option value="16">4 PM - 5PM</option>
      <option value="17">5 PM - 6PM</option>
      <option value="18">6 PM - 7PM</option>
      <option value="19">7 PM - 8PM</option>
      <option value="20">8 PM - 9PM</option>
      <option value="21">9 PM - 10PM</option>
      <option value="22">10 PM - 11PM</option>
      <option value="23">11 PM - 12AM</option>
      <option value="24">12 AM - 1AM</option>
    </select>
    
    set Lunch Time
      <select id="lunchTimeSelector">
        <option value="1">1 AM - 2AM</option>
        <option value="2">2 AM - 3AM</option>
        <option value="3">3 AM - 4AM</option>
        <option value="4">4 AM - 5AM</option>
        <option value="5">5 AM - 6AM</option>
        <option value="6">6 AM - 7AM</option>
        <option value="7">7 AM - 8AM</option>
        <option value="8">8 AM - 9AM</option>
        <option value="9">9 AM - 10AM</option>
        <option value="10">10 AM - 11AM</option>
        <option value="11">11 AM - 12PM</option>
        <option value="12" selected>12 PM - 1PM</option>
        <option value="13">1 PM - 2PM</option>
        <option value="14">2 PM - 3PM</option>
        <option value="15">3 PM - 4PM</option>
        <option value="16">4 PM - 5PM</option>
        <option value="17">5 PM - 6PM</option>
        <option value="18">6 PM - 7PM</option>
        <option value="19">7 PM - 8PM</option>
        <option value="20">8 PM - 9PM</option>
        <option value="21">9 PM - 10PM</option>
        <option value="22">10 PM - 11PM</option>
        <option value="23">11 PM - 12AM</option>
        <option value="24">12 AM - 1AM</option>
      </select>
    
    set Nap Time
    <select id="napTimeSelector">
      <option value="1">1 AM - 2AM</option>
      <option value="2">2 AM - 3AM</option>
      <option value="3">3 AM - 4AM</option>
      <option value="4">4 AM - 5AM</option>
      <option value="5">5 AM - 6AM</option>
      <option value="6">6 AM - 7AM</option>
      <option value="7">7 AM - 8AM</option>
      <option value="8">8 AM - 9AM</option>
      <option value="9">9 AM - 10AM</option>
      <option value="10">10 AM - 11AM</option>
      <option value="11">11 AM - 12PM</option>
      <option value="12">12 PM - 1PM</option>
      <option value="13">1 PM - 2PM</option>
      <option value="14">2 PM - 3PM</option>
      <option value="15" selected>3 PM - 4PM</option>
      <option value="16">4 PM - 5PM</option>
      <option value="17">5 PM - 6PM</option>
      <option value="18">6 PM - 7PM</option>
      <option value="19">7 PM - 8PM</option>
      <option value="20">8 PM - 9PM</option>
      <option value="21">9 PM - 10PM</option>
      <option value="22">10 PM - 11PM</option>
      <option value="23">11 PM - 12AM</option>
      <option value="24">12 AM - 1AM</option>
      </select>
    
    <button id="partyTimeButton">Party Time!</button>

    <footer>
      <p>© Skillcrush 2016</p>
    </footer>
  </div>

  <script type="text/javascript" src="script.js"></script>
</body>
</html>

              
            
!

CSS

              
                body {
  background-color: black;
  background-image: url(https://steamusercontent-a.akamaihd.net/ugc/853856383489943142/E4D3BA3643506D23A8266322F28535787B368731/);
  background-repeat: repeat;
}
.page {
  width: 80%;
  max-width: 960px;
  margin: 50px auto;
  text-align: center;

  border-radius: 5px;
  color: white;
}
body {
  font: 14px/26px 'Bungee', Helvetica, Arial, 'Star Jedi', sans-serif;
  color: #222;
  margin: 0px;
  padding: 0px;
  text-transform: uppercase;
}
header{
  font-size: 24px;
  line-height: 48px;
}
h4 {
  font-size: 21px;
  font-family: 'Bungee', cursive;
}
h4 #clock {
  font-size: 36px;
  display: block;
  padding: 5px 0px;
}
h1, h2, h3, h6 {
  font-family: 'Star Jedi', sans-serif;
  font-kerning: 2%;
}

blockquote {
  font: 2em/1em 'Open Sans', sans-serif;
  -webkit-text-stroke: 1px black;
  text-shadow: 2px 2px #000;
  margin: -80px 0 100px 0;
  color: #fff;
}

blockquote:before { content: '"'; }
blockquote:after { content: '"'; }

#lolcat {
  margin: 0 auto;
  width: 50%;
  -webkit-border-radius: 100px;
  -moz-border-radius: 100px;
  border-radius: 10px;
  border:10px solid #222;
}
#wakeUpTimeSelector, #lunchTimeSelector, #napTimeSelector {
  padding: 10px 0;
}
#partyTimeButton {
  background-color: #222;
  width: 300px;
  font-family: 'Bungee', cursive;
  font-size: 18px;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 10px 0;
  margin-top: 20px;
}

footer p {
  text-transform: uppercase;
  font-size: 12px;
}

              
            
!

JS

              
                var noon = 12;
var evening = 18; // 6PM
var wakeupTime = 9; // 9AM
var lunchTime = 12; // 12PM
var partyTime = 17; // 5PM
var napTime = lunchTime + 2; // 2PM
var time = new Date().getHours();
var isPartyTime = false;
var partyTimeButton = document.getElementById("partyTimeButton");
var wakeUpTimeSelector = document.getElementById("wakeUpTimeSelector");
var napTimeSelector = document.getElementById("napTimeSelector");
var lunchTimeSelector = document.getElementById("lunchTimeSelector");

var updateClock = function() {
  var lolcat = document.getElementById("lolcat");
  var message = document.getElementById("timeEvent");
  var messageText;
  var image =
    "https://fortunedotcom.files.wordpress.com/2015/03/mv5bmty5mjuyoduxof5bml5banbnxkftztcwntmxmza4na-_v1__.jpg";

  if (time == partyTime) {
    image =
      "https://media.giphy.com/media/XQ1FwjRKun4nS/giphy.gif";
    messageText = "PARTY TIME!";
  } else if (time == napTime) {
    image =
      "https://vignette.wikia.nocookie.net/disney/images/7/73/Princess_Leia_3.jpg/revision/latest?cb=20140913192715";
    messageText = "NAP TIME!";
  } else if (time == lunchTime) {
    image =
      "https://res.cloudinary.com/jerrick/image/upload/f_auto,fl_progressive,q_auto,c_fit,w_1140/e4anmwvnpxj9v32lcczw";
    messageText = "LUNCH TIME!";
  } else if (time == wakeupTime) {
    image =
      "https://i.stack.imgur.com/4nNLr.jpg";
    messageText = "TIME TO GET UP!";
  } else if (time < noon) {
    messageText = "Good morning!";
  } else if (time > evening) {
    messageText = "Good Evening!";
  } else {
    messageText = "Good afternoon!";
  }

  message.innerText = messageText;
  lolcat.src = image;

  showCurrentTime();
};

var showCurrentTime = function() {
  // display the string on the webpage
  var clock = document.getElementById("clock");

  var currentTime = new Date();
  var hours = currentTime.getHours();
  var minutes = currentTime.getMinutes();
  var seconds = currentTime.getSeconds();
  var meridian = "AM";

  // Set Hours
  if (hours >= noon) {
    meridian = "PM";
  }

  if (hours > noon) {
    hours = hours - 12;
  }

  // Set Minutes
  if (minutes < 10) {
    minutes = "0" + minutes;
  }

  // Set Seconds
  if (seconds < 10) {
    seconds = "0" + seconds;
  }

  // put together the string that displays the time
  var clockTime = hours + ":" + minutes + ":" + seconds + " " + meridian + "!";

  clock.innerText = clockTime;
};

updateClock();

var oneSecond = 1000;

setInterval(updateClock, oneSecond);

var partyEvent = function() {
   
   if (isPartyTime === false) {
      isPartyTime = true;
      time = partyTime;
      partyTimeButton.innerText = "PARTY TIME!";
      partyTimeButton.style.backgroundColor = "#222";
   }
   else {
      isPartyTime = false;
      time = new Date().getHours();
      partyTimeButton.innerText = "PARTY TIME OVER";
      partyTimeButton.style.backgroundColor = "#0A8DAB";
   }
};

partyTimeButton.addEventListener('click', partyEvent);

var lunchEvent = function() {
    lunchTime = lunchTimeSelector.value;
};
 
var wakeUpEvent = function() {
    wakeupTime = wakeUpTimeSelector.value;
};
 
var napEvent = function() {
    napTime = napTimeSelector.value;
};

napTimeSelector.addEventListener('change', napEvent);
lunchTimeSelector.addEventListener('change', lunchEvent);
wakeUpTimeSelector.addEventListener('change', wakeUpEvent);

              
            
!
999px

Console