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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <section id="main-content">
  <header>
    <h1>
      Build/Deploy #<span id="buildNum"></span>
    </h1>
    <div id="success-indicator"></div>
  </header>
  
  <div id="scrolling-output">
    <ul id="output-lines"></ul>
    <button class="rerun" onclick="runBuild();">
      <i class="fa fa-play-circle" aria-hidden="true"></i>
    </button>
  </div>
</section>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Source+Code+Pro');


body {
  background: #77d7d7;
}

section#main-content {
  width: 550px;
  margin: 0 auto;
}

h1 {
  width: 90%;
  font-family: "Helvetica Neue";
  font-weight: 100;
  font-size: 48pt;
  display: inline;
  overflow: hidden;
}

#scrolling-output {
  position: relative;
  background: #333;
  width: 100%;
  margin: 0 auto;
  height: 60vh;
  border-radius: 10px;
  line-height: 1.3;
  overflow: scroll;
  box-sizing: border-box;
  padding: 20px;
  color: #ddd;
  font-family: "Source Code Pro", monospace;
}

#output-lines {
  list-style: none;
}

#output-lines>li {
  white-space: pre;
}

.message:before {
  content: '[Message] ';
}

.output:before {
  content: '[Output]  ';
}

.error:before {
  content: '[Error]   ';
  color: #ff9977;
}

.message {
  font-weight: bold;
}

.message.failure {
  color: #ff9977;
}

.error {
  color: #ff9977;
}

#success-indicator.failure {
  background: #f40;
}

#success-indicator.success {
  background: #44f388;
}

#success-indicator.running {
  background: #fc0;
}

#success-indicator {
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  float: right;
  box-sizing: border-box;
  margin-top: 15px;
  margin-right: 5px;
  box-shadow: 0 0 15px 4px rgba(115, 115, 115, 0.5) inset,
    0 0 5px 5px #6bcbcb;
}

header {
  display: block;
  margin-top: 40px;
  margin-bottom: 40px;
}

button.rerun {
  cursor: pointer;
  transition: all 0.3s ease;
  position: absolute;
  right: 30px;
  bottom: 30px;
  border: none;
  background: transparent;
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  border-radius: 50%;
  font-size: 24pt;
  color: #bbb;
  display: flex;
}

button.rerun:hover {
  transition: all 0.3s ease;
  color: #ccc;
  transform: scale(1.2);
  transform-origin: 20px 20px;
}

button.rerun:active {
  color: #444;
}

button.rerun:focus {
  outline: none;
}


@media(max-width:600px) {
  section#main-content {
    width: 80vw;
    margin: 0 auto;
  }
  
  #output-lines>li {
    font-size: 8pt;
  }
  
  h1 {
    font-size: 28pt;
  }
  
  #success-indicator {
    width: 20px;
    height: 20px;
    margin-top: 10px;
  }
}
            
          
!
            
              var buildNo = 35;

function incrementBuild() {
  buildNo++;
  $("#buildNum").text(buildNo);
}

function clearOutput() {
  $("#output-lines > li").remove();
}

function setIndicator(state) {
  $("#success-indicator")
    .removeClass("success")
    .removeClass("failure")
    .removeClass("running")
    .addClass(state)
}

function addRecursively(messages, timeout, callback) {
  if (messages.length == 0) {
    var x = callback();
    return;
  }
  var msg = messages[0];
  var rest = messages.slice(1);
  $("#output-lines").append(createLine(msg));
  var thisTimeout = timeout * Math.random() * 2;
  setTimeout(() => addRecursively(rest, timeout, callback), thisTimeout)
}

function createLine(msg) {
  return `<li class="${msg.type}">${msg.text}</li>`;
}

function writeOutput(callback) {
  var messages = [
    {"type": "message", text: "Starting Build"},
    {"type": "output", text: "Hello, world!"},
    {"type": "error", text: "A minor snag..."},
    {"type": "output", text: "Carrying on regardless!"},
    {"type": "error", text: "This one's a bit worse :("},
    {"type": "output", text: "But we can make it! 💪🏻"},
    {"type": "message", text: "Finished with status code: 0"},
  ];
  setTimeout(() => addRecursively(messages, 600, callback), 200);
}

function runBuild() {
  incrementBuild();
  clearOutput();
  setIndicator("running");
  writeOutput(() => {
    setIndicator("success");
  });
}

$(document).ready(() => {
  runBuild();
})
            
          
!
999px
Loading ..................

Console