From 5e7da4b5c7ca32fe7ecbe7d90ab4002bf2b6e76d Mon Sep 17 00:00:00 2001 From: Adphi Date: Sat, 19 Jan 2019 16:38:43 +0100 Subject: [PATCH] added alias c to clear and exit command --- js/index.js | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/js/index.js b/js/index.js index 88d4feb..6d2d682 100644 --- a/js/index.js +++ b/js/index.js @@ -8,20 +8,29 @@ var baseUrl = OC.generateUrl('/apps/occweb'); $.get(baseUrl + '/cmd', function(response){ $('#app-content').terminal(function(command, term) { - var occCommand = { - command: command - }; - term.pause(); - $.ajax({ - url: baseUrl + '/cmd', - type: 'POST', - contentType: 'application/json', - data: JSON.stringify(occCommand) - }).done(function (response) { - term.echo('\n'+ response).resume(); - }).fail(function (response, code) { - term.echo('\n' + response).resume(); - }); + switch (command) { + case "c": + this.clear(); + break; + case "exit": + this.reset(); + break; + default: + var occCommand = { + command: command + }; + term.pause(); + $.ajax({ + url: baseUrl + '/cmd', + type: 'POST', + contentType: 'application/json', + data: JSON.stringify(occCommand) + }).done(function (response) { + term.echo('\n' + response).resume(); + }).fail(function (response, code) { + term.echo('\n' + response).resume(); + }); + } }, { greetings: '[[;green;]' + new Date().toString().slice(0, 24) + "]\n\nPress [[;#ff5e99;]Enter] for more information on [[;#009ae3;]occ] commands.\n", name: 'occ',