From 7cb124ef6bdf7133acb40f1c99841ebe03f30d74 Mon Sep 17 00:00:00 2001 From: Amjad Masad Date: Sat, 8 Feb 2014 23:52:14 -0500 Subject: [PATCH] Update jQconsole to 2.10.0. Had to remove all conflicting styles and unnecessary JS resizing --- browser-check.coffee | 40 ++++++++++++++++++++++++++++++++----- css/mobile.css | 10 +--------- css/style.css | 10 +--------- dom.coffee | 2 -- index.html | 4 ++-- lib/jqconsole-2.10.0.min.js | 1 + lib/jqconsole-2.7.4.min.js | 5 ----- 7 files changed, 40 insertions(+), 32 deletions(-) create mode 100644 lib/jqconsole-2.10.0.min.js delete mode 100644 lib/jqconsole-2.7.4.min.js diff --git a/browser-check.coffee b/browser-check.coffee index ff33b89..4854d6d 100644 --- a/browser-check.coffee +++ b/browser-check.coffee @@ -1,13 +1,43 @@ +# Adapted from jQuery migrate. +uaMatch = (ua) -> + ua = ua.toLowerCase(); + + match = /(chrome)[ \/]([\w.]+)/.exec(ua) or + /(webkit)[ \/]([\w.]+)/.exec(ua) or + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) or + /(msie) ([\w.]+)/.exec(ua) or + ua.indexOf('compatible') < 0 and /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) or + [] + + return { + browser: match[ 1 ] || '' + version: match[ 2 ] || '0' + } + + +matched = uaMatch navigator.userAgent +browser = {}; + +if matched.browser + browser[ matched.browser ] = true + browser.version = matched.version + if browser.chrome + browser.webkit = true + else if browser.webkit + browser.safari = true + + jQuery.browser = browser + ISMOBILE = Boolean navigator.userAgent.match /iPhone|iPad|iPod|Android/i if not ISMOBILE chromeVersion = navigator.userAgent.match /Chrome\/(\d+)/i safariVersion = navigator.userAgent.match /Version\/(\d+)/i - if (($.browser.msie and $.browser.version < 10.0) or - ($.browser.mozilla and $.browser.version < 4) or - ($.browser.opera and $.browser.version < 11.51) or - ($.browser.safari and chromeVersion and chromeVersion[1] < 13) or - ($.browser.safari and safariVersion and safariVersion[1] < 5)) + if ((browser.msie and browser.version < 10.0) or + (browser.mozilla and browser.version < 4) or + (browser.opera and browser.version < 11.51) or + (browser.safari and chromeVersion and chromeVersion[1] < 13) or + (browser.safari and safariVersion and safariVersion[1] < 5)) $ -> $('#content-fallback').show() $('#fallback-ignore').click -> $('#content-fallback').hide() diff --git a/css/mobile.css b/css/mobile.css index 6aa56d1..b25c5ae 100644 --- a/css/mobile.css +++ b/css/mobile.css @@ -348,18 +348,12 @@ html, body { } .jqconsole { - width: 100%; - height: 642px; padding: 15px; padding-top: 17px; - position: absolute; - bottom: 0; - right: 0; color: #F4FFFF; display: block; font-family: monospace; font-size: 14px; - overflow: auto; /* Force word wrap on all browsers. */ white-space: -moz-pre-wrap; /* Mozilla, supported since 1999 */ white-space: -o-pre-wrap; /* Opera */ @@ -376,8 +370,7 @@ html, body { font-weight: bold; color: #FC0; background: url(../images/sprite.png) -13px -583px no-repeat; - position: relative; - left: -8px; + margin-left: -8px; } .jqconsole-blurred .jqconsole-prompt { @@ -401,7 +394,6 @@ html, body { .jqconsole-cursor { background: #666; line-height: 115%; - position: relative !important; margin-right: -8px; } diff --git a/css/style.css b/css/style.css index 918d1e2..4808d93 100644 --- a/css/style.css +++ b/css/style.css @@ -346,18 +346,12 @@ html, body { } .jqconsole { - width: 561px; - height: 642px; padding: 15px; padding-top: 17px; - position: absolute; - bottom: 0; - right: 0; color: #F4FFFF; display: block; font-family: monospace; font-size: 14px; - overflow: auto; /* Force word wrap on all browsers. */ white-space: -moz-pre-wrap; /* Mozilla, supported since 1999 */ white-space: -o-pre-wrap; /* Opera */ @@ -374,8 +368,7 @@ html, body { font-weight: bold; color: #FC0; background: url(../images/sprite.png) -13px -583px no-repeat; - position: relative; - left: -8px; + margin-left: -8px; } .jqconsole-blurred .jqconsole-prompt { @@ -399,7 +392,6 @@ html, body { .jqconsole-cursor { background: #666; line-height: 115%; - position: relative !important; margin-right: -8px; } diff --git a/dom.coffee b/dom.coffee index aea8940..75d3ad0 100644 --- a/dom.coffee +++ b/dom.coffee @@ -312,8 +312,6 @@ $.extend REPLIT, editor_hpadding = @$editor.innerWidth() - @$editor.width() editor_vpadding = @$editor.innerHeight() - @$editor.height() # Resize the console/editor widgets. - @$console.css 'width', @$consoleContainer.width() - console_hpadding - @$console.css 'height', @$consoleContainer.height() - console_vpadding @$editor.css 'width', @$editorContainer.innerWidth() - editor_hpadding @$editor.css 'height', @$editorContainer.innerHeight() - editor_vpadding diff --git a/index.html b/index.html index a0ec89c..b70773a 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,7 @@ - + - + diff --git a/lib/jqconsole-2.10.0.min.js b/lib/jqconsole-2.10.0.min.js new file mode 100644 index 0000000..107e23d --- /dev/null +++ b/lib/jqconsole-2.10.0.min.js @@ -0,0 +1 @@ +(function(){var t,e,i,s,r,o,n,h,p,c,a,l,u,_,f,m,d,$,y,v,g,x,b,k,w,C,T,S,M,P,H,E,L,I,W,D,A,R=function(t,e){return function(){return t.apply(e,arguments)}},U=[].slice;t=jQuery;I=0;W=1;D=2;w=13;H=9;x=46;g=8;T=37;P=39;E=38;b=40;C=36;k=35;M=33;S=34;p="jqconsole-";r=""+p+"cursor";o=""+p+"header";c=""+p+"prompt";h=""+p+"old-prompt";n=""+p+"input";s=""+p+"blurred";y="keypress";m="";_="
";f=":empty";L="\n";u=">>> ";l="... ";a=2;i=""+p+"ansi-";d="";$=/\[(\d*)(?:;(\d*))*m/;e=function(){t.prototype.COLORS=["black","red","green","yellow","blue","magenta","cyan","white"];function t(){this.stylize=R(this.stylize,this);this._closeSpan=R(this._closeSpan,this);this._openSpan=R(this._openSpan,this);this.getClasses=R(this.getClasses,this);this._style=R(this._style,this);this._color=R(this._color,this);this._remove=R(this._remove,this);this._append=R(this._append,this);this.klasses=[]}t.prototype._append=function(t){t=""+i+t;if(this.klasses.indexOf(t)===-1){return this.klasses.push(t)}};t.prototype._remove=function(){var t,e,s,r,o,n;s=1<=arguments.length?U.call(arguments,0):[];n=[];for(r=0,o=s.length;r'+t};t.prototype._closeSpan=function(t){return""+t+""};t.prototype.stylize=function(t){var e,i,s,r,o,n;t=this._openSpan(t);s=0;while((s=t.indexOf(d,s))&&s!==-1){if(i=t.slice(s).match($)){n=i.slice(1);for(r=0,o=n.length;r'+(e||"")+""};v=function(){function i(i,s,r,n){this._HideComposition=R(this._HideComposition,this);this._ShowComposition=R(this._ShowComposition,this);this._UpdateComposition=R(this._UpdateComposition,this);this._EndComposition=R(this._EndComposition,this);this._StartComposition=R(this._StartComposition,this);this._CheckComposition=R(this._CheckComposition,this);this._ProcessMatch=R(this._ProcessMatch,this);this._HandleKey=R(this._HandleKey,this);this._HandleChar=R(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.$window=t(window);this.header=s||"";this.prompt_label_main=typeof r==="string"?r:u;this.prompt_label_continue=n||l;this.indent_width=a;this.state=W;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=t("
").appendTo(i);this.$container.css({top:0,left:0,right:0,bottom:0,position:"absolute",overflow:"auto"});this.$console=t('
').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=t(_).appendTo(this.$container);this.$input_container.css({position:"absolute",width:1,height:0,overflow:"hidden"});this.$input_source=this.isAndroid?t(""):t("