From 9edf1fa9431016cdd4e08c8afaff52cf0909f22b Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Thu, 23 Apr 2020 01:42:13 -0700 Subject: stage 2 --- connection/private/index.html | 58 ++++++++++++++ connection/private/main.css | 106 +++++++++++++++++++++++++ connection/private/other.js | 177 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 341 insertions(+) create mode 100644 connection/private/index.html create mode 100644 connection/private/main.css create mode 100644 connection/private/other.js (limited to 'connection') diff --git a/connection/private/index.html b/connection/private/index.html new file mode 100644 index 0000000..a858dee --- /dev/null +++ b/connection/private/index.html @@ -0,0 +1,58 @@ + + + + + 198.168.0.1 + + + + + + + + +
+ +
+
+
+
+ +
+ + + + + + + + +
+ + + \ No newline at end of file diff --git a/connection/private/main.css b/connection/private/main.css new file mode 100644 index 0000000..f01abce --- /dev/null +++ b/connection/private/main.css @@ -0,0 +1,106 @@ +::selection { + background: #FF5E99; +} +html, body { + width: 100%; + height: 100%; + margin: 0; +} +body { + font-size: 11pt; + font-family: Inconsolata, monospace; + color: white; + background-color: black; +} +#container { + padding: .1em 1.5em 1em 1em; +} +#container output { + clear: both; + width: 100%; +} +#container output h3 { + margin: 0; +} +#container output pre { + margin: 0; +} +.input-line { + display: -webkit-box; + -webkit-box-orient: horizontal; + -webkit-box-align: stretch; + display: -moz-box; + -moz-box-orient: horizontal; + -moz-box-align: stretch; + display: box; + box-orient: horizontal; + box-align: stretch; + clear: both; +} +.input-line > div:nth-child(2) { + -webkit-box-flex: 1; + -moz-box-flex: 1; + box-flex: 1; +} +.prompt { + white-space: nowrap; + color: #96b38a; + margin-right: 7px; + display: -webkit-box; + -webkit-box-pack: center; + -webkit-box-orient: vertical; + display: -moz-box; + -moz-box-pack: center; + -moz-box-orient: vertical; + display: box; + box-pack: center; + box-orient: vertical; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} +.cmdline { + outline: none; + background-color: transparent; + margin: 0; + width: 100%; + font: inherit; + border: none; + color: inherit; +} +.ls-files { + height: 45px; + -webkit-column-width: 100px; + -moz-column-width: 100px; + -o-column-width: 100px; + column-width: 100px; +} + + +/************************************************************/ +/* SVG Clock */ +/************************************************************/ + +.clock-container { + display: none /*inline-block*/; + position: relative; + width: 200px; + vertical-align: middle; + overflow: hidden; +} + +.clock-container > svg > circle { + stroke-width: 2px; + stroke: #fff; +} + +.hour, .min, .sec { + stroke-width: 1px; + fill: #333; + stroke: #555; +} + +.sec { + stroke: #f55; +} + diff --git a/connection/private/other.js b/connection/private/other.js new file mode 100644 index 0000000..d27ae50 --- /dev/null +++ b/connection/private/other.js @@ -0,0 +1,177 @@ +var util = util || {}; +util.toArray = function(list) { + return Array.prototype.slice.call(list || [], 0); +}; + +var Terminal = Terminal || function(cmdLineContainer, outputContainer) { + window.URL = window.URL || window.webkitURL; + window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; + + var cmdLine_ = document.querySelector(cmdLineContainer); + var output_ = document.querySelector(outputContainer); + + /*const CMDS_ = [ + 'clear', 'date', 'echo', 'help', 'uname', 'whoami' + ];*/ + + var fs_ = null; + var cwd_ = null; + var history_ = []; + var histpos_ = 0; + var histtemp_ = 0; + + window.addEventListener('click', function(e) { + cmdLine_.focus(); + }, false); + + cmdLine_.addEventListener('click', inputTextClick_, false); + cmdLine_.addEventListener('keydown', historyHandler_, false); + cmdLine_.addEventListener('keydown', processNewCommand_, false); + + // + function inputTextClick_(e) { + this.value = this.value; + } + + // + function historyHandler_(e) { + if (history_.length) { + if (e.keyCode == 38 || e.keyCode == 40) { + if (history_[histpos_]) { + history_[histpos_] = this.value; + } else { + histtemp_ = this.value; + } + } + + if (e.keyCode == 38) { // up + histpos_--; + if (histpos_ < 0) { + histpos_ = 0; + } + } else if (e.keyCode == 40) { // down + histpos_++; + if (histpos_ > history_.length) { + histpos_ = history_.length; + } + } + + if (e.keyCode == 38 || e.keyCode == 40) { + this.value = history_[histpos_] ? history_[histpos_] : histtemp_; + this.value = this.value; // Sets cursor to end of input. + } + } + } + + // + function processNewCommand_(e) { + + if (e.keyCode == 9) { // tab + e.preventDefault(); + // Implement tab suggest. + } else if (e.keyCode == 13) { // enter + // Save shell history. + if (this.value) { + history_[history_.length] = this.value; + histpos_ = history_.length; + } + + // Duplicate current input and append to output section. + var line = this.parentNode.parentNode.cloneNode(true); + line.removeAttribute('id') + line.classList.add('line'); + var input = line.querySelector('input.cmdline'); + input.autofocus = false; + input.readOnly = true; + output_.appendChild(line); + + if (this.value && this.value.trim()) { + var args = this.value.split(' ').filter(function(val, i) { + return val; + }); + var cmd = args[0].toLowerCase(); + args = args.splice(1); // Remove cmd from arg list. + } + + switch (cmd) { + case 'clear': + output_.innerHTML = ''; + this.value = ''; + return; + case 'date': + output( new Date() ); + break; + case 'echo': + output( args.join(' ') ); + break; + /*case 'help': + output('
' + CMDS_.join('
') + '
'); + break;*/ + case 'uname': + output(navigator.appVersion); + break; + case 'login': + output('Already logged in.'); + break; + case 'logout': + location.href = '/'; + break; + case 'exit': + location.href = '/'; + break; + case 'download': + output('Authentication process has started. An email will be sent once completed.'); + break; + default: + if (cmd) { + output(cmd + ': command not found'); + } + }; + + window.scrollTo(0, getDocHeight_()); + this.value = ''; // Clear/setup line for next input. + } + } + + // + function formatColumns_(entries) { + var maxName = entries[0].name; + util.toArray(entries).forEach(function(entry, i) { + if (entry.name.length > maxName.length) { + maxName = entry.name; + } + }); + + var height = entries.length <= 3 ? + 'height: ' + (entries.length * 15) + 'px;' : ''; + + // 12px monospace font yields ~7px screen width. + var colWidth = maxName.length * 7; + + return ['
']; + } + + // + function output(html) { + output_.insertAdjacentHTML('beforeEnd', '

' + html + '

'); + } + + // Cross-browser impl to get document's height. + function getDocHeight_() { + var d = document; + return Math.max( + Math.max(d.body.scrollHeight, d.documentElement.scrollHeight), + Math.max(d.body.offsetHeight, d.documentElement.offsetHeight), + Math.max(d.body.clientHeight, d.documentElement.clientHeight) + ); + } + + // + return { + init: function() { + output(new Date() /*+ '

Enter "help" for more information.

'*/ ); + }, + output: output + } +}; \ No newline at end of file -- cgit v1.2.3