From 95bff794b7158260b0487aa3e40829124d61e364 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 2 Aug 2012 10:59:58 -0400 Subject: [PATCH] minor changes --- lib/client/editor.js | 16 +++++++++------- lib/client/terminal.js | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/lib/client/editor.js b/lib/client/editor.js index 7f3ffefc..323fe384 100644 --- a/lib/client/editor.js +++ b/lib/client/editor.js @@ -8,14 +8,16 @@ CloudCommander.Editor.CodeMirror = { /* function shows editor */ var createEditorDiv = function(){ - if (!document.getElementById('CloudEditor')) { - var lEditor=document.createElement('div'); - lEditor.id ='CloudEditor'; + if (!pParent.getById('CloudEditor')) { var lFM = document.getElementById('fm'); - - if(lFM){ - lFM.appendChild(lEditor); - }else console.log('Error. Something went wrong FM not found'); + if(lFM) + CloudCommander.anyload({ + name : 'div', + id : 'CloudEditor', + element : lFM + }); + else + console.log('Error. Something went wrong FM not found'); pParent.show(); } diff --git a/lib/client/terminal.js b/lib/client/terminal.js index df4becc2..e99402d4 100644 --- a/lib/client/terminal.js +++ b/lib/client/terminal.js @@ -16,8 +16,36 @@ CloudCommander.Terminal.jqconsole = { }); }, - init: function(){ - + init: (function(){ + var pConsole = document.getById('terminal'); + if(!pConsole){ + CloudCommander.anyload({ + name : 'div', + id :'terminal' + }); + } + }), + + show: function(){ + $(function () { + var jqconsole = $('#terminal').jqconsole('Hi\n', '>>>'); + var startPrompt = function () { + // Start the prompt with history enabled. + jqconsole.Prompt(true, function (input) { + // Output input with the class jqconsole-output. + jqconsole.Write(input + '\n', 'jqconsole-output'); + // Restart the prompt. + startPrompt(); + }); + }; + startPrompt(); + }); + }, + + getById : function(pId){return document.getElementById(pId);}, + + getByClass : function(pClass){ + return document.getElementsByClassName(pClass); } };