From adae1b71a7ffc2a3669eed4a04e692f4f8ccc440 Mon Sep 17 00:00:00 2001 From: Joshua Seigler Date: Sat, 20 Dec 2014 14:35:45 -0500 Subject: [PATCH] added fake replies of "command not found" --- build/application.js | 21 +++++++++++++++++++++ build/assets/images/scanline.svg | 26 ++++++++++---------------- build/compiled-styles.css | 28 ++++++++++++++-------------- build/index.php | 3 ++- src/assets/css/style.less | 16 ++++++++-------- src/assets/images/scanline.svg | 26 ++++++++++---------------- src/index.php | 3 ++- src/scripts/index.js | 23 +++++++++++++++++++++++ 8 files changed, 90 insertions(+), 56 deletions(-) diff --git a/build/application.js b/build/application.js index c176c00..b7e2cf9 100644 --- a/build/application.js +++ b/build/application.js @@ -1,4 +1,16 @@ (function() { + function escapeHTML(html) { + var fn = function(tag) { + var charsToReplace = { + "&": "&", + "<": "<", + ">": ">", + '"': """ + }; + return charsToReplace[tag] || tag; + }; + return html.replace(/[&<>"]/g, fn); + } function syncTyping() { var beforeSelection, selection, afterSelection; beforeSelection = this.value.slice(0, this.selectionStart); @@ -12,4 +24,13 @@ commandline.onkeydown = syncTyping; commandline.onkeyup = syncTyping; commandline.onselect = syncTyping; + function handleForm() { + var scrollback = document.getElementById("scrollback"); + var val = this.command.value; + this.command.value = ""; + document.getElementById("typing").innerHTML = ""; + scrollback.innerHTML = scrollback.innerHTML + "a>" + escapeHTML(val) + "
Command not found.
"; + return false; + } + document.forms[0].onsubmit = handleForm; })(); \ No newline at end of file diff --git a/build/assets/images/scanline.svg b/build/assets/images/scanline.svg index ad9c5ee..2c76745 100644 --- a/build/assets/images/scanline.svg +++ b/build/assets/images/scanline.svg @@ -1,17 +1,11 @@ - - - - - - -image/svg+xml - - - - - - - - - + + diff --git a/build/compiled-styles.css b/build/compiled-styles.css index bf1b3da..b47c0d5 100644 --- a/build/compiled-styles.css +++ b/build/compiled-styles.css @@ -19,24 +19,24 @@ label:after { right: 0; } label { - top: 0; bottom: 0; + min-height: 100%; padding: 1em; font-family: computerfontregular, monospace; color: #009900; - font-size: 4vw; + font-size: 4vmax; overflow: hidden; word-break: break-all; } label:before { content: ""; z-index: -1; - top: -8vw; - bottom: -8vw; + top: -8vmax; + bottom: -8vmax; -webkit-animation: scroll 10s linear infinite; animation: scroll 10s linear infinite; - background: url('/assets/images/scanline.svg'); - background-size: 115vw 15vw; + background: url('/assets/images/scanline.svg') #000000; + background-size: 115vmax 15vmax; background-repeat: repeat-y; background-position: 50% 0%; } @@ -97,22 +97,22 @@ label:before { } @-webkit-keyframes scroll { 0% { - -webkit-transform: translate3d(0, -7.5vw, 0); - transform: translate3d(0, -7.5vw, 0); + -webkit-transform: translate3d(0, -7.5vmax, 0); + transform: translate3d(0, -7.5vmax, 0); } 100% { - -webkit-transform: translate3d(0, 7.5vw, 0); - transform: translate3d(0, 7.5vw, 0); + -webkit-transform: translate3d(0, 7.5vmax, 0); + transform: translate3d(0, 7.5vmax, 0); } } @keyframes scroll { 0% { - -webkit-transform: translate3d(0, -7.5vw, 0); - transform: translate3d(0, -7.5vw, 0); + -webkit-transform: translate3d(0, -7.5vmax, 0); + transform: translate3d(0, -7.5vmax, 0); } 100% { - -webkit-transform: translate3d(0, 7.5vw, 0); - transform: translate3d(0, 7.5vw, 0); + -webkit-transform: translate3d(0, 7.5vmax, 0); + transform: translate3d(0, 7.5vmax, 0); } } @font-face { diff --git a/build/index.php b/build/index.php index 83e765e..eac0333 100644 --- a/build/index.php +++ b/build/index.php @@ -4,6 +4,7 @@ FHQWHGADS + @@ -12,7 +13,7 @@
i love u
-fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf

-
a>
+
a>
diff --git a/src/assets/css/style.less b/src/assets/css/style.less index 2ad5424..b6b094c 100644 --- a/src/assets/css/style.less +++ b/src/assets/css/style.less @@ -16,23 +16,23 @@ label, label:before, label:after { right: 0; } label { - top: 0; bottom: 0; + min-height: 100%; padding: 1em; font-family: computerfontregular, monospace; color: @consoleColor; - font-size: 4vw; + font-size: 4vmax; overflow: hidden; word-break: break-all; } label:before { content: ""; z-index: -1; - top: -8vw; - bottom: -8vw; + top: -8vmax; + bottom: -8vmax; animation: scroll 10s linear infinite; - background: url('/assets/images/scanline.svg'); - background-size: 115vw 15vw; + background: url('/assets/images/scanline.svg') black; + background-size: 115vmax 15vmax; background-repeat: repeat-y; background-position: 50% 0%; } @@ -81,9 +81,9 @@ label:before { } @keyframes scroll { 0% { - transform: translate3d(0,-7.5vw,0); + transform: translate3d(0,-7.5vmax,0); } 100% { - transform: translate3d(0,7.5vw,0); + transform: translate3d(0,7.5vmax,0); } } diff --git a/src/assets/images/scanline.svg b/src/assets/images/scanline.svg index ad9c5ee..2c76745 100644 --- a/src/assets/images/scanline.svg +++ b/src/assets/images/scanline.svg @@ -1,17 +1,11 @@ - - - - - - -image/svg+xml - - - - - - - - - + + diff --git a/src/index.php b/src/index.php index 83e765e..eac0333 100644 --- a/src/index.php +++ b/src/index.php @@ -4,6 +4,7 @@ FHQWHGADS + @@ -12,7 +13,7 @@
i love u
-fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf

-
a>
+
a>
diff --git a/src/scripts/index.js b/src/scripts/index.js index b8e78e7..6f44a3d 100644 --- a/src/scripts/index.js +++ b/src/scripts/index.js @@ -1,4 +1,17 @@ (function(){ + function escapeHTML(html) { + var fn=function(tag) { + var charsToReplace = { + '&': '&', + '<': '<', + '>': '>', + '"': '"' + }; + return charsToReplace[tag] || tag; + } + return html.replace(/[&<>"]/g, fn); + } + function syncTyping() { var beforeSelection, selection, afterSelection; beforeSelection = this.value.slice(0, this.selectionStart); @@ -12,4 +25,14 @@ commandline.onkeydown = syncTyping; commandline.onkeyup = syncTyping; commandline.onselect = syncTyping; + + function handleForm() { + var scrollback = document.getElementById('scrollback'); + var val = this.command.value; + this.command.value = ''; + document.getElementById("typing").innerHTML = ''; + scrollback.innerHTML = scrollback.innerHTML + 'a>' + escapeHTML(val) + '
Command not found.
'; + return false; + } + document.forms[0].onsubmit = handleForm; }());