From: <fg...@us...> - 2010-12-13 21:41:07
|
Revision: 3177 http://openutils.svn.sourceforge.net/openutils/?rev=3177&view=rev Author: fgiust Date: 2010-12-13 21:40:59 +0000 (Mon, 13 Dec 2010) Log Message: ----------- GROOVY-6 Better support for chrome Modified Paths: -------------- trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/css/styles.css trunk/openutils-mgnlgroovy/src/main/resources/net/sourceforge/openutils/mgnlgroovy/pages/GroovyShellPage.html Added Paths: ----------- trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codemirror/ trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codemirror/codemirror.js trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codemirror/codemirror_groovy.js trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codemirror/groovycolors.css Removed Paths: ------------- trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codepress/ Modified: trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/css/styles.css =================================================================== --- trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/css/styles.css 2010-12-13 16:16:50 UTC (rev 3176) +++ trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/css/styles.css 2010-12-13 21:40:59 UTC (rev 3177) @@ -3,4 +3,18 @@ padding: 10px 11px 8px 38px; background: #FFF8BF url(images/warning.png) no-repeat scroll 13px 12px; color: #B35F00; +} + +#textarecontainer { + border: 1px solid #ccc !important; +} + +.CodeMirror-line-numbers { + background-color: #eee; + text-align: right; + font-family: "DejaVu Sans Mono", courier, monospace; + font-size: 10pt; + color: #333; + line-height: 16px; + padding: .4em 3px; } \ No newline at end of file Added: trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codemirror/codemirror.js =================================================================== --- trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codemirror/codemirror.js (rev 0) +++ trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codemirror/codemirror.js 2010-12-13 21:40:59 UTC (rev 3177) @@ -0,0 +1,23 @@ +var CodeMirrorConfig=window.CodeMirrorConfig||{},CodeMirror=function(){function D(a,b){for(var c in b)a.hasOwnProperty(c)||(a[c]=b[c])}function E(a,b){for(var c=0;c<a.length;c++)b(a[c])}function s(a){return document.createElementNS&&document.documentElement.namespaceURI!==null?document.createElementNS("http://www.w3.org/1999/xhtml",a):document.createElement(a)}function F(a,b){var c=s("div"),e=s("div");c.style.position="absolute";c.style.height="100%";if(c.style.setExpression)try{c.style.setExpression("height", +"this.previousSibling.offsetHeight + 'px'")}catch(h){}c.style.top="0px";c.style.left="0px";c.style.overflow="hidden";a.appendChild(c);e.className="CodeMirror-line-numbers";c.appendChild(e);e.innerHTML="<div>"+b+"</div>";return c}function G(a){if(typeof a.parserfile=="string")a.parserfile=[a.parserfile];if(typeof a.basefiles=="string")a.basefiles=[a.basefiles];if(typeof a.stylesheet=="string")a.stylesheet=[a.stylesheet];var b=['<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head>']; +b.push('<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>');E(a.stylesheet,function(c){b.push('<link rel="stylesheet" type="text/css" href="'+c+'"/>')});E(a.basefiles.concat(a.parserfile),function(c){/^https?:/.test(c)||(c=a.path+c);b.push('<script type="text/javascript" src="'+c+(a.noScriptCaching?"?nocache="+(new Date).getTime().toString(16):"")+'"><\/script>')});b.push('</head><body style="border-width: 0;" class="editbox" spellcheck="'+(a.disableSpellcheck?"false":"true")+'"></body></html>'); +return b.join("")}function t(a,b){this.options=b=b||{};D(b,CodeMirrorConfig);if(b.dumbTabs)b.tabMode="spaces";else if(b.normalTab)b.tabMode="default";if(b.cursorActivity)b.onCursorActivity=b.cursorActivity;var c=this.frame=s("iframe");if(b.iframeClass)c.className=b.iframeClass;c.frameBorder=0;c.style.border="0";c.style.width="100%";c.style.height="100%";c.style.display="block";var e=this.wrapping=s("div");e.style.position="relative";e.className="CodeMirror-wrapping";e.style.width=b.width;e.style.height= +b.height=="dynamic"?b.minHeight+"px":b.height;var h=this.textareaHack=s("textarea");e.appendChild(h);h.style.position="absolute";h.style.left="-10000px";h.style.width="10px";h.tabIndex=1E5;c.CodeMirror=this;if(b.domain&&H){this.html=G(b);c.src="javascript:(function(){document.open();"+(b.domain?'document.domain="'+b.domain+'";':"")+"document.write(window.frameElement.CodeMirror.html);document.close();})()"}else c.src="javascript:;";a.appendChild?a.appendChild(e):a(e);e.appendChild(c);if(b.lineNumbers)this.lineNumbers= +F(e,b.firstLineNumber);this.win=c.contentWindow;if(!b.domain||!H){this.win.document.open();this.win.document.write(G(b));this.win.document.close()}}D(CodeMirrorConfig,{stylesheet:[],path:"",parserfile:[],basefiles:["util.js","stringstream.js","select.js","undo.js","editor.js","tokenize.js"],iframeClass:null,passDelay:200,passTime:50,lineNumberDelay:200,lineNumberTime:50,continuousScanning:false,saveFunction:null,onLoad:null,onChange:null,undoDepth:50,undoDelay:800,disableSpellcheck:true,textWrapping:true, +readOnly:false,width:"",height:"300px",minHeight:100,autoMatchParens:false,parserConfig:null,tabMode:"indent",enterMode:"indent",electricChars:true,reindentOnLoad:false,activeTokens:null,onCursorActivity:null,lineNumbers:false,firstLineNumber:1,onLineNumberClick:null,indentUnit:2,domain:null,noScriptCaching:false});var H=document.selection&&window.ActiveXObject&&/MSIE/.test(navigator.userAgent);t.prototype={init:function(){this.options.initCallback&&this.options.initCallback(this);this.options.onLoad&& +this.options.onLoad(this);this.options.lineNumbers&&this.activateLineNumbers();this.options.reindentOnLoad&&this.reindent();this.options.height=="dynamic"&&this.setDynamicHeight()},getCode:function(){return this.editor.getCode()},setCode:function(a){this.editor.importCode(a)},selection:function(){this.focusIfIE();return this.editor.selectedText()},reindent:function(){this.editor.reindent()},reindentSelection:function(){this.focusIfIE();this.editor.reindentSelection(null)},focusIfIE:function(){this.win.select.ie_selection&& +this.focus()},focus:function(){this.win.focus();this.editor.selectionSnapshot&&this.win.select.setBookmark(this.win.document.body,this.editor.selectionSnapshot)},replaceSelection:function(a){this.focus();this.editor.replaceSelection(a);return true},replaceChars:function(a,b,c){this.editor.replaceChars(a,b,c)},getSearchCursor:function(a,b,c){return this.editor.getSearchCursor(a,b,c)},undo:function(){this.editor.history.undo()},redo:function(){this.editor.history.redo()},historySize:function(){return this.editor.history.historySize()}, +clearHistory:function(){this.editor.history.clear()},grabKeys:function(a,b){this.editor.grabKeys(a,b)},ungrabKeys:function(){this.editor.ungrabKeys()},setParser:function(a,b){this.editor.setParser(a,b)},setSpellcheck:function(a){this.win.document.body.spellcheck=a},setStylesheet:function(a){if(typeof a==="string")a=[a];for(var b={},c={},e=this.win.document.getElementsByTagName("link"),h=0,d;d=e[h];h++)if(d.rel.indexOf("stylesheet")!==-1)for(var f=0;f<a.length;f++){var n=a[f];if(d.href.substring(d.href.length- +n.length)===n){b[d.href]=true;c[n]=true}}for(h=0;d=e[h];h++)if(d.rel.indexOf("stylesheet")!==-1)d.disabled=!(d.href in b);for(f=0;f<a.length;f++){n=a[f];if(!(n in c)){d=this.win.document.createElement("link");d.rel="stylesheet";d.type="text/css";d.href=n;this.win.document.getElementsByTagName("head")[0].appendChild(d)}}},setTextWrapping:function(a){if(a!=this.options.textWrapping){this.win.document.body.style.whiteSpace=a?"":"nowrap";this.options.textWrapping=a;if(this.lineNumbers){this.setLineNumbers(false); +this.setLineNumbers(true)}}},setIndentUnit:function(a){this.win.indentUnit=a},setUndoDepth:function(a){this.editor.history.maxDepth=a},setTabMode:function(a){this.options.tabMode=a},setEnterMode:function(a){this.options.enterMode=a},setLineNumbers:function(a){if(a&&!this.lineNumbers){this.lineNumbers=F(this.wrapping,this.options.firstLineNumber);this.activateLineNumbers()}else if(!a&&this.lineNumbers){this.wrapping.removeChild(this.lineNumbers);this.wrapping.style.paddingLeft="";this.lineNumbers= +null}},cursorPosition:function(a){this.focusIfIE();return this.editor.cursorPosition(a)},firstLine:function(){return this.editor.firstLine()},lastLine:function(){return this.editor.lastLine()},nextLine:function(a){return this.editor.nextLine(a)},prevLine:function(a){return this.editor.prevLine(a)},lineContent:function(a){return this.editor.lineContent(a)},setLineContent:function(a,b){this.editor.setLineContent(a,b)},removeLine:function(a){this.editor.removeLine(a)},insertIntoLine:function(a,b,c){this.editor.insertIntoLine(a, +b,c)},selectLines:function(a,b,c,e){this.win.focus();this.editor.selectLines(a,b,c,e)},nthLine:function(a){for(var b=this.firstLine();a>1&&b!==false;a--)b=this.nextLine(b);return b},lineNumber:function(a){for(var b=0;a!==false;){b++;a=this.prevLine(a)}return b},jumpToLine:function(a){if(typeof a=="number")a=this.nthLine(a);this.selectLines(a,0);this.win.focus()},currentLine:function(){return this.lineNumber(this.cursorLine())},cursorLine:function(){return this.cursorPosition().line},cursorCoords:function(a){return this.editor.cursorCoords(a)}, +activateLineNumbers:function(){function a(){if(d.offsetWidth!=0){for(var g=d;g.parentNode;g=g.parentNode);if(!i.parentNode||g!=document||!f.Editor){try{y()}catch(k){}clearInterval(J)}else if(i.offsetWidth!=z){z=i.offsetWidth;d.parentNode.style.paddingLeft=z+"px"}}}function b(){i.scrollTop=q.scrollTop||n.documentElement.scrollTop||0}function c(g){var k=l.firstChild.offsetHeight;if(k!=0){k=Math.ceil((50+Math.max(q.offsetHeight,Math.max(d.offsetHeight,q.scrollHeight||0)))/k);for(var o=l.childNodes.length;o<= +k;o++){var w=s("div");w.appendChild(document.createTextNode(g?String(o+j.options.firstLineNumber):"\u00a0"));l.appendChild(w)}}}function e(){function g(){c(true);b()}j.updateNumbers=g;var k=f.addEventHandler(f,"scroll",b,true),o=f.addEventHandler(f,"resize",g,true);y=function(){k();o();if(j.updateNumbers==g)j.updateNumbers=null};g()}function h(){function g(p,A){r||(r=l.appendChild(s("div")));I&&I(r,A,p);u.push(r);u.push(p);B=r.offsetHeight+r.offsetTop;r=r.nextSibling}function k(){for(var p=0;p<u.length;p+= +2)u[p].innerHTML=u[p+1];u=[]}function o(){if(!(!l.parentNode||l.parentNode!=j.lineNumbers)){for(var p=(new Date).getTime()+j.options.lineNumberTime;m;){for(g(C++,m.previousSibling);m&&!f.isBR(m);m=m.nextSibling)for(var A=m.offsetTop+m.offsetHeight;l.offsetHeight&&A-3>B;)g(" ");if(m)m=m.nextSibling;if((new Date).getTime()>p){k();v=setTimeout(o,j.options.lineNumberDelay);return}}for(;r;)g(C++);k();b()}}function w(p){b();c(p);m=q.firstChild;r=l.firstChild;B=0;C=j.options.firstLineNumber;o()}function x(){v&& +clearTimeout(v);if(j.editor.allClean())w();else v=setTimeout(x,200)}var m,r,C,B,u=[],I=j.options.styleNumbers;w(true);var v=null;j.updateNumbers=x;var K=f.addEventHandler(f,"scroll",b,true),L=f.addEventHandler(f,"resize",x,true);y=function(){v&&clearTimeout(v);if(j.updateNumbers==x)j.updateNumbers=null;K();L()}}var d=this.frame,f=d.contentWindow,n=f.document,q=n.body,i=this.lineNumbers,l=i.firstChild,j=this,z=null;i.onclick=function(g){var k=j.options.onLineNumberClick;if(k){g=(g||window.event).target|| +(g||window.event).srcElement;var o=g==i?NaN:Number(g.innerHTML);isNaN(o)||k(o,g)}};var y=function(){};a();var J=setInterval(a,500);(this.options.textWrapping||this.options.styleNumbers?h:e)()},setDynamicHeight:function(){function a(){for(var q=0,i=h.lastChild,l;i&&e.isBR(i);){i.hackBR||q++;i=i.previousSibling}if(i){d=i.offsetHeight;l=i.offsetTop+(1+q)*d}else if(d)l=q*d;if(l)b.wrapping.style.height=Math.max(n+l,b.options.minHeight)+"px"}var b=this,c=b.options.onCursorActivity,e=b.win,h=e.document.body, +d=null,f=null,n=2*b.frame.offsetTop;h.style.overflowY="hidden";e.document.documentElement.style.overflowY="hidden";this.frame.scrolling="no";setTimeout(a,300);b.options.onCursorActivity=function(q){c&&c(q);clearTimeout(f);f=setTimeout(a,100)}}};t.InvalidLineHandle={toString:function(){return"CodeMirror.InvalidLineHandle"}};t.replace=function(a){if(typeof a=="string")a=document.getElementById(a);return function(b){a.parentNode.replaceChild(b,a)}};t.fromTextArea=function(a,b){function c(){a.value=d.getCode()} +if(typeof a=="string")a=document.getElementById(a);b=b||{};if(a.style.width&&b.width==null)b.width=a.style.width;if(a.style.height&&b.height==null)b.height=a.style.height;if(b.content==null)b.content=a.value;if(a.form){typeof a.form.addEventListener=="function"?a.form.addEventListener("submit",c,false):a.form.attachEvent("onsubmit",c);var e=a.form.submit,h=function(){c();a.form.submit=e;a.form.submit();a.form.submit=h};a.form.submit=h}a.style.display="none";var d=new t(function(f){a.nextSibling?a.parentNode.insertBefore(f, +a.nextSibling):a.parentNode.appendChild(f)},b);d.toTextArea=function(){c();a.parentNode.removeChild(d.wrapping);a.style.display="";if(a.form){a.form.submit=e;typeof a.form.removeEventListener=="function"?a.form.removeEventListener("submit",c,false):a.form.detachEvent("onsubmit",c)}};return d};t.isProbablySupported=function(){var a;return window.opera?Number(window.opera.version())>=9.52:/Apple Computer, Inc/.test(navigator.vendor)&&(a=navigator.userAgent.match(/Version\/(\d+(?:\.\d+)?)\./))?Number(a[1])>= +3:document.selection&&window.ActiveXObject&&(a=navigator.userAgent.match(/MSIE (\d+(?:\.\d*)?)\b/))?Number(a[1])>=6:(a=navigator.userAgent.match(/gecko\/(\d{8})/i))?Number(a[1])>=20050901:(a=navigator.userAgent.match(/AppleWebKit\/(\d+)/))?Number(a[1])>=525:null};return t}(); Property changes on: trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codemirror/codemirror.js ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codemirror/codemirror_groovy.js =================================================================== --- trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codemirror/codemirror_groovy.js (rev 0) +++ trunk/openutils-mgnlgroovy/src/main/resources/mgnl-resources/groovyshell/js/codemirror/codemirror_groovy.js 2010-12-13 21:40:59 UTC (rev 3177) @@ -0,0 +1,94 @@ +function method(h,m){return function(){h[m].apply(h,arguments)}}var StopIteration={toString:function(){return"StopIteration"}};function forEach(h,m){if(h.next)try{for(;;)m(h.next())}catch(k){if(k!=StopIteration)throw k;}else for(var l=0;l<h.length;l++)m(h[l])}function map(h,m){var k=[];forEach(h,function(l){k.push(m(l))});return k}function matcher(h){return function(m){return h.test(m)}}function hasClass(h,m){var k=h.className;return k&&RegExp("(^| )"+m+"($| )").test(k)} +function insertAfter(h,m){m.parentNode.insertBefore(h,m.nextSibling);return h}function removeElement(h){h.parentNode&&h.parentNode.removeChild(h)}function clearElement(h){for(;h.firstChild;)h.removeChild(h.firstChild)}function isAncestor(h,m){for(;m=m.parentNode;)if(h==m)return true;return false}var nbsp="\u00a0",matching={"{":"}","[":"]","(":")","}":"{","]":"[",")":"("}; +function normalizeEvent(h){if(!h.stopPropagation){h.stopPropagation=function(){this.cancelBubble=true};h.preventDefault=function(){this.returnValue=false}}if(!h.stop)h.stop=function(){this.stopPropagation();this.preventDefault()};if(h.type=="keypress"){h.code=h.charCode==null?h.keyCode:h.charCode;h.character=String.fromCharCode(h.code)}return h} +function addEventHandler(h,m,k,l){function n(t){k(normalizeEvent(t||window.event))}if(typeof h.addEventListener=="function"){h.addEventListener(m,n,false);if(l)return function(){h.removeEventListener(m,n,false)}}else{h.attachEvent("on"+m,n);if(l)return function(){h.detachEvent("on"+m,n)}}}function nodeText(h){return h.textContent||h.innerText||h.nodeValue||""}function nodeTop(h){for(var m=0;h.offsetParent;){m+=h.offsetTop;h=h.offsetParent}return m} +function isBR(h){h=h.nodeName;return h=="BR"||h=="br"}function isSpan(h){h=h.nodeName;return h=="SPAN"||h=="span"};var stringStream=function(h){function m(){for(;l==k.length;){n+=k;k="";l=0;try{k=h.next()}catch(t){if(t!=StopIteration)throw t;else return false}}return true}var k="",l=0,n="";return{peek:function(){if(!m())return null;return k.charAt(l)},next:function(){if(!m())if(n.length>0)throw"End of stringstream reached without emptying buffer ('"+n+"').";else throw StopIteration;return k.charAt(l++)},get:function(){var t=n;n="";if(l>0){t+=k.slice(0,l);k=k.slice(l);l=0}return t},push:function(t){k=k.slice(0, +l)+t+k.slice(l)},lookAhead:function(t,u,w,a){function e(i){return a?i.toLowerCase():i}t=e(t);var b=false,f=n,c=l;for(w&&this.nextWhileMatches(/[\s\u00a0]/);;){w=l+t.length;var g=k.length-l;if(w<=k.length){b=t==e(k.slice(l,w));l=w;break}else if(t.slice(0,g)==e(k.slice(l))){n+=k;k="";try{k=h.next()}catch(d){break}l=0;t=t.slice(g)}else break}if(!(b&&u)){k=n.slice(f.length)+k;l=c;n=f}return b},more:function(){return this.peek()!==null},applies:function(t){var u=this.peek();return u!==null&&t(u)},nextWhile:function(t){for(var u;(u= +this.peek())!==null&&t(u);)this.next()},matches:function(t){var u=this.peek();return u!==null&&t.test(u)},nextWhileMatches:function(t){for(var u;(u=this.peek())!==null&&t.test(u);)this.next()},equals:function(t){return t===this.peek()},endOfLine:function(){var t=this.peek();return t==null||t=="\n"}}};var select={}; +(function(){function h(b,f){for(;b&&b.parentNode!=f;)b=b.parentNode;return b}function m(b,f){for(;!b.previousSibling&&b.parentNode!=f;)b=b.parentNode;return h(b.previousSibling,f)}function k(b){var f=b.nextSibling;if(f){for(;f.firstChild;)f=f.firstChild;return f.nodeType==3||isBR(f)?f:k(f)}else{for(b=b.parentNode;b&&!b.nextSibling;)b=b.parentNode;return b&&k(b)}}select.ie_selection=document.selection&&document.selection.createRangeCollection;select.scrollToNode=function(b,f){if(b){for(var c=b,g=document.body, +d=document.documentElement,i=!c.nextSibling||!c.nextSibling.nextSibling||!c.nextSibling.nextSibling.nextSibling,j=0;c&&!c.offsetTop;){j++;c=c.previousSibling}if(j==0)i=false;if(!(webkit&&c&&c.offsetTop==5&&c.offsetLeft==5)){j=j*(c?c.offsetHeight:0);var p=0,r=b?b.offsetWidth:0;for(c=c;c&&c.offsetParent;){j+=c.offsetTop;isBR(c)||(p+=c.offsetLeft);c=c.offsetParent}c=g.scrollLeft||d.scrollLeft||0;g=g.scrollTop||d.scrollTop||0;var s=false,q=window.innerWidth||d.clientWidth||0;if(f||r<q){if(f){var y=select.offsetInNode(b), +x=nodeText(b).length;if(x)p+=r*(y/x)}r=p-c;if(r<0||r>q){c=p;s=true}}p=j-g;if(p<0||i||p>(window.innerHeight||d.clientHeight||0)-50){g=i?1E6:j;s=true}s&&window.scrollTo(c,g)}}};select.scrollToCursor=function(b){select.scrollToNode(select.selectionTopNode(b,true)||b.firstChild,true)};var l=null;select.snapshotChanged=function(){if(l)l.changed=true};select.snapshotReplaceNode=function(b,f,c,g){function d(i){if(b==i.node){l.changed=true;if(c&&i.offset>c)i.offset-=c;else{i.node=f;i.offset+=g||0}}else if(select.ie_selection&& +i.offset==0&&i.node==k(b))l.changed=true}if(l){d(l.start);d(l.end)}};select.snapshotMove=function(b,f,c,g,d){function i(j){if(b==j.node&&(!d||j.offset==0)){l.changed=true;j.node=f;j.offset=g?Math.max(0,j.offset+c):c}}if(l){i(l.start);i(l.end)}};if(select.ie_selection){var n=function(){var b=document.selection;return b&&(b.createRange||b.createTextRange)()},t=function(b){function f(r){for(var s=null;!s&&r;){s=r.nextSibling;r=r.parentNode}return c(s)}function c(r){for(;r&&r.firstChild;)r=r.firstChild; +return{node:r,offset:0}}var g=n();g.collapse(b);b=g.parentElement();if(!isAncestor(document.body,b))return null;if(!b.firstChild)return c(b);var d=g.duplicate();d.moveToElementText(b);d.collapse(true);for(var i=b.firstChild;i;i=i.nextSibling){if(i.nodeType==3){var j=i.nodeValue.length;d.move("character",j)}else{d.moveToElementText(i);d.collapse(false)}var p=g.compareEndPoints("StartToStart",d);if(p==0)return f(i);if(p!=1){if(i.nodeType!=3)return c(i);d.setEndPoint("StartToEnd",g);return{node:i,offset:j- +d.text.length}}}return f(b)};select.markSelection=function(){l=null;if(document.selection){var b=t(true),f=t(false);if(b&&f)l={start:b,end:f,changed:false}}};select.selectMarked=function(){function b(g){var d=document.body.createTextRange(),i=g.node;if(i)if(i.nodeType==3){d.moveToElementText(i.parentNode);for(g=g.offset;i.previousSibling;){i=i.previousSibling;g+=(i.innerText||"").length}d.move("character",g)}else{d.moveToElementText(i);d.collapse(true)}else{d.moveToElementText(document.body);d.collapse(false)}return d} +if(l&&l.changed){var f=b(l.start),c=b(l.end);f.setEndPoint("StartToEnd",c);f.select()}};select.offsetInNode=function(b){var f=n();if(!f)return 0;var c=f.duplicate();try{c.moveToElementText(b)}catch(g){return 0}f.setEndPoint("StartToStart",c);return f.text.length};select.selectionTopNode=function(b,f){function c(s,q){if(q.nodeType==3){for(var y=0,x=q.previousSibling;x&&x.nodeType==3;){y+=x.nodeValue.length;x=x.previousSibling}if(x){try{s.moveToElementText(x)}catch(o){return false}s.collapse(false)}else s.moveToElementText(q.parentNode); +y&&s.move("character",y)}else try{s.moveToElementText(q)}catch(v){return false}return true}var g=n();if(!g)return false;var d=g.duplicate();g.collapse(f);var i=g.parentElement();if(i&&isAncestor(b,i)){d.moveToElementText(i);if(g.compareEndPoints("StartToStart",d)==1)return h(i,b)}f=0;for(i=b.childNodes.length-1;f<i;){var j=Math.ceil((i+f)/2),p=b.childNodes[j];if(!p)return false;if(!c(d,p))return false;if(g.compareEndPoints("StartToStart",d)==1)f=j;else i=j-1}if(f==0){g=n();d=g.duplicate();try{d.moveToElementText(b)}catch(r){return null}if(g.compareEndPoints("StartToStart", +d)==0)return null}return b.childNodes[f]||null};select.focusAfterNode=function(b,f){var c=document.body.createTextRange();c.moveToElementText(b||f);c.collapse(!b);c.select()};select.somethingSelected=function(){var b=n();return b&&b.text!=""};var u=function(b){var f=n();if(f){f.pasteHTML(b);f.collapse(false);f.select()}};select.insertNewlineAtCursor=function(){u("<br>")};select.insertTabAtCursor=function(){u("\u00a0\u00a0\u00a0\u00a0")};select.cursorPos=function(b,f){var c=n();if(!c)return null;for(var g= +select.selectionTopNode(b,f);g&&!isBR(g);)g=g.previousSibling;var d=c.duplicate();c.collapse(f);if(g){d.moveToElementText(g);d.collapse(false)}else{try{d.moveToElementText(b)}catch(i){return null}d.collapse(true)}c.setEndPoint("StartToStart",d);return{node:g,offset:c.text.length}};select.setCursorPos=function(b,f,c){function g(i){var j=document.body.createTextRange();if(i.node){j.moveToElementText(i.node);j.collapse(false)}else{j.moveToElementText(b);j.collapse(true)}j.move("character",i.offset); +return j}var d=g(f);c&&c!=f&&d.setEndPoint("EndToEnd",g(c));d.select()};select.getBookmark=function(b){var f=select.cursorPos(b,true);b=select.cursorPos(b,false);if(f&&b)return{from:f,to:b}};select.setBookmark=function(b,f){f&&select.setCursorPos(b,f.from,f.to)}}else{var w=function(b,f){for(;b.nodeType!=3&&!isBR(b);){var c=b.childNodes[f]||b.nextSibling;for(f=0;!c&&b.parentNode;){b=b.parentNode;c=b.nextSibling}b=c;if(!c)break}return{node:b,offset:f}};select.markSelection=function(){var b=window.getSelection(); +if(!b||b.rangeCount==0)return l=null;b=b.getRangeAt(0);l={start:w(b.startContainer,b.startOffset),end:w(b.endContainer,b.endOffset),changed:false}};select.selectMarked=function(){function b(){if(c.start.node==c.end.node&&c.start.offset==c.end.offset){var d=window.getSelection();if(!d||d.rangeCount==0)return true;d=d.getRangeAt(0);d=w(d.startContainer,d.startOffset);return c.start.node!=d.node||c.start.offset!=d.offset}}function f(d,i){if(d.node)d.offset==0?g["set"+i+"Before"](d.node):g["set"+i](d.node, +d.offset);else g.setStartAfter(document.body.lastChild||document.body)}var c=l;if(c&&(c.changed||webkit&&b())){var g=document.createRange();f(c.end,"End");f(c.start,"Start");a(g)}};var a=function(b){var f=window.getSelection();if(f){f.removeAllRanges();f.addRange(b)}},e=function(){var b=window.getSelection();return!b||b.rangeCount==0?false:b.getRangeAt(0)};select.selectionTopNode=function(b,f){var c=e();if(!c)return false;var g=f?c.startContainer:c.endContainer,d=f?c.startOffset:c.endOffset;window.opera&& +!f&&c.endContainer==b&&c.endOffset==c.startOffset+1&&b.childNodes[c.startOffset]&&isBR(b.childNodes[c.startOffset])&&d--;return g.nodeType==3?d>0?h(g,b):m(g,b):g.nodeName.toUpperCase()=="HTML"?d==1?null:b.lastChild:g==b?d==0?null:g.childNodes[d-1]:d==g.childNodes.length?h(g,b):d==0?m(g,b):h(g.childNodes[d-1],b)};select.focusAfterNode=function(b,f){var c=document.createRange();c.setStartBefore(f.firstChild||f);if(b&&!b.firstChild)c.setEndAfter(b);else b?c.setEnd(b,b.childNodes.length):c.setEndBefore(f.firstChild|| +f);c.collapse(false);a(c)};select.somethingSelected=function(){var b=e();return b&&!b.collapsed};select.offsetInNode=function(b){var f=e();if(!f)return 0;f=f.cloneRange();f.setStartBefore(b);return f.toString().length};select.insertNodeAtCursor=function(b){var f=e();if(f){f.deleteContents();f.insertNode(b);webkitLastLineHack(document.body);if(window.opera&&isBR(b)&&isSpan(b.parentNode)){f=b.nextSibling;var c=b.parentNode,g=c.parentNode;g.insertBefore(b,c.nextSibling);for(c="";f&&f.nodeType==3;f=f.nextSibling){c+= +f.nodeValue;removeElement(f)}g.insertBefore(makePartSpan(c,document),b.nextSibling)}f=document.createRange();f.selectNode(b);f.collapse(false);a(f)}};select.insertNewlineAtCursor=function(){select.insertNodeAtCursor(document.createElement("BR"))};select.insertTabAtCursor=function(){select.insertNodeAtCursor(document.createTextNode("\u00a0\u00a0\u00a0\u00a0"))};select.cursorPos=function(b,f){var c=e();if(c){for(var g=select.selectionTopNode(b,f);g&&!isBR(g);)g=g.previousSibling;c=c.cloneRange();c.collapse(f); +g?c.setStartAfter(g):c.setStartBefore(b);c=c.toString();return{node:g,offset:c.length}}};select.setCursorPos=function(b,f,c){function g(i,j,p){function r(x){x.nodeType==3?s.push(x):forEach(x.childNodes,r)}if(j==0&&i&&!i.nextSibling){d["set"+p+"After"](i);return true}if(i=i?i.nextSibling:b.firstChild){if(j==0){d["set"+p+"Before"](i);return true}for(var s=[];;){for(;i&&!s.length;){r(i);i=i.nextSibling}var q=s.shift();if(!q)return false;var y=q.nodeValue.length;if(y>=j){d["set"+p](q,j);return true}j-= +y}}}var d=document.createRange();c=c||f;g(c.node,c.offset,"End")&&g(f.node,f.offset,"Start")&&a(d)}}})();function UndoHistory(h,m,k,l){this.container=h;this.maxDepth=m;this.commitDelay=k;this.editor=l;this.parent=l.parent;this.last=this.first=h={text:"",from:null,to:null};this.firstTouched=false;this.history=[];this.redoHistory=[];this.touched=[]} +UndoHistory.prototype={scheduleCommit:function(){var h=this;this.parent.clearTimeout(this.commitTimeout);this.commitTimeout=this.parent.setTimeout(function(){h.tryCommit()},this.commitDelay)},touch:function(h){this.setTouched(h);this.scheduleCommit()},undo:function(){this.commit();if(this.history.length){var h=this.history.pop();this.redoHistory.push(this.updateTo(h,"applyChain"));this.notifyEnvironment();return this.chainNode(h)}},redo:function(){this.commit();if(this.redoHistory.length){var h=this.redoHistory.pop(); +this.addUndoLevel(this.updateTo(h,"applyChain"));this.notifyEnvironment();return this.chainNode(h)}},clear:function(){this.history=[];this.redoHistory=[]},historySize:function(){return{undo:this.history.length,redo:this.redoHistory.length}},push:function(h,m,k){for(var l=[],n=0;n<k.length;n++){var t=n==k.length-1?m:document.createElement("br");l.push({from:h,to:t,text:cleanText(k[n])});h=t}this.pushChains([l],h==null&&m==null);this.notifyEnvironment()},pushChains:function(h,m){this.commit(m);this.addUndoLevel(this.updateTo(h, +"applyChain"));this.redoHistory=[]},chainNode:function(h){for(var m=0;m<h.length;m++){var k=h[m][0];if(k=k&&(k.from||k.to))return k}},reset:function(){this.history=[];this.redoHistory=[]},textAfter:function(h){return this.after(h).text},nodeAfter:function(h){return this.after(h).to},nodeBefore:function(h){return this.before(h).from},tryCommit:function(){!window||!window.parent||!window.UndoHistory||(this.editor.highlightDirty()?this.commit(true):this.scheduleCommit())},commit:function(h){this.parent.clearTimeout(this.commitTimeout); +h||this.editor.highlightDirty(true);h=this.touchedChains();if(h.length){this.addUndoLevel(this.updateTo(h,"linkChain"));this.redoHistory=[];this.notifyEnvironment()}},updateTo:function(h,m){for(var k=[],l=[],n=0;n<h.length;n++){k.push(this.shadowChain(h[n]));l.push(this[m](h[n]))}m=="applyChain"&&this.notifyDirty(l);return k},notifyDirty:function(h){forEach(h,method(this.editor,"addDirtyNode"));this.editor.scheduleHighlight()},notifyEnvironment:function(){this.onChange&&this.onChange();window.frameElement&& +window.frameElement.CodeMirror.updateNumbers&&window.frameElement.CodeMirror.updateNumbers()},linkChain:function(h){for(var m=0;m<h.length;m++){var k=h[m];if(k.from)k.from.historyAfter=k;else this.first=k;if(k.to)k.to.historyBefore=k;else this.last=k}},after:function(h){return h?h.historyAfter:this.first},before:function(h){return h?h.historyBefore:this.last},setTouched:function(h){if(h){if(!h.historyTouched){this.touched.push(h);h.historyTouched=true}}else this.firstTouched=true},addUndoLevel:function(h){this.history.push(h); +this.history.length>this.maxDepth&&this.history.shift()},touchedChains:function(){function h(w,a){if(w)w.historyTemp=a;else n=a}function m(w){for(var a=[],e=w?w.nextSibling:l.container.firstChild;e&&(!isBR(e)||e.hackBR);e=e.nextSibling)!e.hackBR&&e.currentText&&a.push(e.currentText);return{from:w,to:e,text:cleanText(a.join(""))}}function k(w,a){for(var e=a+"Sibling",b=w[e];b&&!isBR(b);)b=b[e];return b}var l=this,n=null,t=[];l.firstTouched&&l.touched.push(null);forEach(l.touched,function(w){if(!(w&& +(w.parentNode!=l.container||w.hackBR))){if(w)w.historyTouched=false;else l.firstTouched=false;var a=m(w),e=l.after(w);if(!e||e.text!=a.text||e.to!=a.to){t.push(a);h(w,a)}}});var u=[];l.touched=[];forEach(t,function(w){if(w.from?w.from.historyTemp:n){for(var a=[],e=w.from,b=true;;){var f=e?e.historyTemp:n;if(!f)if(b)break;else f=m(e);a.unshift(f);h(e,null);if(!e)break;b=l.after(e);e=k(e,"previous")}e=w.to;for(b=l.before(w.from);;){if(!e)break;f=e?e.historyTemp:n;if(!f)if(b)break;else f=m(e);a.push(f); +h(e,null);b=l.before(e);e=k(e,"next")}u.push(a)}});return u},shadowChain:function(h){var m=[],k=this.after(h[0].from);for(h=h[h.length-1].to;;){m.push(k);k=k.to;if(!k||k==h)break;else k=k.historyAfter||this.before(h)}return m},applyChain:function(h){var m=select.cursorPos(this.container,false),k=this,l=h[0].from,n=h[h.length-1].to;(function(b,f){for(var c=b?b.nextSibling:k.container.firstChild;c!=f;){var g=c.nextSibling;removeElement(c);c=g}})(l,n);for(var t=0;t<h.length;t++){var u=h[t];t>0&&k.container.insertBefore(u.from, +n);var w=makePartSpan(fixSpaces(u.text));k.container.insertBefore(w,n);if(m&&m.node==u.from){w=0;var a=this.after(u.from);if(a&&t==h.length-1){for(var e=0;e<m.offset&&u.text.charAt(e)==a.text.charAt(e);e++);if(m.offset>e)w=u.text.length-a.text.length}select.setCursorPos(this.container,{node:u.from,offset:Math.max(0,m.offset+w)})}else m&&t==h.length-1&&m.node&&m.node.parentNode!=this.container&&select.setCursorPos(this.container,{node:u.from,offset:u.text.length})}this.linkChain(h);return l}};var internetExplorer=document.selection&&window.ActiveXObject&&/MSIE/.test(navigator.userAgent),webkit=/AppleWebKit/.test(navigator.userAgent),safari=/Apple Computer, Inc/.test(navigator.vendor),gecko=navigator.userAgent.match(/gecko\/(\d{8})/i);if(gecko)gecko=Number(gecko[1]);var mac=/Mac/.test(navigator.platform),brokenOpera=window.opera&&/Version\/10.[56]/.test(navigator.userAgent),slowWebkit=/AppleWebKit\/533/.test(navigator.userAgent); +function makeWhiteSpace(h){for(var m=[],k=true;h>0;h--){m.push(k||h==1?nbsp:" ");k^=true}return m.join("")}function fixSpaces(h){if(h.charAt(0)==" ")h=nbsp+h.slice(1);return h.replace(/\t/g,function(){return makeWhiteSpace(indentUnit)}).replace(/[ \u00a0]{2,}/g,function(m){return makeWhiteSpace(m.length)})}function cleanText(h){return h.replace(/\u00a0/g," ").replace(/\u200b/g,"")} +function makePartSpan(h){var m=h;if(h.nodeType==3)m=h.nodeValue;else h=document.createTextNode(m);var k=document.createElement("span");k.isPart=true;k.appendChild(h);k.currentText=m;return k}function alwaysZero(){return 0} +var webkitLastLineHack=webkit?function(h){var m=h.lastChild;if(!m||!m.hackBR){m=document.createElement("br");m.hackBR=true;h.appendChild(m)}}:function(){},Editor=function(){function h(a){var e=makeWhiteSpace(indentUnit);return map(a.replace(/\t/g,e).replace(/\u00a0/g," ").replace(/\r\n?/g,"\n").split("\n"),fixSpaces)}function m(a,e){function b(g,d){if(g.nodeType==3){if((g.nodeValue=fixSpaces(g.nodeValue.replace(/[\r\u200b]/g,"").replace(/\n/g," "))).length)c=false;f.push(g)}else if(isBR(g)&&g.childNodes.length== +0){c=true;f.push(g)}else{for(var i=g.firstChild;i;i=i.nextSibling)b(i);if(!c&&w.hasOwnProperty(g.nodeName.toUpperCase())){c=true;if(!e||!d)f.push(document.createElement("br"))}}}var f=[],c=true;b(a,true);return f}function k(a){function e(g){var d=g.parentNode,i=g.nextSibling;return function(j){d.insertBefore(j,i)}}var b=[],f=null,c=true;return{next:function(){if(!a)throw StopIteration;var g=a;a=g.nextSibling;var d;if(g.isPart&&g.childNodes.length==1&&g.firstChild.nodeType==3){d=g.firstChild.nodeValue; +g.dirty=g.dirty||d!=g.currentText;g.currentText=d;d=!/[\n\t\r]/.test(g.currentText)}else d=false;if(d){b.push(g);c=false;return g.currentText}else if(isBR(g)){c&&window.opera&&g.parentNode.insertBefore(makePartSpan(""),g);b.push(g);c=true;return"\n"}else{d=!g.nextSibling;f=e(g);removeElement(g);g=m(g,d);for(d=0;d<g.length;d++){var i=g,j=d,p=g[d],r="\n";if(p.nodeType==3){select.snapshotChanged();p=makePartSpan(p);r=p.currentText;c=false}else{c&&window.opera&&f(makePartSpan(""));c=true}p.dirty=true; +b.push(p);f(p);i[j]=r}return g.join("")}},nodes:b}}function l(a){for(;a&&!isBR(a);)a=a.previousSibling;return a}function n(a,e){if(a){if(isBR(a))a=a.nextSibling}else a=e.firstChild;for(;a&&!isBR(a);)a=a.nextSibling;return a}function t(a,e,b,f){function c(i){i=cleanText(a.history.textAfter(i));return f?i.toLowerCase():i}this.editor=a;this.history=a.history;this.history.commit();this.valid=!!e;this.atOccurrence=false;if(f==undefined)f=e==e.toLowerCase();var g={node:null,offset:0};if(b&&typeof b=="object"&& +typeof b.character=="number"){a.checkLine(b.line);b={node:b.line,offset:b.character};this.pos={from:b,to:b}}else this.pos=b?{from:select.cursorPos(a.container,true)||g,to:select.cursorPos(a.container,false)||g}:{from:g,to:g};if(f)e=e.toLowerCase();var d=e.split("\n");this.matches=d.length==1?function(i,j,p){var r=c(j),s=e.length,q;if(i?p>=s&&(q=r.lastIndexOf(e,p-s))!=-1:(q=r.indexOf(e,p))!=-1)return{from:{node:j,offset:q},to:{node:j,offset:q+s}}}:function(i,j,p){var r=i?d.length-1:0,s=d[r],q=c(j), +y=i?q.indexOf(s)+s.length:q.lastIndexOf(s);if(!(i?y>=p||y!=s.length:y<=p||y!=q.length-s.length))for(p=j;;){if(i&&!p)break;p=i?this.history.nodeBefore(p):this.history.nodeAfter(p);if(!i&&!p)break;q=c(p);s=d[i?--r:++r];if(r>0&&r<d.length-1)if(q!=s)break;else continue;r=i?q.lastIndexOf(s):q.indexOf(s)+s.length;if(i?r!=q.length-s.length:r!=s.length)break;return{from:{node:i?p:j,offset:i?r:y},to:{node:i?j:p,offset:i?y:r}}}}}function u(a){this.options=a;window.indentUnit=a.indentUnit;this.parent=parent; +var e=this.container=document.body;this.history=new UndoHistory(e,a.undoDepth,a.undoDelay,this);var b=this;if(!u.Parser)throw"No parser loaded.";a.parserConfig&&u.Parser.configure&&u.Parser.configure(a.parserConfig);!a.readOnly&&!internetExplorer&&select.setCursorPos(e,{node:null,offset:0});this.dirty=[];this.importCode(a.content||"");this.history.onChange=a.onChange;if(a.readOnly){if(!a.textWrapping)e.style.whiteSpace="nowrap"}else{if(a.continuousScanning!==false){this.scanner=this.documentScanner(a.passTime); +this.delayScanning()}var f=function(){if(document.body.contentEditable!=undefined&&internetExplorer)document.body.contentEditable="true";else document.designMode="on";if(internetExplorer&&a.height!="dynamic")document.body.style.minHeight=window.frameElement.clientHeight-2*document.body.offsetTop-5+"px";document.documentElement.style.borderWidth="0";if(!a.textWrapping)e.style.whiteSpace="nowrap"};try{f()}catch(c){var g=addEventHandler(document,"focus",function(){g();f()},true)}addEventHandler(document, +"keydown",method(this,"keyDown"));addEventHandler(document,"keypress",method(this,"keyPress"));addEventHandler(document,"keyup",method(this,"keyUp"));var d=function(){b.cursorActivity(false)};addEventHandler(internetExplorer?document.body:window,"mouseup",d);addEventHandler(document.body,"cut",d);gecko&&addEventHandler(window,"pagehide",function(){b.unloaded=true});addEventHandler(document.body,"paste",function(i){d();var j=null;try{var p=i.clipboardData||window.clipboardData;if(p)j=p.getData("Text")}catch(r){}if(j!== +null){i.stop();b.replaceSelection(j);select.scrollToCursor(b.container)}});this.options.autoMatchParens&&addEventHandler(document.body,"click",method(this,"scheduleParenHighlight"))}}var w={P:true,DIV:true,LI:true};t.prototype={findNext:function(){return this.find(false)},findPrevious:function(){return this.find(true)},find:function(a){function e(){var d={node:c,offset:g};b.pos={from:d,to:d};return b.atOccurrence=false}if(!this.valid)return false;var b=this,f=a?this.pos.from:this.pos.to,c=f.node, +g=f.offset;if(c&&!c.parentNode){c=null;g=0}for(;;){if(this.pos=this.matches(a,c,g))return this.atOccurrence=true;if(a){if(!c)return e();c=this.history.nodeBefore(c);g=this.history.textAfter(c).length}else{f=this.history.nodeAfter(c);if(!f){g=this.history.textAfter(c).length;return e()}c=f;g=0}}},select:function(){if(this.atOccurrence){select.setCursorPos(this.editor.container,this.pos.from,this.pos.to);select.scrollToCursor(this.editor.container)}},replace:function(a){if(this.atOccurrence){this.pos.to= +this.editor.replaceRange(this.pos.from,this.pos.to,a);this.atOccurrence=false}},position:function(){if(this.atOccurrence)return{line:this.pos.from.node,character:this.pos.from.offset}}};u.prototype={importCode:function(a){this.history.push(null,null,h(a));this.history.reset()},getCode:function(){if(!this.container.firstChild)return"";var a=[];select.markSelection();forEach(k(this.container.firstChild),method(a,"push"));select.selectMarked();webkit&&this.container.lastChild.hackBR&&a.pop();webkitLastLineHack(this.container); +return cleanText(a.join(""))},checkLine:function(a){if(a===false||!(a==null||a.parentNode==this.container))throw parent.CodeMirror.InvalidLineHandle;},cursorPosition:function(a){if(a==null)a=true;return(a=select.cursorPos(this.container,a))?{line:a.node,character:a.offset}:{line:null,character:0}},firstLine:function(){return null},lastLine:function(){return this.container.lastChild?l(this.container.lastChild):null},nextLine:function(a){this.checkLine(a);return n(a,this.container)||false},prevLine:function(a){this.checkLine(a); +if(a==null)return false;return l(a.previousSibling)},visibleLineCount:function(){for(var a=this.container.firstChild;a&&isBR(a);)a=a.nextSibling;if(!a)return false;return Math.floor((window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)/a.offsetHeight)},selectLines:function(a,e,b,f){this.checkLine(a);a={node:a,offset:e};e=null;if(f!==undefined){this.checkLine(b);e={node:b,offset:f}}select.setCursorPos(this.container,a,e);select.scrollToCursor(this.container)},lineContent:function(a){var e= +[];for(a=a?a.nextSibling:this.container.firstChild;a&&!isBR(a);a=a.nextSibling)e.push(nodeText(a));return cleanText(e.join(""))},setLineContent:function(a,e){this.history.commit();this.replaceRange({node:a,offset:0},{node:a,offset:this.history.textAfter(a).length},e);this.addDirtyNode(a);this.scheduleHighlight()},removeLine:function(a){for(var e=a?a.nextSibling:this.container.firstChild;e;){var b=e.nextSibling;removeElement(e);if(isBR(e))break;e=b}this.addDirtyNode(a);this.scheduleHighlight()},insertIntoLine:function(a, +e,b){var f=null;if(e=="end")f=n(a,this.container);else for(var c=a?a.nextSibling:this.container.firstChild;c;c=c.nextSibling){if(e==0){f=c;break}var g=nodeText(c);if(g.length>e){f=c.nextSibling;b=g.slice(0,e)+b+g.slice(e);removeElement(c);break}e-=g.length}e=h(b);for(b=0;b<e.length;b++){b>0&&this.container.insertBefore(document.createElement("BR"),f);this.container.insertBefore(makePartSpan(e[b]),f)}this.addDirtyNode(a);this.scheduleHighlight()},selectedText:function(){var a=this.history;a.commit(); +var e=select.cursorPos(this.container,true),b=select.cursorPos(this.container,false);if(!e||!b)return"";if(e.node==b.node)return a.textAfter(e.node).slice(e.offset,b.offset);var f=[a.textAfter(e.node).slice(e.offset)];for(e=a.nodeAfter(e.node);e!=b.node;e=a.nodeAfter(e))f.push(a.textAfter(e));f.push(a.textAfter(b.node).slice(0,b.offset));return cleanText(f.join("\n"))},replaceSelection:function(a){this.history.commit();var e=select.cursorPos(this.container,true),b=select.cursorPos(this.container, +false);if(e&&b){b=this.replaceRange(e,b,a);select.setCursorPos(this.container,b);webkitLastLineHack(this.container)}},cursorCoords:function(a,e){function b(j,p){var r=-(document.body.scrollTop||document.documentElement.scrollTop||0),s=-(document.body.scrollLeft||document.documentElement.scrollLeft||0)+p;forEach([j,e?null:window.frameElement],function(q){for(;q;){s+=q.offsetLeft;r+=q.offsetTop;q=q.offsetParent}});return{x:s,y:r,yBot:r+j.offsetHeight}}function f(j,p){var r=document.createElement("SPAN"); +r.appendChild(document.createTextNode(j));try{return p(r)}finally{r.parentNode&&r.parentNode.removeChild(r)}}var c=select.cursorPos(this.container,a);if(!c)return null;for(var g=c.offset,d=c.node,i=this;g;){d=d?d.nextSibling:this.container.firstChild;c=nodeText(d);if(g<c.length)return f(c.substr(0,g),function(j){j.style.position="absolute";j.style.visibility="hidden";j.className=d.className;i.container.appendChild(j);return b(d,j.offsetWidth)});g-=c.length}return d&&isSpan(d)?b(d,d.offsetWidth):d&& +d.nextSibling&&isSpan(d.nextSibling)?b(d.nextSibling,0):f("\u200b",function(j){d?d.parentNode.insertBefore(j,d.nextSibling):i.container.insertBefore(j,i.container.firstChild);return b(j,0)})},reroutePasteEvent:function(){if(!(this.capturingPaste||window.opera||gecko&&gecko>=20101026)){this.capturingPaste=true;var a=window.frameElement.CodeMirror.textareaHack,e=this.cursorCoords(true,true);a.style.top=e.y+"px";if(internetExplorer)if(e=select.getBookmark(this.container))this.selectionSnapshot=e;parent.focus(); +a.value="";a.focus();var b=this;this.parent.setTimeout(function(){b.capturingPaste=false;window.focus();b.selectionSnapshot&&window.select.setBookmark(b.container,b.selectionSnapshot);var f=a.value;if(f){b.replaceSelection(f);select.scrollToCursor(b.container)}},10)}},replaceRange:function(a,e,b){b=h(b);b[0]=this.history.textAfter(a.node).slice(0,a.offset)+b[0];var f=b[b.length-1];b[b.length-1]=f+this.history.textAfter(e.node).slice(e.offset);e=this.history.nodeAfter(e.node);this.history.push(a.node, +e,b);return{node:this.history.nodeBefore(e),offset:f.length}},getSearchCursor:function(a,e,b){return new t(this,a,e,b)},reindent:function(){this.container.firstChild&&this.indentRegion(null,this.container.lastChild)},reindentSelection:function(a){if(select.somethingSelected()){var e=select.selectionTopNode(this.container,true),b=select.selectionTopNode(this.container,false);e===false||b===false||this.indentRegion(e,b,a)}else this.indentAtCursor(a)},grabKeys:function(a,e){this.frozen=a;this.keyFilter= +e},ungrabKeys:function(){this.frozen="leave"},setParser:function(a,e){u.Parser=window[a];(e=e||this.options.parserConfig)&&u.Parser.configure&&u.Parser.configure(e);if(this.container.firstChild){forEach(this.container.childNodes,function(b){if(b.nodeType!=3)b.dirty=true});this.addDirtyNode(this.firstChild);this.scheduleHighlight()}},keyDown:function(a){if(this.frozen=="leave")this.keyFilter=this.frozen=null;if(this.frozen&&(!this.keyFilter||this.keyFilter(a.keyCode,a))){a.stop();this.frozen(a)}else{var e= +a.keyCode;this.delayScanning();this.options.autoMatchParens&&this.scheduleParenHighlight();if(e==13){if(a.ctrlKey&&!a.altKey)this.reparseBuffer();else{select.insertNewlineAtCursor();e=this.options.enterMode;if(e!="flat")this.indentAtCursor(e=="keep"?"keep":undefined);select.scrollToCursor(this.container)}a.stop()}else if(e==9&&this.options.tabMode!="default"&&!a.ctrlKey){this.handleTab(!a.shiftKey);a.stop()}else if(e==32&&a.shiftKey&&this.options.tabMode=="default"){this.handleTab(true);a.stop()}else if(e== +36&&!a.shiftKey&&!a.ctrlKey)this.home()&&a.stop();else if(e==35&&!a.shiftKey&&!a.ctrlKey)this.end()&&a.stop();else if(e==33&&!a.shiftKey&&!a.ctrlKey&&!gecko)this.pageUp()&&a.stop();else if(e==34&&!a.shiftKey&&!a.ctrlKey&&!gecko)this.pageDown()&&a.stop();else if((e==219||e==221)&&a.ctrlKey&&!a.altKey){this.highlightParens(a.shiftKey,true);a.stop()}else if(a.metaKey&&!a.shiftKey&&(e==37||e==39)){var b=select.selectionTopNode(this.container);if(!(b===false||!this.container.firstChild)){if(e==37)select.focusAfterNode(l(b), +this.container);else{e=n(b,this.container);select.focusAfterNode(e?e.previousSibling:this.container.lastChild,this.container)}a.stop()}}else if((a.ctrlKey||a.metaKey)&&!a.altKey)if(a.shiftKey&&e==90||e==89){select.scrollToNode(this.history.redo());a.stop()}else if(e==90||safari&&e==8){select.scrollToNode(this.history.undo());a.stop()}else if(e==83&&this.options.saveFunction){this.options.saveFunction();a.stop()}else e==86&&!mac&&this.reroutePasteEvent()}},keyPress:function(a){var e=this.options.electricChars&& +u.Parser.electricChars,b=this;if(this.frozen&&(!this.keyFilter||this.keyFilter(a.keyCode||a.code,a))||a.code==13||a.code==9&&this.options.tabMode!="default"||a.code==32&&a.shiftKey&&this.options.tabMode=="default")a.stop();else if(mac&&(a.ctrlKey||a.metaKey)&&a.character=="v")this.reroutePasteEvent();else if(e&&e.indexOf(a.character)!=-1)this.parent.setTimeout(function(){b.indentAtCursor(null)},0);else if(brokenOpera)if(a.code==8){var f=select.selectionTopNode(this.container);b=this;var c=f?f.nextSibling: +this.container.firstChild;f!==false&&c&&isBR(c)&&this.parent.setTimeout(function(){select.selectionTopNode(b.container)==c&&select.focusAfterNode(c.previousSibling,b.container)},20)}else{if(a.code==46){f=select.selectionTopNode(this.container);b=this;f&&isBR(f)&&this.parent.setTimeout(function(){select.selectionTopNode(b.container)!=f&&select.focusAfterNode(f,b.container)},20)}}else if(slowWebkit){c=(f=select.selectionTopNode(this.container))?f.nextSibling:this.container.firstChild;if(f&&c&&isBR(c)&& +!isBR(f)){var g=document.createTextNode("\u200b");this.container.insertBefore(g,c);this.parent.setTimeout(function(){if(g.nodeValue=="\u200b")removeElement(g);else g.nodeValue=g.nodeValue.replace("\u200b","")},20)}}webkit&&!this.options.textWrapping&&setTimeout(function(){var d=select.selectionTopNode(b.container,true);d&&d.nodeType==3&&d.previousSibling&&isBR(d.previousSibling)&&d.nextSibling&&isBR(d.nextSibling)&&d.parentNode.replaceChild(document.createElement("BR"),d.previousSibling)},50)},keyUp:function(a){this.cursorActivity(a.keyCode>= +16&&a.keyCode<=18||a.keyCode>=33&&a.keyCode<=40)},indentLineAfter:function(a,e){function b(p){p=p?p.nextSibling:f.container.firstChild;if(!p||!hasClass(p,"whitespace"))return null;return p}var f=this,c=b(a),g=0,d=c?c.currentText.length:0,i=c?c.nextSibling:a?a.nextSibling:this.container.firstChild;if(e=="keep"){if(a){var j=b(l(a.previousSibling));if(j)g=j.currentText.length}}else{j=a&&i&&i.currentText?i.currentText:"";if(e!=null&&this.options.tabMode=="shift")g=e?d+indentUnit:Math.max(0,d-indentUnit); +else if(a)g=a.indentation(j,d,e);else if(u.Parser.firstIndentation)g=u.Parser.firstIndentation(j,d,e)}d=g-d;if(d<0)if(g==0){if(i)select.snapshotMove(c.firstChild,i.firstChild||i,0);removeElement(c);c=null}else{select.snapshotMove(c.firstChild,c.firstChild,d,true);c.currentText=makeWhiteSpace(g);c.firstChild.nodeValue=c.currentText}else if(d>0)if(c){c.currentText=makeWhiteSpace(g);c.firstChild.nodeValue=c.currentText;select.snapshotMove(c.firstChild,c.firstChild,d,true)}else{c=makePartSpan(makeWhiteSpace(g)); +c.className="whitespace";a?insertAfter(c,a):this.container.insertBefore(c,this.container.firstChild);select.snapshotMove(i&&(i.firstChild||i),c.firstChild,g,false,true)}else c&&select.snapshotMove(c.firstChild,c.firstChild,g,false);d!=0&&this.addDirtyNode(a)},highlightAtCursor:function(){var a=select.selectionTopNode(this.container,true),e=select.selectionTopNode(this.container,false);if(a===false||e===false)return false;select.markSelection();if(this.highlight(a,n(e,this.container),true,20)===false)return false; +select.selectMarked();return true},handleTab:function(a){this.options.tabMode=="spaces"?select.insertTabAtCursor():this.reindentSelection(a)},home:function(){var a=select.selectionTopNode(this.container,true),e=a;if(a===false||!(!a||a.isPart||isBR(a))||!this.container.firstChild)return false;for(;a&&!isBR(a);)a=a.previousSibling;var b=a?a.nextSibling:this.container.firstChild;b&&b!=e&&b.isPart&&hasClass(b,"whitespace")?select.focusAfterNode(b,this.container):select.focusAfterNode(a,this.container); +select.scrollToCursor(this.container);return true},end:function(){var a=select.selectionTopNode(this.container,true);if(a===false)return false;a=n(a,this.container);if(!a)return false;select.focusAfterNode(a.previousSibling,this.container);select.scrollToCursor(this.container);return true},pageUp:function(){var a=this.cursorPosition().line,e=this.visibleLineCount();if(a===false||e===false)return false;e-=2;for(var b=0;b<e;b++){a=this.prevLine(a);if(a===false)break}if(b==0)return false;select.setCursorPos(this.container, +{node:a,offset:0});select.scrollToCursor(this.container);return true},pageDown:function(){var a=this.cursorPosition().line,e=this.visibleLineCount();if(a===false||e===false)return false;e-=2;for(var b=0;b<e;b++){var f=this.nextLine(a);if(f===false)break;a=f}if(b==0)return false;select.setCursorPos(this.container,{node:a,offset:0});select.scrollToCursor(this.container);return true},scheduleParenHighlight:function(){this.parenEvent&&this.parent.clearTimeout(this.parenEvent);var a=this;this.parenEvent= +this.parent.setTimeout(function(){a.highlightParens()},300)},highlightParens:function(a,e){function b(q,y){if(q)if(d.options.markParen)d.options.markParen(q,y);else{q.style.fontWeight="bold";q.style.color=y?"#8F8":"#F88"}}function f(q){if(q)if(d.options.unmarkParen)d.options.unmarkParen(q);else{q.style.fontWeight="";q.style.color=""}}function c(q){if(q.currentText)return(q=q.currentText.match(/^[\s\u00a0]*([\(\)\[\]{}])[\s\u00a0]*$/))&&q[1]}function g(){for(var q=[],y,x=true,o=j;o;o=r?o.nextSibling: +o.previousSibling)if(o.className==p&&isSpan(o)&&(y=c(o))){if(/[\(\[\{]/.test(y)==r)q.push(y);else if(q.length){if(q.pop()!=matching[y])x=false}else x=false;if(!q.length)break}else if(o.dirty||!isSpan(o)&&!isBR(o))return{node:o,status:"dirty"};return{node:o,status:o&&x}}var d=this;if(!e&&d.highlighted){f(d.highlighted[0]);f(d.highlighted[1])}if(!(!window||!window.parent||!window.select)){this.parenEvent&&this.parent.clearTimeout(this.parenEvent);this.parenEvent=null;var i,j=select.selectionTopNode(this.container, +true);if(j&&this.highlightAtCursor())if((j=select.selectionTopNode(this.container,true))&&((i=c(j))||(j=j.nextSibling)&&(i=c(j))))for(var p=j.className,r=/[\(\[\{]/.test(i);;){var s=g();if(s.status=="dirty"){this.highlight(s.node,n(s.node));s.node.dirty=false}else{b(j,s.status);b(s.node,s.status);if(e)d.parent.setTimeout(function(){f(j);f(s.node)},500);else d.highlighted=[j,s.node];a&&s.node&&select.focusAfterNode(s.node.previousSibling,this.container);break}}}},indentAtCursor:function(a){if(this.container.firstChild)if(this.highlightAtCursor()){var e= +select.selectionTopNode(this.container,false);if(e!==false){select.markSelection();this.indentLineAfter(l(e),a);select.selectMarked()}}},indentRegion:function(a,e,b){var f=a=l(a),c=a&&l(a.previousSibling);isBR(e)||(e=n(e,this.container));this.addDirtyNode(a);do{var g=n(f,this.container);f&&this.highlight(c,g,true);this.indentLineAfter(f,b);c=f;f=g}while(f!=e);select.setCursorPos(this.container,{node:a,offset:0},{node:e,offset:0})},cursorActivity:function(a){if(this.unloaded){window.document.designMode= +"off";window.document.designMode="on";this.unloaded=false}if(internetExplorer){this.container.createTextRange().execCommand("unlink");clearTimeout(this.saveSelectionSnapshot);var e=this;this.saveSelectionSnapshot=setTimeout(function(){var c=select.getBookmark(e.container);if(c)e.selectionSnapshot=c},200)}var b=this.options.onCursorActivity;if(!a||b){var f=select.selectionTopNode(this.container,false);if(!(f===false||!this.container.firstChild)){f=f||this.container.firstChild;b&&b(f);if(!a){this.scheduleHighlight(); +this.addDirtyNode(f)}}}},reparseBuffer:function(){forEach(this.container.childNodes,function(a){a.dirty=true});this.container.firstChild&&this.addDirtyNode(this.container.firstChild)},addDirtyNode:function(a){if(a=a||this.container.firstChild){for(var e=0;e<this.dirty.length;e++)if(this.dirty[e]==a)return;if(a.nodeType!=3)a.dirty=true;this.dirty.push(a)}},allClean:function(){return!this.dirty.length},scheduleHighlight:function(){var a=this;this.parent.clearTimeout(this.highlightTimeout);this.highlightTimeout= +this.parent.setTimeout(function(){a.highlightDirty()},this.options.passDelay)},getDirtyNode:function(){for(;this.dirty.length>0;){var a=this.dirty.pop();try{for(;a&&a.parentNode!=this.container;)a=a.parentNode;if(a&&(a.dirty||a.nodeType==3))return a}catch(e){}}return null},highlightDirty:function(a){if(!window||!window.parent||!window.select)return false;this.options.readOnly||select.markSelection();for(var e,b=a?null:(new Date).getTime()+this.options.passTime;((new Date).getTime()<b||a)&&(e=this.getDirtyNode());){var f= +this.highlight(e,b);f&&f.node&&f.dirty&&this.addDirtyNode(f.node.nextSibling)}this.options.readOnly||select.selectMarked();e&&this.scheduleHighlight();return this.dirty.length==0},documentScanner:function(a){var e=this,b=null;return function(){if(!(!window||!window.parent||!window.select)){if(b&&b.parentNode!=e.container)b=null;select.markSelection();var f=e.highlight(b,(new Date).getTime()+a,true);select.selectMarked();f=f?f.node&&f.node.nextSibling:null;b=b==f?null:f;e.delayScanning()}}},delayScanning:function(){if(this.scanner){this.parent.clearTimeout(this.documentScan); +this.documentScan=this.parent.setTimeout(this.scanner,this.options.continuousScanning)}},highlight:function(a,e,b,f){function c(o){if(o){var v=o.oldNextSibling;if(q||v===undefined||o.nextSibling!=v)d.history.touch(o);o.oldNextSibling=o.nextSibling}else{v=d.container.oldFirstChild;if(q||v===undefined||d.container.firstChild!=v)d.history.touch(null);d.container.oldFirstChild=d.container.firstChild}}var g=this.container,d=this,i=this.options.activeTokens,j=typeof e=="number"?e:null;if(!g.firstChild)return false; +for(;a&&(!a.parserFromHere||a.dirty);){if(f!=null&&isBR(a)&&--f<0)return false;a=a.previousSibling}if(a&&!a.nextSibling)return false;var p=k(a?a.nextSibling:g.firstChild);f=stringStream(p);var r=a?a.parserFromHere(f):u.Parser.make(f),s={current:null,get:function(){if(!this.current)this.current=p.nodes.shift();return this.current},next:function(){this.current=null},remove:function(){g.removeChild(this.get());this.current=null},getNonEmpty:function(){for(var o=this.get();o&&isSpan(o)&&o.currentText== +"";)if(window.opera&&(o.previousSibling==null||isBR(o.previousSibling))&&(o.nextSibling==null||isBR(o.nextSibling))){this.next();o=this.get()}else{var v=o;this.remove();o=this.get();select.snapshotMove(v.firstChild,o&&(o.firstChild||o),0)}return o}},q=false,y=true,x=0;forEach(r,function(o){var v=s.getNonEmpty();if(o.value=="\n"){if(!isBR(v))throw"Parser out of sync. Expected BR.";if(v.dirty||!v.indentation)q=true;c(a);a=v;v.parserFromHere=r.copy();v.indentation=o.indentation||alwaysZero;v.dirty=false; +if(j==null&&v==e)throw StopIteration;if(j!=null&&(new Date).getTime()>=j||!q&&!y&&x>1&&!b)throw StopIteration;y=q;q=false;x=0;s.next()}else{if(!isSpan(v))throw"Parser out of sync. Expected SPAN.";if(v.dirty)q=true;x++;if(!v.reduced&&v.currentText==o.value&&v.className==o.style){i&&v.dirty&&i(v,o,d);v.dirty=false;s.next()}else{q=true;var z=makePartSpan(o.value);z.className=o.style;g.insertBefore(z,v);i&&i(z,o,d);o=o.value.length;for(var B=0;o>0;){v=s.get();var A=v.currentText.length;select.snapshotReplaceNode(v.firstChild, +z.firstChild,o,B);if(A>o){v=v;v.currentText=v.currentText.substring(o);v.reduced=true;o=0}else{o-=A;B+=A;s.remove()}}}}});c(a);webkitLastLineHack(this.container);return{node:s.getNonEmpty(),dirty:q}}};return u}();addEventHandler(window,"load",function(){var h=window.frameElement.CodeMirror;h.editor=new Editor(h.options);this.parent.setTimeout(method(h,"init"),0)});function tokenizer(h,m){function k(n){return n!="\n"&&/^[\s\u00a0]*$/.test(n)}var l={state:m,take:function(n){if(typeof n=="string")n={style:n,type:n};n.content=(n.content||"")+h.get();/\n$/.test(n.content)||h.nextWhile(k);n.value=n.content+h.get();return n},next:function(){if(!h.more())throw StopIteration;var n;if(h.equals("\n")){h.next();return this.take("whitespace")}if(h.applies(k))n="whitespace";else for(;!n;)n=this.state(h,function(t){l.state=t});return this.take(n)}};return l};var tokenizeGroovy=function(){function h(c,g){for(var d=false,i;!c.endOfLine();){i=c.next();if(i==g&&!d)return false;d=!d&&i=="\\"}return d}function m(c,g){return function(d,i){var j=c,p=k(c,g,d,function(s){j=s}),r=p.type=="operator"||p.type=="javaKeywordC"||p.type=="groovyKeywordC"||p.type.match(/^[\[{}\(,;:]$/);if(r!=g||j!=c)i(m(j,r));return p}}function k(c,g,d,i){function j(){i(null);d.nextWhileMatches(a);var o=d.get(),v=n.hasOwnProperty(o)&&n.propertyIsEnumerable(o)&&n[o];return v?{type:v.type, +style:v.style,content:o}:{type:"variable",style:"groovyVariable",content:o}}function p(){d.nextWhileMatches(e);return{type:"variable",style:"groovyVariable",content:d.get()}}function r(o){var v="/*";for(o=o=="*";;){if(d.endOfLine())break;var z=d.next();if(z=="/"&&o){v=null;break}o=z=="*"}i(v);return{type:"comment",style:"groovyComment"}}function s(){if(x=="=")i("=");else x=="~"?i("~"):i(null);return{type:"operator",style:"groovyOperator"}}function q(o){var v=o;if(d.endOfLine())v=null;else{var z=d.next(); +if(o!="'"&&z=="$"&&!d.equals(" ")){d.next();return p()}if(z=="\\"&&d.equals(o)){v="\\"+o;d.next()}else if(z==o)v=null}i(v);return{type:"string",style:"groovyString"}}function y(o){if(d.lookAhead(o,true)){i(null);return{type:"string",style:"groovyString"}}var v=d.next();if(o=='"""'&&v=="$"&&!d.equals(" ")){d.next();return p()}return{type:"string",style:"groovyString"}}if(c=='\\"'||c=="\\'"||c=="\\/"){i(c[1]);return{type:"string",style:"groovyString"}}if(f.test(c))return q(c);if(c=="'''"||c=='"""')return y(c); +if(d.lookAhead(delimeter="'''",true)||d.lookAhead(delimeter='"""',true)){i(delimeter);return{type:"string",style:"groovyString"}}var x=d.next();if(c=="/*")return r(x);else if(x=="'"||x=='"'){i(x);return{type:"string",style:"groovyString"}}else if(x=="."&&d.equals(".")){d.next();return{type:"..",style:"groovyOperator"}}else if(b.test(x))return{type:x,style:"groovyPunctuation"};else if(x=="0"&&(d.equals("x")||d.equals("X"))){i(null);d.next();d.nextWhileMatches(w);return{type:"number",style:"groovyNumber"}}else if(u.test(x)){i(null); +d.nextWhileMatches(u);if(d.equals(".")){d.next();d.equals(".")&&d.next();d.nextWhileMatches(u)}if(d.equals("e")||d.equals("E")){d.next();d.equals("-")&&d.next();d.nextWhileMatches(u)}return{type:"number",style:"groovyNumber"}}else if(x=="@"){d.nextWhileMatches(a);return{type:"annotation",style:"javaAnnotation",content:d.get()}}else if(x=="/")if(d.equals("*")){d.next();return r(x)}else if(d.equals("/")){h(d,null);return{type:"comment",style:"groovyComment"}}else{if(c=="="||c=="~"){h(d,"/");c={type:"regexp", +style:"groovyReg... [truncated message content] |