Some terminal thing

by Sam Fereday

HTML

<div class="fakeMenu">
  <div class="fakeButtons fakeClose"></div>
  <div class="fakeButtons fakeMinimize"></div>
  <div class="fakeButtons fakeZoom"></div>
</div>
<div class="fakeScreen">
  <div class="output"></div>
  <p class="line4">><span contenteditable="true" class="cursor4 textentry single-line">_</span></p>
</div>

CSS

body {
  background-color: #272727;
  padding: 10px;
}

.fakeButtons {
  height: 10px;
  width: 10px;
  border-radius: 50%;
  border: 1px solid #000;
  position: relative;
  top: 6px;
  left: 6px;
  background-color: #ff3b47;
  border-color: #9d252b;
  display: inline-block;
}

.fakeMinimize {
  left: 11px;
  background-color: #ffc100;
  border-color: #9d802c;
}

.fakeZoom {
  left: 16px;
  background-color: #00d742;
  border-color: #049931;
}

.fakeMenu {
  width: 550px;
  box-sizing: border-box;
  height: 25px;
  background-color: #bbb;
  margin: 0 auto;
  border-top-right-radius: 5px;
  border-top-left-radius: 5px;
}

br {
  display: none;
}

.fakeScreen {
  background-color: #151515;
  box-sizing: border-box;
  width: 550px;
  height: 20em;
  margin: 0 auto;
  padding: 20px;
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
  overflow-x: hidden;
  overflow-y: auto;
}

p {
  position: relative;
  left: 50%;
  margin-left: -8.5em;
  text-align: left;
  font-size: 1.25em;
  font-family: monospace;
  white-space: normal;
  overflow: hidden;
  width: 0;
}

span {
  color: #fff;
  font-weight: bold;
}

.line1 {
  color: #9CD9F0;
  -webkit-animation: type .5s 1s steps(20, end) forwards;
  -moz-animation: type .5s 1s steps(20, end) forwards;
  -o-animation: type .5s 1s steps(20, end) forwards;
  animation: type .5s 1s steps(20, end) forwards;
}

.cursor1 {
  -webkit-animation: blink 1s 2s 2 forwards;
  -moz-animation: blink 1s 2s 2 forwards;
  -o-animation: blink 1s 2s 2 forwards;
  animation: blink 1s 2s 2 forwards;
}

.line2 {
  color: #CDEE69;
  -webkit-animation: type .5s 4.25s steps(20, end) forwards;
  -moz-animation: type .5s 4.25s steps(20, end) forwards;
  -o-animation: type .5s 4.25s steps(20, end) forwards;
  animation: type .5s 4.25s steps(20, end) forwards;
}

.cursor2 {
  -webkit-animation: blink 1s 5.25s 2 forwards;
  -moz-animation: blink 1s 5.25s 2 forwards;
  -o-animation: blink 1s 5.25s 2 forwards;
  animation: blink 1s 5.25s 2...

JavaScript

/// Commands received as strings only
function commander(str) {
    
    if(str === "/?" || str === "help") {
    		let d = document.createElement('p');
        d.innerText = "( ͡° ͜ʖ ͡°)";
        d.classList.add("line4");
        list.appendChild(d);
        return true;
    }
    	
    return false;

}

let container = document.querySelector('.fakeScreen');
let list = document.querySelector('.output');
let entry = document.querySelector('.textentry');

entry.addEventListener('keypress', function(e){

    this.classList.add('active');

    if(e.keyCode === 13) {

        if(this.innerText.length === 0 || this.innerHTML.length === 0)
            return;

        let result = commander(this.innerText);

        container.scrollTop = container.scrollHeight;

				if(!result) {
        	let d = document.createElement('p');
          d.innerText = this.innerText + " - Not a recognized command.";
          d.classList.add("line4");
          list.appendChild(d);
        }

        this.innerHTML = "";

        return;

    }

});

entry.addEventListener('focus', function(e){
    
    this.innerHTML = "";

});