diff --git a/ChangeLog b/ChangeLog index f22d3a8d..2d7d867c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -90,6 +90,8 @@ getJSONfromFileTable. * feature(socket) if id in use - reconnect +* chore(console) remove jquery-terminal + 2012.04.22, v0.2.0 diff --git a/lib/client/console.js b/lib/client/console.js index 7d01071d..25595226 100644 --- a/lib/client/console.js +++ b/lib/client/console.js @@ -120,12 +120,12 @@ var CloudCmd, Util, DOM, $, jqconsole; function load(pCallBack){ Util.time(Name + ' load'); - var lDir = CloudCmd.LIBDIRCLIENT + 'terminal/jq-console/', + var lDir = CloudCmd.LIBDIRCLIENT + 'console/', lFiles = [ lDir + 'jqconsole.js', lDir + 'jqconsole.css', lDir + 'ansi.css', - CloudCmd.LIBDIRCLIENT + 'terminal/jquery-terminal/jquery-migrate-1.0.0.js' + lDir + 'jquery-migrate-1.0.0.js' ]; DOM.anyLoadInParallel(lFiles, function(){ diff --git a/lib/client/terminal/jq-console/ansi.css b/lib/client/console/ansi.css similarity index 100% rename from lib/client/terminal/jq-console/ansi.css rename to lib/client/console/ansi.css diff --git a/lib/client/terminal/jq-console/jqconsole.css b/lib/client/console/jqconsole.css similarity index 100% rename from lib/client/terminal/jq-console/jqconsole.css rename to lib/client/console/jqconsole.css diff --git a/lib/client/terminal/jq-console/jqconsole.js b/lib/client/console/jqconsole.js similarity index 100% rename from lib/client/terminal/jq-console/jqconsole.js rename to lib/client/console/jqconsole.js diff --git a/lib/client/terminal/jquery-terminal/jquery-migrate-1.0.0.js b/lib/client/console/jquery-migrate-1.0.0.js similarity index 100% rename from lib/client/terminal/jquery-terminal/jquery-migrate-1.0.0.js rename to lib/client/console/jquery-migrate-1.0.0.js diff --git a/lib/client/jquery-console.js b/lib/client/jquery-console.js deleted file mode 100644 index 9ba73d4e..00000000 --- a/lib/client/jquery-console.js +++ /dev/null @@ -1,93 +0,0 @@ -var CloudCmd, Util, DOM, $; -(function(CloudCmd, Util, DOM){ - 'use strict'; - - CloudCmd.Console = new ConsoleProto(CloudCmd, Util, DOM); - - function ConsoleProto(CloudCmd, Util, DOM){ - var Name = 'Console', - Key = CloudCmd.Key, - Images = DOM.Images, - Console = this; - - this.init = function(pCallBack){ - Util.loadOnLoad([ - Console.show, - load, - CloudCmd.View, - DOM.jqueryLoad, - ]); - - DOM.Events.addKey(listener); - - delete Console.init; - }; - - this.show = function(){ - var lElement; - - Images.showLoad({top:true}); - - lElement = DOM.anyload({ - name : 'div', - className : 'console' - }); - - $(lElement).console({ - promptLabel: '# ', - commandValidate : function(line){ - var lRet = line !== ""; - - return lRet; - }, - commandHandle : function(line){ - return line; - }, - autofocus : true, - animateScroll : false, - promptHistory : true, - }); - - CloudCmd.View.show(lElement); - }; - - - this.hide = function(){ - CloudCmd.View.hide(); - }; - - function load(pCallBack){ - Util.time(Name + ' load'); - - var lDir = CloudCmd.LIBDIRCLIENT + 'terminal/jquery-console/', - lFiles = [ - lDir + 'jquery.console.js', - lDir + 'jquery.console.css' - ]; - - DOM.anyLoadInParallel(lFiles, function(){ - console.timeEnd(Name + ' load'); - - Util.exec(pCallBack); - }); - } - - function listener(pEvent){ - var lF10 = Key.F10, - lESC = Key.ESC, - lIsBind = Key.isBind(), - lKey = pEvent.keyCode; - - switch(lKey){ - case lF10: - Console.show(); - break; - case lESC: - Console.hide(); - break; - } - - } - } - -})(CloudCmd, Util, DOM); \ No newline at end of file diff --git a/lib/client/terminal.js b/lib/client/terminal.js deleted file mode 100644 index c311d20e..00000000 --- a/lib/client/terminal.js +++ /dev/null @@ -1,135 +0,0 @@ -var CloudCmd, Util, DOM, $; -/* object contains terminal jqconsole */ - -(function(CloudCmd, Util, DOM){ - 'use strict'; - - var Key = CloudCmd.Key, - TerminalId, - Term, - Hidden = false, - JqueryTerminal = {}; - - CloudCmd.Terminal = {}; - - /** - * function loads jquery-terminal - */ - function load(pCallBack){ - Util.time('terminal load'); - - var lDir = '/lib/client/terminal/jquery-terminal/jquery.', - lFiles = [ - lDir + 'terminal.js', - lDir + 'mousewheel.js', - lDir + 'terminal.css' - ], - lJqueryMigrate = '//code.jquery.com/jquery-migrate-1.0.0.js'; - /* //github.com/jquery/jquery-migrate/ */ - - DOM.anyLoadOnLoad([lFiles, lJqueryMigrate], function(){ - Util.timeEnd('terminal load'); - init(); - $(function($) { - Term = JqueryTerminal.Term = $('#terminal').terminal(function(command, term){ - term.echo(''); - CloudCmd.Socket.send(command); - }, { - greetings : '[[;#729FCF;]CloudCmd Terminal]', - prompt : '[[;#729FCF;]cloudcmd> ]', - color : '#729FCF;' - }); - }); - /* removing resize function, no need for us */ - $(window).unbind('resize'); - - Util.exec(pCallBack); - }).cssSet({id:'terminal-css', - inner: '.terminal{' + - 'height: 720px;' + - '};' - }); - } - - /** - * function do basic initialization - */ - function init(){ - if(!TerminalId) - TerminalId = DOM.anyload({ - name : 'div', - id : 'terminal', - className : 'panel terminal', - parent : DOM.getFM() - }); - } - - /** - * functin show jquery-terminal - */ - JqueryTerminal.show = function(){ - DOM.Images.hideLoad(); - /* only if panel was hided */ - if( DOM.hidePanel() ){ - Hidden = false; - DOM.show(TerminalId); - Key.unsetBind(); - Term.resume(); - } - }; - - /** - * function hide jquery-terminal - */ - JqueryTerminal.hide = function(){ - Hidden = true; - - DOM.hide(TerminalId); - DOM.showPanel(); - Key.setBind(); - - Term.pause(); - }; - - /** - * function bind keys - */ - CloudCmd.Terminal.init = function(){ - Util.loadOnLoad([ - JqueryTerminal.show, - load, - DOM.socketLoad, - DOM.jqueryLoad, - ]); - - DOM.Events.addKey(lListener); - - function lListener(pEvent){ - var lRet = true, - lESC = Key.ESC, - lTRA = Key.TRA, - lKey = pEvent.keyCode, - lIsBind = Key.isBind(); - - switch(lKey){ - case lTRA: - if(Hidden && lIsBind){ - JqueryTerminal.show(); - DOM.preventDefault(pEvent); - lRet = false; - } - break; - - case lESC: - if(!Hidden) - JqueryTerminal.hide(); - break; - } - - return lRet; - } - }; - - CloudCmd.Terminal.JqueryTerminal = JqueryTerminal; - -})(CloudCmd, Util, DOM); diff --git a/lib/client/terminal/jquery-console/.gitignore b/lib/client/terminal/jquery-console/.gitignore deleted file mode 100644 index ac8f9688..00000000 --- a/lib/client/terminal/jquery-console/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -# Compiled source # -################### -*.com -*.class -*.dll -*.exe -*.o -*.so -*.pyc - -# Logs and databases # -###################### -*.log - -# OS generated files # -###################### -.DS_Store* -ehthumbs.db -Icon? -Thumbs.db diff --git a/lib/client/terminal/jquery-console/README b/lib/client/terminal/jquery-console/README deleted file mode 100644 index ac29694c..00000000 --- a/lib/client/terminal/jquery-console/README +++ /dev/null @@ -1,78 +0,0 @@ -INTRODUCTION - -See demo.html. Or here: http://chrisdone.com/jquery-console/ - -Options available: - - autofocus bool Autofocus the terminal, rather than - having to click on it. - - promptHistory bool Provide history support (kind of crappy, - needs doing properly.) - - historyPreserveColumn bool Preserve the column you were one when - switching between history. - - welcomeMessage string Just a first message to display on the - terminal. - - promptLabel string Prompt string like 'JavaScript> '. - - cols integer the number of cols, this value is only - used by the command completion to format - the list of results. - - commandValidate function When user hits return, validate - whether to trigger commandHandle and - re-prompt. - - commandHandle function Handle the command line, return a - string, boolean, or list - of {msg:"foo",className:"my-css-class"}. - commandHandle(line,report) is - called. Report function is for you - to report a result of the command - asynchronously. - - commandComplete function Handle the command completion when the - tab key is pressed. It returns a list - of string completion suffixes. - - animateScroll bool Whether to animate the scroll to - top. Currently disabled. - - charInsertTrigger function Predicate for whether to allow - character insertion. - charInsertTrigger(char,line) is called. - - cancelHandle function Handle a user-signaled interrupt. - -LICENSE - -Copyright 2010 Chris Done, Simon David Pratt. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above - copyright notice, this list of conditions and the following - disclaimer. - - 2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials - provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/lib/client/terminal/jquery-console/jquery.console.css b/lib/client/terminal/jquery-console/jquery.console.css deleted file mode 100644 index 0bc50483..00000000 --- a/lib/client/terminal/jquery-console/jquery.console.css +++ /dev/null @@ -1,34 +0,0 @@ -.console { - word-wrap: break-word; -} - -.jquery-console-inner { - padding:0.5em; -} -.jquery-console-prompt-box { - color:black; - font-family:monospace; -} -.jquery-console-cursor { - color:#333; - font-weight:bold; -} -.jquery-console-message-error { - color:#ef0505; - font-family:sans-serif; - font-weight:bold; - padding:0.1em; -} -.jquery-console-message-value { - color:#1ad027; - font-family:monospace; - padding:0.1em; -} -.jquery-console-message-type { - color:#52666f; - font-family:monospace; - padding:0.1em; -} -.jquery-console-prompt-label { - font-weight:bold; -} \ No newline at end of file diff --git a/lib/client/terminal/jquery-console/jquery.console.js b/lib/client/terminal/jquery-console/jquery.console.js deleted file mode 100644 index 4c20925d..00000000 --- a/lib/client/terminal/jquery-console/jquery.console.js +++ /dev/null @@ -1,716 +0,0 @@ -// JQuery Console 1.0 -// Sun Feb 21 20:28:47 GMT 2010 -// -// Copyright 2010 Chris Done, Simon David Pratt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// 1. Redistributions of source code must retain the above -// copyright notice, this list of conditions and the following -// disclaimer. -// -// 2. Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials -// provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -// TESTED ON -// Internet Explorer 6 -// Opera 10.01 -// Chromium 4.0.237.0 (Ubuntu build 31094) -// Firefox 3.5.8, 3.6.2 (Mac) -// Safari 4.0.5 (6531.22.7) (Mac) -// Google Chrome 5.0.375.55 (Mac) - -(function($){ - var isWebkit = !!~navigator.userAgent.indexOf(' AppleWebKit/'); - - $.fn.console = function(config){ - //////////////////////////////////////////////////////////////////////// - // Constants - // Some are enums, data types, others just for optimisation - var keyCodes = { - // left - 37: moveBackward, - // right - 39: moveForward, - // up - 38: previousHistory, - // down - 40: nextHistory, - // backspace - 8: backDelete, - // delete - 46: forwardDelete, - // end - 35: moveToEnd, - // start - 36: moveToStart, - // return - 13: commandTrigger, - // tab - 18: doNothing, - // tab - 9: doComplete - }; - var ctrlCodes = { - // C-a - 65: moveToStart, - // C-e - 69: moveToEnd, - // C-d - 68: forwardDelete, - // C-n - 78: nextHistory, - // C-p - 80: previousHistory, - // C-b - 66: moveBackward, - // C-f - 70: moveForward, - // C-k - 75: deleteUntilEnd - }; - if(config.ctrlCodes) { - $.extend(ctrlCodes, config.ctrlCodes); - } - var altCodes = { - // M-f - 70: moveToNextWord, - // M-b - 66: moveToPreviousWord, - // M-d - 68: deleteNextWord - }; - var cursor = ' '; - - //////////////////////////////////////////////////////////////////////// - // Globals - var container = $(this); - var inner = $('
'); - // erjiang: changed this from a text input to a textarea so we - // can get pasted newlines - var typer = $(''); - // Prompt - var promptBox; - var prompt; - var promptLabel = config && config.promptLabel? config.promptLabel : "> "; - var continuedPromptLabel = config && config.continuedPromptLabel? - config.continuedPromptLabel : "> "; - var column = 0; - var promptText = ''; - var restoreText = ''; - var continuedText = ''; - // Prompt history stack - var history = []; - var ringn = 0; - // For reasons unknown to The Sword of Michael himself, Opera - // triggers and sends a key character when you hit various - // keys like PgUp, End, etc. So there is no way of knowing - // when a user has typed '#' or End. My solution is in the - // typer.keydown and typer.keypress functions; I use the - // variable below to ignore the keypress event if the keydown - // event succeeds. - var cancelKeyPress = 0; - // When this value is false, the prompt will not respond to input - var acceptInput = true; - // When this value is true, the command has been canceled - var cancelCommand = false; - - // External exports object - var extern = {}; - - //////////////////////////////////////////////////////////////////////// - // Main entry point - (function(){ - container.append(inner); - inner.append(typer); - typer.css({position:'absolute',top:0,left:'-9999px'}); - if (config.welcomeMessage) - message(config.welcomeMessage,'jquery-console-welcome'); - newPromptBox(); - if (config.autofocus) { - inner.addClass('jquery-console-focus'); - typer.focus(); - setTimeout(function(){ - inner.addClass('jquery-console-focus'); - typer.focus(); - },100); - } - extern.inner = inner; - extern.typer = typer; - extern.scrollToBottom = scrollToBottom; - })(); - - //////////////////////////////////////////////////////////////////////// - // Reset terminal - extern.reset = function(){ - var welcome = (typeof config.welcomeMessage != 'undefined'); - inner.parent().fadeOut(function(){ - inner.find('div').each(function(){ - if (!welcome) { - $(this).remove(); - } else { - welcome = false; - } - }); - newPromptBox(); - inner.parent().fadeIn(function(){ - inner.addClass('jquery-console-focus'); - typer.focus(); - }); - }); - }; - - //////////////////////////////////////////////////////////////////////// - // Reset terminal - extern.notice = function(msg,style){ - var n = $('').append($('').text(msg)) - .css({visibility:'hidden'}); - container.append(n); - var focused = true; - if (style=='fadeout') - setTimeout(function(){ - n.fadeOut(function(){ - n.remove(); - }); - },4000); - else if (style=='prompt') { - var a = $('