From 15f912a87b08ffe69c35e78fc74eadd26e5dd55f Mon Sep 17 00:00:00 2001 From: Innovation Inc Date: Tue, 23 Apr 2019 10:12:11 -0500 Subject: [PATCH] Update terminal.js --- js/terminal.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/js/terminal.js b/js/terminal.js index 6e8a078..24939df 100644 --- a/js/terminal.js +++ b/js/terminal.js @@ -2,7 +2,16 @@ var util = util || {}; util.toArray = function(list) { return Array.prototype.slice.call(list || [], 0); }; +function show_image(src, width, height, alt) { + var img = document.createElement("img"); + img.src = src; + img.width = width; + img.height = height; + img.alt = alt; + // This next line will just add it to the tag + document.body.appendChild(img); +} var Terminal = Terminal || function(cmdLineContainer, outputContainer) { window.URL = window.URL || window.webkitURL; window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; @@ -11,7 +20,7 @@ var Terminal = Terminal || function(cmdLineContainer, outputContainer) { var output_ = document.querySelector(outputContainer); const CMDS_ = [ - 'cat', 'clear', 'clock', 'date', 'echo', 'help', 'uname', 'whoami' + 'cat', 'clear', 'clock', 'date', 'echo', 'help', 'uname', 'whoami', 'spin' ]; var fs_ = null; @@ -135,6 +144,9 @@ var Terminal = Terminal || function(cmdLineContainer, outputContainer) { result += prop + ": " + codehelper_ip[prop] + "
"; output(result); break; + case 'spin': + show_image('spin.gif', 100px, 100px, 'spinny'); + break; default: if (cmd) { output(cmd + ': command not found');