diff --git a/jqconsole.min.js b/jqconsole.min.js index b90b0dd..46f55a7 100644 --- a/jqconsole.min.js +++ b/jqconsole.min.js @@ -1,2 +1,2 @@ -(function(){var $,Ansi,CLASS_ANSI,CLASS_BLURRED,CLASS_CURSOR,CLASS_HEADER,CLASS_INPUT,CLASS_OLD_INPUT,CLASS_OLD_PROMPT,CLASS_PREFIX,CLASS_PROMPT,CLASS_PROMPT_TEXT,DEFAULT_INDENT_WIDTH,DEFAULT_PROMPT_CONINUE_LABEL,DEFAULT_PROMPT_LABEL,EMPTY_DIV,EMPTY_SELECTOR,EMPTY_SPAN,ESCAPE_CHAR,ESCAPE_SYNTAX,E_KEYPRESS,JQConsole,KEY_BACKSPACE,KEY_DELETE,KEY_DOWN,KEY_END,KEY_ENTER,KEY_HOME,KEY_LEFT,KEY_PAGE_DOWN,KEY_PAGE_UP,KEY_RIGHT,KEY_TAB,KEY_UP,NEWLINE,STATE_INPUT,STATE_OUTPUT,STATE_PROMPT,spanHtml,bind=function(fn,me){return function(){return fn.apply(me,arguments)}},slice=[].slice;$=jQuery;STATE_INPUT=0;STATE_OUTPUT=1;STATE_PROMPT=2;KEY_ENTER=13;KEY_TAB=9;KEY_DELETE=46;KEY_BACKSPACE=8;KEY_LEFT=37;KEY_RIGHT=39;KEY_UP=38;KEY_DOWN=40;KEY_HOME=36;KEY_END=35;KEY_PAGE_UP=33;KEY_PAGE_DOWN=34;CLASS_PREFIX="jqconsole-";CLASS_CURSOR=CLASS_PREFIX+"cursor";CLASS_HEADER=CLASS_PREFIX+"header";CLASS_PROMPT=CLASS_PREFIX+"prompt";CLASS_PROMPT_TEXT=CLASS_PROMPT+"-text";CLASS_OLD_PROMPT=CLASS_PREFIX+"old-prompt";CLASS_INPUT=CLASS_PREFIX+"input";CLASS_OLD_INPUT=CLASS_PREFIX+"old-input";CLASS_BLURRED=CLASS_PREFIX+"blurred";E_KEYPRESS="keypress";EMPTY_SPAN="";EMPTY_DIV="
";EMPTY_SELECTOR=":empty";NEWLINE="\n";DEFAULT_PROMPT_LABEL=">>> ";DEFAULT_PROMPT_CONINUE_LABEL="... ";DEFAULT_INDENT_WIDTH=2;CLASS_ANSI=CLASS_PREFIX+"ansi-";ESCAPE_CHAR="";ESCAPE_SYNTAX=/\[(\d*)(?:;(\d*))*m/;Ansi=function(){Ansi.prototype.COLORS=["black","red","green","yellow","blue","magenta","cyan","white"];function Ansi(){this.stylize=bind(this.stylize,this);this._closeSpan=bind(this._closeSpan,this);this._openSpan=bind(this._openSpan,this);this.getClasses=bind(this.getClasses,this);this._style=bind(this._style,this);this._color=bind(this._color,this);this._remove=bind(this._remove,this);this._append=bind(this._append,this);this.klasses=[]}Ansi.prototype._append=function(klass){klass=""+CLASS_ANSI+klass;if(this.klasses.indexOf(klass)===-1){return this.klasses.push(klass)}};Ansi.prototype._remove=function(){var cls,j,klass,klasses,len1,results;klasses=1<=arguments.length?slice.call(arguments,0):[];results=[];for(j=0,len1=klasses.length;j'+text};Ansi.prototype._closeSpan=function(text){return text+""};Ansi.prototype.stylize=function(text){var code,d,i,j,len1,ref;text=this._openSpan(text);i=0;while((i=text.indexOf(ESCAPE_CHAR,i))&&i!==-1){if(d=text.slice(i).match(ESCAPE_SYNTAX)){ref=d.slice(1);for(j=0,len1=ref.length;j'+(content||"")+""};JQConsole=function(){function JQConsole(outer_container,header,prompt_label,prompt_continue_label,disable_auto_focus){if(disable_auto_focus==null){disable_auto_focus=false}this._HideComposition=bind(this._HideComposition,this);this._ShowComposition=bind(this._ShowComposition,this);this._UpdateComposition=bind(this._UpdateComposition,this);this._EndComposition=bind(this._EndComposition,this);this._StartComposition=bind(this._StartComposition,this);this._CheckComposition=bind(this._CheckComposition,this);this._ProcessMatch=bind(this._ProcessMatch,this);this._HandleKey=bind(this._HandleKey,this);this._HandleChar=bind(this._HandleChar,this);this.isMobile=!!navigator.userAgent.match(/iPhone|iPad|iPod|Android/i);this.isIos=!!navigator.userAgent.match(/iPhone|iPad|iPod/i);this.isAndroid=!!navigator.userAgent.match(/Android/i);this.auto_focus=!disable_auto_focus;this.$window=$(window);this.header=header||"";this.prompt_label_main=typeof prompt_label==="string"?prompt_label:DEFAULT_PROMPT_LABEL;this.prompt_label_continue=prompt_continue_label||DEFAULT_PROMPT_CONINUE_LABEL;this.indent_width=DEFAULT_INDENT_WIDTH;this.state=STATE_OUTPUT;this.input_queue=[];this.input_callback=null;this.multiline_callback=null;this.history=[];this.history_index=0;this.history_new="";this.history_active=false;this.shortcuts={};this.$container=$("
").appendTo(outer_container);this.$container.css({top:0,left:0,right:0,bottom:0,position:"absolute",overflow:"auto"});this.$console=$('
').appendTo(this.$container);this.$console.css({margin:0,position:"relative","min-height":"100%","box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"});this.$console_focused=true;this.$input_container=$(EMPTY_DIV).appendTo(this.$container);this.$input_container.css({position:"absolute",width:1,height:0,overflow:"hidden"});this.$input_source=this.isAndroid?$(""):$("