puffer_pages 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +41 -51
- data/VERSION +1 -1
- data/app/assets/javascripts/puffer/codemirror.js +2197 -0
- data/app/assets/javascripts/puffer/codemirror/css.js +124 -0
- data/app/assets/javascripts/puffer/codemirror/htmlmixed.js +84 -0
- data/app/assets/javascripts/puffer/codemirror/javascript.js +352 -0
- data/app/assets/javascripts/puffer/codemirror/xml.js +231 -0
- data/app/assets/javascripts/puffer/overlay.js +51 -0
- data/app/assets/javascripts/{puffer_pages → puffer}/puffer_pages.js +21 -11
- data/app/assets/javascripts/{puffer_pages → puffer}/right-tabs-src.js +0 -0
- data/app/assets/stylesheets/puffer/codemirror.css +68 -0
- data/app/assets/stylesheets/puffer/codemirror/cobalt.css +17 -0
- data/app/assets/stylesheets/puffer/codemirror/default.css +19 -0
- data/app/assets/stylesheets/puffer/codemirror/eclipse.css +24 -0
- data/app/assets/stylesheets/puffer/codemirror/elegant.css +9 -0
- data/app/assets/stylesheets/puffer/codemirror/neat.css +8 -0
- data/app/assets/stylesheets/puffer/codemirror/night.css +20 -0
- data/app/assets/stylesheets/puffer/puffer_pages.css +7 -0
- data/app/components/page_parts/form.html.erb +7 -6
- data/app/controllers/puffer_pages/layouts_base.rb +1 -2
- data/app/controllers/puffer_pages/pages_base.rb +1 -2
- data/app/controllers/puffer_pages/snippets_base.rb +1 -2
- data/puffer_pages.gemspec +18 -12
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/config/environments/development.rb +3 -0
- data/spec/dummy/db/schema.rb +1 -0
- metadata +51 -45
- data/app/assets/javascripts/puffer_pages/application.js +0 -3
- data/app/assets/javascripts/puffer_pages/codemirror-base.js +0 -1
- data/app/assets/javascripts/puffer_pages/codemirror-parser.js +0 -1
- data/app/assets/javascripts/puffer_pages/codemirror.js +0 -1
- data/app/assets/stylesheets/puffer_pages/application.css +0 -3
- data/app/assets/stylesheets/puffer_pages/codemirror.css +0 -135
- data/app/assets/stylesheets/puffer_pages/puffer_pages.css +0 -12
- data/app/views/layouts/puffer_pages.html.erb +0 -9
@@ -1 +0,0 @@
|
|
1
|
-
function tokenizer(a,b){function c(a){return a!="\n"&&/^[\s\u00a0]*$/.test(a)}var d={state:b,take:function(b){typeof b=="string"&&(b={style:b,type:b}),b.content=(b.content||"")+a.get(),/\n$/.test(b.content)||a.nextWhile(c),b.value=b.content+a.get();return b},next:function(){if(!a.more())throw StopIteration;var b;if(a.equals("\n")){a.next();return this.take("whitespace")}if(a.applies(c))b="whitespace";else while(!b)b=this.state(a,function(a){d.state=a});return this.take(b)}};return d}function asEditorLines(a){var b=makeWhiteSpace(indentUnit);return map(a.replace(/\t/g,b).replace(/\u00a0/g," ").replace(/\r\n?/g,"\n").split("\n"),fixSpaces)}function alwaysZero(){return 0}function makePartSpan(a){var b=a;a.nodeType==3?b=a.nodeValue:a=document.createTextNode(b);var c=document.createElement("span");c.isPart=!0,c.appendChild(a),c.currentText=b;return c}function cleanText(a){return a.replace(/\u00a0/g," ").replace(/\u200b/g,"")}function fixSpaces(a){a.charAt(0)==" "&&(a=nbsp+a.slice(1));return a.replace(/\t/g,function(){return makeWhiteSpace(indentUnit)}).replace(/[ \u00a0]{2,}/g,function(a){return makeWhiteSpace(a.length)})}function makeWhiteSpace(a){var b=[],c=!0;for(;a>0;a--)b.push(c||a==1?nbsp:" "),c^=!0;return b.join("")}function UndoHistory(a,b,c,d){this.container=a,this.maxDepth=b,this.commitDelay=c,this.editor=d;var e={text:"",from:null,to:null};this.first=e,this.last=e,this.firstTouched=!1,this.history=[],this.redoHistory=[],this.touched=[],this.lostundo=0}function isSpan(a){var b=a.nodeName;return b=="SPAN"||b=="span"}function isBR(a){var b=a.nodeName;return b=="BR"||b=="br"}function nodeTop(a){var b=0;while(a.offsetParent)b+=a.offsetTop,a=a.offsetParent;return b}function nodeText(a){return a.textContent||a.innerText||a.nodeValue||""}function addEventHandler(a,b,c,d){function e(a){c(normalizeEvent(a||window.event))}if(typeof a.addEventListener=="function"){a.addEventListener(b,e,!1);if(d)return function(){a.removeEventListener(b,e,!1)}}else{a.attachEvent("on"+b,e);if(d)return function(){a.detachEvent("on"+b,e)}}}function normalizeEvent(a){a.stopPropagation||(a.stopPropagation=function(){this.cancelBubble=!0},a.preventDefault=function(){this.returnValue=!1}),a.stop||(a.stop=function(){this.stopPropagation(),this.preventDefault()}),a.type=="keypress"&&(a.code=a.charCode==null?a.keyCode:a.charCode,a.character=String.fromCharCode(a.code));return a}function isAncestor(a,b){while(b=b.parentNode)if(a==b)return!0;return!1}function clearElement(a){while(a.firstChild)a.removeChild(a.firstChild)}function removeElement(a){a.parentNode&&a.parentNode.removeChild(a)}function insertAfter(a,b){var c=b.parentNode;c.insertBefore(a,b.nextSibling);return a}function removeClass(a,b){a.className=a.className.replace(new RegExp(" "+b+"\\b","g"),"");return a}function hasClass(a,b){var c=a.className;return c&&(new RegExp("(^| )"+b+"($| )")).test(c)}function matcher(a){return function(b){return a.test(b)}}function map(a,b){var c=[];forEach(a,function(a){c.push(b(a))});return c}function forEach(a,b){if(a.next)try{for(;;)b(a.next())}catch(c){if(c!=StopIteration)throw c}else for(var d=0;d<a.length;d++)b(a[d])}function method(a,b){return function(){a[b].apply(a,arguments)}}var StopIteration={toString:function(){return"StopIteration"}},nbsp=" ",matching={"{":"}","[":"]","(":")","}":"{","]":"[",")":"("},stringStream=function(a){function e(){while(c==b.length){d+=b,b="",c=0;try{b=a.next()}catch(e){if(e!=StopIteration)throw e;return!1}}return!0}var b="",c=0,d="";return{peek:function(){if(!e())return null;return b.charAt(c)},next:function(){if(!e())throw d.length>0?"End of stringstream reached without emptying buffer ('"+d+"').":StopIteration;return b.charAt(c++)},get:function(){var a=d;d="",c>0&&(a+=b.slice(0,c),b=b.slice(c),c=0);return a},push:function(a){b=b.slice(0,c)+a+b.slice(c)},lookAhead:function(e,f,g,h){function i(a){return h?a.toLowerCase():a}e=i(e);var j=!1,k=d,l=c;g&&this.nextWhileMatches(/[\s\u00a0]/);for(;;){var m=c+e.length,n=b.length-c;if(m<=b.length){j=e==i(b.slice(c,m)),c=m;break}if(e.slice(0,n)!=i(b.slice(c)))break;d+=b,b="";try{b=a.next()}catch(o){if(o!=StopIteration)throw o;break}c=0,e=e.slice(n)}if(!j||!f)b=d.slice(k.length)+b,c=l,d=k;return j},lookAheadRegex:function(d,e){if(d.source.charAt(0)!="^")throw new Error("Regexps passed to lookAheadRegex must start with ^");while(b.indexOf("\n",c)==-1)try{b+=a.next()}catch(f){if(f!=StopIteration)throw f;break}var g=b.slice(c).match(d);g&&e&&(c+=g[0].length);return g},more:function(){return this.peek()!==null},applies:function(a){var b=this.peek();return b!==null&&a(b)},nextWhile:function(a){var b;while((b=this.peek())!==null&&a(b))this.next()},matches:function(a){var b=this.peek();return b!==null&&a.test(b)},nextWhileMatches:function(a){var b;while((b=this.peek())!==null&&a.test(b))this.next()},equals:function(a){return a===this.peek()},endOfLine:function(){var a=this.peek();return a==null||a=="\n"}}},select={};(function(){function e(a){var b=a.nextSibling;if(b){while(b.firstChild)b=b.firstChild;return b.nodeType==3||isBR(b)?b:e(b)}var c=a.parentNode;while(c&&!c.nextSibling)c=c.parentNode;return c&&e(c)}function b(b,c){while(!b.previousSibling&&b.parentNode!=c)b=b.parentNode;return a(b.previousSibling,c)}function a(a,b){while(a&&a.parentNode!=b)a=a.parentNode;return a}select.ie_selection=document.selection&&document.selection.createRangeCollection;var c=" ";select.scrollToNode=function(a,b){if(!!a){var c=a,d=document.body,e=document.documentElement,f=!c.nextSibling||!c.nextSibling.nextSibling||!c.nextSibling.nextSibling.nextSibling,g=0;while(c&&!c.offsetTop)g++,c=c.previousSibling;g==0&&(f=!1);if(webkit&&c&&c.offsetTop==5&&c.offsetLeft==5)return;var h=g*(c?c.offsetHeight:0),i=0,j=a?a.offsetWidth:0,k=c;while(k&&k.offsetParent)h+=k.offsetTop,isBR(k)||(i+=k.offsetLeft),k=k.offsetParent;var l=d.scrollLeft||e.scrollLeft||0,m=d.scrollTop||e.scrollTop||0,n=!1,o=window.innerWidth||e.clientWidth||0;if(b||j<o){if(b){var p=select.offsetInNode(a),q=nodeText(a).length;q&&(i+=j*(p/q))}var r=i-l;if(r<0||r>o)l=i,n=!0}var s=h-m;if(s<0||f||s>(window.innerHeight||e.clientHeight||0)-50)m=f?1e6:h,n=!0;n&&window.scrollTo(l,m)}},select.scrollToCursor=function(a){select.scrollToNode(select.selectionTopNode(a,!0)||a.firstChild,!0)};var d=null;select.snapshotChanged=function(){d&&(d.changed=!0)},select.snapshotReplaceNode=function(a,b,c,f){function g(g){a==g.node?(d.changed=!0,c&&g.offset>c?g.offset-=c:(g.node=b,g.offset+=f||0)):select.ie_selection&&g.offset==0&&g.node==e(a)&&(d.changed=!0)}!d||(g(d.start),g(d.end))},select.snapshotMove=function(a,b,c,e,f){function g(g){a==g.node&&(!f||g.offset==0)&&(d.changed=!0,g.node=b,e?g.offset=Math.max(0,g.offset+c):g.offset=c)}!d||(g(d.start),g(d.end))};if(select.ie_selection){function f(){var a=document.selection;if(!a)return null;return a.createRange?a.createRange():a.createTextRange()}function g(a){function d(a){while(a&&a.firstChild)a=a.firstChild;return{node:a,offset:0}}function c(a){var b=null;while(!b&&a)b=a.nextSibling,a=a.parentNode;return d(b)}var b=f();b.collapse(a);var e=b.parentElement();if(!isAncestor(document.body,e))return null;if(!e.firstChild)return d(e);var g=b.duplicate();g.moveToElementText(e),g.collapse(!0);for(var h=e.firstChild;h;h=h.nextSibling){if(h.nodeType==3){var i=h.nodeValue.length;g.move("character",i)}else g.moveToElementText(h),g.collapse(!1);var j=b.compareEndPoints("StartToStart",g);if(j==0)return c(h);if(j==1)continue;if(h.nodeType!=3)return d(h);g.setEndPoint("StartToEnd",b);return{node:h,offset:i-g.text.length}}return c(e)}select.markSelection=function(){d=null;var a=document.selection;if(!!a){var b=g(!0),c=g(!1);if(!b||!c)return;d={start:b,end:c,changed:!1}}},select.selectMarked=function(){function a(a){var b=document.body.createTextRange(),c=a.node;if(!c)b.moveToElementText(document.body),b.collapse(!1);else if(c.nodeType==3){b.moveToElementText(c.parentNode);var d=a.offset;while(c.previousSibling)c=c.previousSibling,d+=(c.innerText||"").length;b.move("character",d)}else b.moveToElementText(c),b.collapse(!0);return b}if(!!d&&!!d.changed){var b=a(d.start),c=a(d.end);b.setEndPoint("StartToEnd",c),b.select()}},select.offsetInNode=function(a){var b=f();if(!b)return 0;var c=b.duplicate();try{c.moveToElementText(a)}catch(d){return 0}b.setEndPoint("StartToStart",c);return b.text.length},select.selectionTopNode=function(b,c){function h(a,b){if(b.nodeType==3){var c=0,d=b.previousSibling;while(d&&d.nodeType==3)c+=d.nodeValue.length,d=d.previousSibling;if(d){try{a.moveToElementText(d)}catch(e){return!1}a.collapse(!1)}else a.moveToElementText(b.parentNode);c&&a.move("character",c)}else try{a.moveToElementText(b)}catch(e){return!1}return!0}var d=f();if(!d)return!1;var e=d.duplicate();d.collapse(c);var g=d.parentElement();if(g&&isAncestor(b,g)){e.moveToElementText(g);if(d.compareEndPoints("StartToStart",e)==1)return a(g,b)}var c=0,i=b.childNodes.length-1;while(c<i){var j=Math.ceil((i+c)/2),k=b.childNodes[j];if(!k)return!1;if(!h(e,k))return!1;d.compareEndPoints("StartToStart",e)==1?c=j:i=j-1}if(c==0){var l=f(),m=l.duplicate();try{m.moveToElementText(b)}catch(n){return null}if(l.compareEndPoints("StartToStart",m)==0)return null}return b.childNodes[c]||null},select.focusAfterNode=function(a,b){var c=document.body.createTextRange();c.moveToElementText(a||b),c.collapse(!a),c.select()},select.somethingSelected=function(){var a=f();return a&&a.text!=""};function h(a){var b=f();b&&(b.pasteHTML(a),b.collapse(!1),b.select())}select.insertNewlineAtCursor=function(){h("<br>")},select.insertTabAtCursor=function(){h(c)},select.cursorPos=function(a,b){var c=f();if(!c)return null;var d=select.selectionTopNode(a,b);while(d&&!isBR(d))d=d.previousSibling;var e=c.duplicate();c.collapse(b);if(d)e.moveToElementText(d),e.collapse(!1);else{try{e.moveToElementText(a)}catch(g){return null}e.collapse(!0)}c.setEndPoint("StartToStart",e);return{node:d,offset:c.text.length}},select.setCursorPos=function(a,b,c){function d(b){var c=document.body.createTextRange();b.node?(c.moveToElementText(b.node),c.collapse(!1)):(c.moveToElementText(a),c.collapse(!0)),c.move("character",b.offset);return c}var e=d(b);c&&c!=b&&e.setEndPoint("EndToEnd",d(c)),e.select()},select.getBookmark=function(a){var b=select.cursorPos(a,!0),c=select.cursorPos(a,!1);if(b&&c)return{from:b,to:c}},select.setBookmark=function(a,b){!b||select.setCursorPos(a,b.from,b.to)}}else{function i(a,b){while(a.nodeType!=3&&!isBR(a)){var c=a.childNodes[b]||a.nextSibling;b=0;while(!c&&a.parentNode)a=a.parentNode,c=a.nextSibling;a=c;if(!c)break}return{node:a,offset:b}}select.markSelection=function(){var a=window.getSelection();if(!a||a.rangeCount==0)return d=null;var b=a.getRangeAt(0);d={start:i(b.startContainer,b.startOffset),end:i(b.endContainer,b.endOffset),changed:!1}},select.selectMarked=function(){function e(a,b){a.node?a.offset==0?c["set"+b+"Before"](a.node):c["set"+b](a.node,a.offset):c.setStartAfter(document.body.lastChild||document.body)}function b(){if(a.start.node==a.end.node&&a.start.offset==a.end.offset){var b=window.getSelection();if(!b||b.rangeCount==0)return!0;var c=b.getRangeAt(0),d=i(c.startContainer,c.startOffset);return a.start.node!=d.node||a.start.offset!=d.offset}}var a=d;if(!!a&&!!(a.changed||webkit&&b())){var c=document.createRange();e(a.end,"End"),e(a.start,"Start"),j(c)}};function j(a){var b=window.getSelection();!b||(b.removeAllRanges(),b.addRange(a))}function k(){var a=window.getSelection();return!a||a.rangeCount==0?!1:a.getRangeAt(0)}select.selectionTopNode=function(c,d){var e=k();if(!e)return!1;var f=d?e.startContainer:e.endContainer,g=d?e.startOffset:e.endOffset;window.opera&&!d&&e.endContainer==c&&e.endOffset==e.startOffset+1&&c.childNodes[e.startOffset]&&isBR(c.childNodes[e.startOffset])&&g--;return f.nodeType==3?g>0?a(f,c):b(f,c):f.nodeName.toUpperCase()=="HTML"?g==1?null:c.lastChild:f==c?g==0?null:f.childNodes[g-1]:g==f.childNodes.length?a(f,c):g==0?b(f,c):a(f.childNodes[g-1],c)},select.focusAfterNode=function(a,b){var c=document.createRange();c.setStartBefore(b.firstChild||b),a&&!a.firstChild?c.setEndAfter(a):a?c.setEnd(a,a.childNodes.length):c.setEndBefore(b.firstChild||b),c.collapse(!1),j(c)},select.somethingSelected=function(){var a=k();return a&&!a.collapsed},select.offsetInNode=function(a){var b=k();if(!b)return 0;b=b.cloneRange(),b.setStartBefore(a);return b.toString().length},select.insertNodeAtCursor=function(a){var b=k();if(!!b){b.deleteContents(),b.insertNode(a),webkitLastLineHack(document.body);if(window.opera&&isBR(a)&&isSpan(a.parentNode)){var c=a.nextSibling,d=a.parentNode,e=d.parentNode;e.insertBefore(a,d.nextSibling);var f="";for(;c&&c.nodeType==3;c=c.nextSibling)f+=c.nodeValue,removeElement(c);e.insertBefore(makePartSpan(f,document),a.nextSibling)}b=document.createRange(),b.selectNode(a),b.collapse(!1),j(b)}},select.insertNewlineAtCursor=function(){select.insertNodeAtCursor(document.createElement("BR"))},select.insertTabAtCursor=function(){select.insertNodeAtCursor(document.createTextNode(c))},select.cursorPos=function(a,b){var c=k();if(!!c){var d=select.selectionTopNode(a,b);while(d&&!isBR(d))d=d.previousSibling;c=c.cloneRange(),c.collapse(b),d?c.setStartAfter(d):c.setStartBefore(a);var e=c.toString();return{node:d,offset:e.length}}},select.setCursorPos=function(a,b,c){function e(b,c,e){function g(a){a.nodeType==3?f.push(a):forEach(a.childNodes,g)}if(c==0&&b&&!b.nextSibling){d["set"+e+"After"](b);return!0}b?b=b.nextSibling:b=a.firstChild;if(!!b){if(c==0){d["set"+e+"Before"](b);return!0}var f=[];for(;;){while(b&&!f.length)g(b),b=b.nextSibling;var h=f.shift();if(!h)return!1;var i=h.nodeValue.length;if(i>=c){d["set"+e](h,c);return!0}c-=i}}}var d=document.createRange();c=c||b,e(c.node,c.offset,"End")&&e(b.node,b.offset,"Start")&&j(d)}}})(),UndoHistory.prototype={scheduleCommit:function(){var a=this;parent.clearTimeout(this.commitTimeout),this.commitTimeout=parent.setTimeout(function(){a.tryCommit()},this.commitDelay)},touch:function(a){this.setTouched(a),this.scheduleCommit()},undo:function(){this.commit();if(this.history.length){var a=this.history.pop();this.redoHistory.push(this.updateTo(a,"applyChain")),this.notifyEnvironment();return this.chainNode(a)}},redo:function(){this.commit();if(this.redoHistory.length){var a=this.redoHistory.pop();this.addUndoLevel(this.updateTo(a,"applyChain")),this.notifyEnvironment();return this.chainNode(a)}},clear:function(){this.history=[],this.redoHistory=[],this.lostundo=0},historySize:function(){return{undo:this.history.length,redo:this.redoHistory.length,lostundo:this.lostundo}},push:function(a,b,c){var d=[];for(var e=0;e<c.length;e++){var f=e==c.length-1?b:document.createElement("br");d.push({from:a,to:f,text:cleanText(c[e])}),a=f}this.pushChains([d],a==null&&b==null),this.notifyEnvironment()},pushChains:function(a,b){this.commit(b),this.addUndoLevel(this.updateTo(a,"applyChain")),this.redoHistory=[]},chainNode:function(a){for(var b=0;b<a.length;b++){var c=a[b][0],d=c&&(c.from||c.to);if(d)return d}},reset:function(){this.history=[],this.redoHistory=[],this.lostundo=0},textAfter:function(a){return this.after(a).text},nodeAfter:function(a){return this.after(a).to},nodeBefore:function(a){return this.before(a).from},tryCommit:function(){!window||!window.parent||!window.UndoHistory||(this.editor.highlightDirty()?this.commit(!0):this.scheduleCommit())},commit:function(a){parent.clearTimeout(this.commitTimeout),a||this.editor.highlightDirty(!0);var b=this.touchedChains(),c=this;b.length&&(this.addUndoLevel(this.updateTo(b,"linkChain")),this.redoHistory=[],this.notifyEnvironment())},updateTo:function(a,b){var c=[],d=[];for(var e=0;e<a.length;e++)c.push(this.shadowChain(a[e])),d.push(this[b](a[e]));b=="applyChain"&&this.notifyDirty(d);return c},notifyDirty:function(a){forEach(a,method(this.editor,"addDirtyNode")),this.editor.scheduleHighlight()},notifyEnvironment:function(){this.onChange&&this.onChange(this.editor),window.frameElement&&window.frameElement.CodeMirror.updateNumbers&&window.frameElement.CodeMirror.updateNumbers()},linkChain:function(a){for(var b=0;b<a.length;b++){var c=a[b];c.from?c.from.historyAfter=c:this.first=c,c.to?c.to.historyBefore=c:this.last=c}},after:function(a){return a?a.historyAfter:this.first},before:function(a){return a?a.historyBefore:this.last},setTouched:function(a){a?a.historyTouched||(this.touched.push(a),a.historyTouched=!0):this.firstTouched=!0},addUndoLevel:function(a){this.history.push(a),this.history.length>this.maxDepth&&(this.history.shift(),this.lostundo+=1)},touchedChains:function(){function g(a,b){var c=b+"Sibling",d=a[c];while(d&&!isBR(d))d=d[c];return d}function e(b){var c=[];for(var d=b?b.nextSibling:a.container.firstChild;d&&(!isBR(d)||d.hackBR);d=d.nextSibling)!d.hackBR&&d.currentText&&c.push(d.currentText);return{from:b,to:d,text:cleanText(c.join(""))}}function d(a,c){a?a.historyTemp=c:b=c}function c(a){return a?a.historyTemp:b}var a=this,b=null,f=[];a.firstTouched&&a.touched.push(null),forEach(a.touched,function(b){if(!b||b.parentNode==a.container&&!b.hackBR){b?b.historyTouched=!1:a.firstTouched=!1;var c=e(b),g=a.after(b);if(!g||g.text!=c.text||g.to!=c.to)f.push(c),d(b,c)}});var h=[];a.touched=[],forEach(f,function(b){if(!!c(b.from)){var f=[],i=b.from,j=!0;for(;;){var k=c(i);if(!k){if(j)break;k=e(i)}f.unshift(k),d(i,null);if(!i)break;j=a.after(i),i=g(i,"previous")}i=b.to,j=a.before(b.from);for(;;){if(!i)break;var k=c(i);if(!k){if(j)break;k=e(i)}f.push(k),d(i,null),j=a.before(i),i=g(i,"next")}h.push(f)}});return h},shadowChain:function(a){var b=[],c=this.after(a[0].from),d=a[a.length-1].to;for(;;){b.push(c);var e=c.to;if(!e||e==d)break;c=e.historyAfter||this.before(d)}return b},applyChain:function(a){function d(a,b){var d=a?a.nextSibling:c.container.firstChild;while(d!=b){var e=d.nextSibling;removeElement(d),d=e}}var b=select.cursorPos(this.container,!1),c=this,e=a[0].from,f=a[a.length-1].to;d(e,f);for(var g=0;g<a.length;g++){var h=a[g];g>0&&c.container.insertBefore(h.from,f);var i=makePartSpan(fixSpaces(h.text));c.container.insertBefore(i,f);if(b&&b.node==h.from){var j=0,k=this.after(h.from);if(k&&g==a.length-1){for(var l=0;l<b.offset&&h.text.charAt(l)==k.text.charAt(l);l++);b.offset>l&&(j=h.text.length-k.text.length)}select.setCursorPos(this.container,{node:h.from,offset:Math.max(0,b.offset+j)})}else b&&g==a.length-1&&b.node&&b.node.parentNode!=this.container&&select.setCursorPos(this.container,{node:h.from,offset:h.text.length})}this.linkChain(a);return e}};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);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),webkitLastLineHack=webkit?function(a){var b=a.lastChild;if(!b||!b.hackBR){var c=document.createElement("br");c.hackBR=!0,a.appendChild(c)}}:function(){},Editor=function(){function j(a){return a>=16&&a<=18||a>=33&&a<=40}function i(a){this.options=a,window.indentUnit=a.indentUnit;var b=this.container=document.body;this.history=new UndoHistory(b,a.undoDepth,a.undoDelay,this);var c=this;if(!i.Parser)throw"No parser loaded.";a.parserConfig&&i.Parser.configure&&i.Parser.configure(a.parserConfig),!a.readOnly&&!internetExplorer&&select.setCursorPos(b,{node:null,offset:0}),this.dirty=[],this.importCode(a.content||""),this.history.onChange=a.onChange;if(!a.readOnly){a.continuousScanning!==!1&&(this.scanner=this.documentScanner(a.passTime),this.delayScanning());function d(){document.body.contentEditable!=undefined&&internetExplorer?document.body.contentEditable="true":document.designMode="on",internetExplorer&&a.height!="dynamic"&&(document.body.style.minHeight=window.frameElement.clientHeight-2*document.body.offsetTop-5+"px"),document.documentElement.style.borderWidth="0",a.textWrapping||(b.style.whiteSpace="nowrap")}try{d()}catch(e){var f=addEventHandler(document,"focus",function(){f(),d()},!0)}addEventHandler(document,"keydown",method(this,"keyDown")),addEventHandler(document,"keypress",method(this,"keyPress")),addEventHandler(document,"keyup",method(this,"keyUp"));function g(){c.cursorActivity(!1)}addEventHandler(internetExplorer?document.body:window,"mouseup",g),addEventHandler(document.body,"cut",g),gecko&&addEventHandler(window,"pagehide",function(){c.unloaded=!0}),addEventHandler(document.body,"paste",function(a){g();var b=null;try{var d=a.clipboardData||window.clipboardData;d&&(b=d.getData("Text"))}catch(e){}b!==null&&(a.stop(),c.replaceSelection(b),select.scrollToCursor(c.container))}),this.options.autoMatchParens&&addEventHandler(document.body,"click",method(this,"scheduleParenHighlight"))}else a.textWrapping||(b.style.whiteSpace="nowrap")}function h(a,b,c,d){function e(b){var c=cleanText(a.history.textAfter(b));return d?c.toLowerCase():c}this.editor=a,this.history=a.history,this.history.commit(),this.valid=!!b,this.atOccurrence=!1,d==undefined&&(d=typeof b=="string"&&b==b.toLowerCase());var f={node:null,offset:0},g=this;if(c&&typeof c=="object"&&typeof c.character=="number"){a.checkLine(c.line);var h={node:c.line,offset:c.character};this.pos={from:h,to:h}}else c?this.pos={from:select.cursorPos(a.container,!0)||f,to:select.cursorPos(a.container,!1)||f}:this.pos={from:f,to:f};if(typeof b!="string")this.matches=function(a,c,d){if(a){var f=e(c).slice(0,d),h=f.match(b),i=0;while(h){var j=f.indexOf(h[0]);i+=j,f=f.slice(j+1);var k=f.match(b);if(k)h=k;else break}}else var f=e(c).slice(d),h=f.match(b),i=h&&d+f.indexOf(h[0]);if(h){g.currentMatch=h;return{from:{node:c,offset:i},to:{node:c,offset:i+h[0].length}}}};else{d&&(b=b.toLowerCase());var i=b.split("\n");this.matches=i.length==1?function(a,c,d){var f=e(c),g=b.length,h;if(a?d>=g&&(h=f.lastIndexOf(b,d-g))!=-1:(h=f.indexOf(b,d))!=-1)return{from:{node:c,offset:h},to:{node:c,offset:h+g}}}:function(a,b,c){var d=a?i.length-1:0,f=i[d],g=e(b),h=a?g.indexOf(f)+f.length:g.lastIndexOf(f);if(!(a?h>=c||h!=f.length:h<=c||h!=g.length-f.length)){var j=b;for(;;){if(a&&!j)return;j=a?this.history.nodeBefore(j):this.history.nodeAfter(j);if(!a&&!j)return;g=e(j),f=i[a?--d:++d];if(d>0&&d<i.length-1){if(g!=f)return;continue}var k=a?g.lastIndexOf(f):g.indexOf(f)+f.length;if(a?k!=g.length-f.length:k!=f.length)return;return{from:{node:a?j:b,offset:a?k:h},to:{node:a?b:j,offset:a?h:k}}}}}}}function g(){return(new Date).getTime()}function f(a,b){a?isBR(a)&&(a=a.nextSibling):a=b.firstChild;while(a&&!isBR(a))a=a.nextSibling;return a}function e(a){while(a&&!isBR(a))a=a.previousSibling;return a}function d(a){return isBR(a)?1:a.currentText.length}function c(a){function j(){if(!a)throw StopIteration;var b=a;a=b.nextSibling;if(i(b)){c.push(b),f=!1;return b.currentText}if(isBR(b)){f&&window.opera&&b.parentNode.insertBefore(makePartSpan(""),b),c.push(b),f=!0;return"\n"}var g=!b.nextSibling;e=d(b),removeElement(b);return h(b,g)}function i(a){if(a.isPart&&a.childNodes.length==1&&a.firstChild.nodeType==3){var b=a.firstChild.nodeValue;a.dirty=a.dirty||b!=a.currentText,a.currentText=b;return!/[\n\t\r]/.test(a.currentText)}return!1}function h(a,c){var d=b(a,c);for(var e=0;e<d.length;e++)d[e]=g(d[e]);return d.join("")}function g(a){var b="\n";a.nodeType==3?(select.snapshotChanged(),a=makePartSpan(a),b=a.currentText,f=!1):(f&&window.opera&&e(makePartSpan("")),f=!0),a.dirty=!0,c.push(a),e(a);return b}function d(a){var b=a.parentNode,c=a.nextSibling;return function(a){b.insertBefore(a,c)}}var c=[],e=null,f=!0;return{next:j,nodes:c}}function b(b,c){function f(b,g){if(b.nodeType==3){var h=b.nodeValue=fixSpaces(b.nodeValue.replace(/[\r\u200b]/g,"").replace(/\n/g," "));h.length&&(e=!1),d.push(b)}else if(isBR(b)&&b.childNodes.length==0)e=!0,d.push(b);else{for(var i=b.firstChild;i;i=i.nextSibling)f(i);!e&&a.hasOwnProperty(b.nodeName.toUpperCase())&&(e=!0,(!c||!g)&&d.push(document.createElement("br")))}}var d=[],e=!0;f(b,!0);return d}var a={P:!0,DIV:!0,LI:!0};h.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function f(){var a={node:d,offset:e};b.pos={from:a,to:a},b.atOccurrence=!1;return!1}if(!this.valid)return!1;var b=this,c=a?this.pos.from:this.pos.to,d=c.node,e=c.offset;d&&!d.parentNode&&(d=null,e=0);for(;;){if(this.pos=this.matches(a,d,e)){this.atOccurrence=!0;return!0}if(a){if(!d)return f();d=this.history.nodeBefore(d),e=this.history.textAfter(d).length}else{var g=this.history.nodeAfter(d);if(!g){e=this.history.textAfter(d).length;return f()}d=g,e=0}}},select:function(){this.atOccurrence&&(select.setCursorPos(this.editor.container,this.pos.from,this.pos.to),select.scrollToCursor(this.editor.container))},replace:function(a){if(this.atOccurrence){var b=this.currentMatch;b&&(a=a.replace(/\\(\d)/,function(a,c){return b[c]}));var c=this.editor.replaceRange(this.pos.from,this.pos.to,a);this.pos.to=c,this.atOccurrence=!1}},position:function(){if(this.atOccurrence)return{line:this.pos.from.node,character:this.pos.from.offset}}},i.prototype={importCode:function(a){var b=asEditorLines(a),c=1e3;if(!this.options.incrementalLoading||b.length<c)this.history.push(null,null,b),this.history.reset();else{var d=0,e=this;function f(){var a=b.slice(d,d+c);a.push(""),e.history.push(e.history.nodeBefore(null),null,a),e.history.reset(),d+=c,d<b.length&&parent.setTimeout(f,1e3)}f()}},getCode:function(){if(!this.container.firstChild)return"";var a=[];select.markSelection(),forEach(c(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===!1||a!=null&&a.parentNode!=this.container&&!a.hackBR)throw parent.CodeMirror.InvalidLineHandle},cursorPosition:function(a){a==null&&(a=!0);var b=select.cursorPos(this.container,a);return b?{line:b.node,character:b.offset}:{line:null,character:0}},firstLine:function(){return null},lastLine:function(){var a=this.container.lastChild;a&&(a=e(a)),a&&a.hackBR&&(a=e(a.previousSibling));return a},nextLine:function(a){this.checkLine(a);var b=f(a,this.container);return!b||b.hackBR?!1:b},prevLine:function(a){this.checkLine(a);if(a==null)return!1;return e(a.previousSibling)},visibleLineCount:function(){var a=this.container.firstChild;while(a&&isBR(a))a=a.nextSibling;if(!a)return!1;var b=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;return Math.floor(b/a.offsetHeight)},selectLines:function(a,b,c,d){this.checkLine(a);var e={node:a,offset:b},f=null;d!==undefined&&(this.checkLine(c),f={node:c,offset:d}),select.setCursorPos(this.container,e,f),select.scrollToCursor(this.container)},lineContent:function(a){var b=[];for(a=a?a.nextSibling:this.container.firstChild;a&&!isBR(a);a=a.nextSibling)b.push(nodeText(a));return cleanText(b.join(""))},setLineContent:function(a,b){this.history.commit(),this.replaceRange({node:a,offset:0},{node:a,offset:this.history.textAfter(a).length},b),this.addDirtyNode(a),this.scheduleHighlight()},removeLine:function(a){var b=a?a.nextSibling:this.container.firstChild;while(b){var c=b.nextSibling;removeElement(b);if(isBR(b))break;b=c}this.addDirtyNode(a),this.scheduleHighlight()},insertIntoLine:function(a,b,c){var d=null;if(b=="end")d=f(a,this.container);else for(var e=a?a.nextSibling:this.container.firstChild;e;e=e.nextSibling){if(b==0){d=e;break}var g=nodeText(e);if(g.length>b){d=e.nextSibling,c=g.slice(0,b)+c+g.slice(b),removeElement(e);break}b-=g.length}var h=asEditorLines(c);for(var i=0;i<h.length;i++)i>0&&this.container.insertBefore(document.createElement("BR"),d),this.container.insertBefore(makePartSpan(h[i]),d);this.addDirtyNode(a),this.scheduleHighlight()},selectedText:function(){var a=this.history;a.commit();var b=select.cursorPos(this.container,!0),c=select.cursorPos(this.container,!1);if(!b||!c)return"";if(b.node==c.node)return a.textAfter(b.node).slice(b.offset,c.offset);var d=[a.textAfter(b.node).slice(b.offset)];for(var e=a.nodeAfter(b.node);e!=c.node;e=a.nodeAfter(e))d.push(a.textAfter(e));d.push(a.textAfter(c.node).slice(0,c.offset));return cleanText(d.join("\n"))},replaceSelection:function(a){this.history.commit();var b=select.cursorPos(this.container,!0),c=select.cursorPos(this.container,!1);!!b&&!!c&&(c=this.replaceRange(b,c,a),select.setCursorPos(this.container,c),webkitLastLineHack(this.container))},cursorCoords:function(a,b){function h(a,b){var c=document.createElement("SPAN");c.appendChild(document.createTextNode(a));try{return b(c)}finally{c.parentNode&&c.parentNode.removeChild(c)}}function g(a,c){var d=-(document.body.scrollTop||document.documentElement.scrollTop||0),e=-(document.body.scrollLeft||document.documentElement.scrollLeft||0)+c;forEach([a,b?null:window.frameElement],function(a){while(a)e+=a.offsetLeft,d+=a.offsetTop,a=a.offsetParent});return{x:e,y:d,yBot:d+a.offsetHeight}}var c=select.cursorPos(this.container,a);if(!c)return null;var d=c.offset,e=c.node,f=this;while(d){e=e?e.nextSibling:this.container.firstChild;var i=nodeText(e);if(d<i.length)return h(i.substr(0,d),function(a){a.style.position="absolute",a.style.visibility="hidden",a.className=e.className,f.container.appendChild(a);return g(e,a.offsetWidth)});d-=i.length}return e&&isSpan(e)?g(e,e.offsetWidth):e&&e.nextSibling&&isSpan(e.nextSibling)?g(e.nextSibling,0):h("",function(a){e?e.parentNode.insertBefore(a,e.nextSibling):f.container.insertBefore(a,f.container.firstChild);return g(a,0)})},reroutePasteEvent:function(){if(!(this.capturingPaste||window.opera||gecko&&gecko>=20101026)){this.capturingPaste=!0;var a=window.frameElement.CodeMirror.textareaHack,b=this.cursorCoords(!0,!0);a.style.top=b.y+"px";if(internetExplorer){var c=select.getBookmark(this.container);c&&(this.selectionSnapshot=c)}parent.focus(),a.value="",a.focus();var d=this;parent.setTimeout(function(){d.capturingPaste=!1,window.focus(),d.selectionSnapshot&&window.select.setBookmark(d.container,d.selectionSnapshot);var b=a.value;b&&(d.replaceSelection(b),select.scrollToCursor(d.container))},10)}},replaceRange:function(a,b,c){var d=asEditorLines(c);d[0]=this.history.textAfter(a.node).slice(0,a.offset)+d[0];var e=d[d.length-1];d[d.length-1]=e+this.history.textAfter(b.node).slice(b.offset);var f=this.history.nodeAfter(b.node);this.history.push(a.node,f,d);return{node:this.history.nodeBefore(f),offset:e.length}},getSearchCursor:function(a,b,c){return new h(this,a,b,c)},reindent:function(){this.container.firstChild&&this.indentRegion(null,this.container.lastChild)},reindentSelection:function(a){if(!select.somethingSelected())this.indentAtCursor(a);else{var b=select.selectionTopNode(this.container,!0),c=select.selectionTopNode(this.container,!1);if(b===!1||c===!1)return;this.indentRegion(b,c,a,!0)}},grabKeys:function(a,b){this.frozen=a,this.keyFilter=b},ungrabKeys:function(){this.frozen="leave"},setParser:function(a,b){i.Parser=window[a],b=b||this.options.parserConfig,b&&i.Parser.configure&&i.Parser.configure(b),this.container.firstChild&&(forEach(this.container.childNodes,function(a){a.nodeType!=3&&(a.dirty=!0)}),this.addDirtyNode(this.firstChild),this.scheduleHighlight())},keyDown:function(a){this.frozen=="leave"&&(this.frozen=null,this.keyFilter=null);if(this.frozen&&(!this.keyFilter||this.keyFilter(a.keyCode,a)))a.stop(),this.frozen(a);else{var b=a.keyCode;this.delayScanning(),this.options.autoMatchParens&&this.scheduleParenHighlight();if(b==13){if(a.ctrlKey&&!a.altKey)this.reparseBuffer();else{select.insertNewlineAtCursor();var c=this.options.enterMode;c!="flat"&&this.indentAtCursor(c=="keep"?"keep":undefined),select.scrollToCursor(this.container)}a.stop()}else if(b==9&&this.options.tabMode!="default"&&!a.ctrlKey)this.handleTab(!a.shiftKey),a.stop();else if(b==32&&a.shiftKey&&this.options.tabMode=="default")this.handleTab(!0),a.stop();else if(b==36&&!a.shiftKey&&!a.ctrlKey)this.home()&&a.stop();else if(b==35&&!a.shiftKey&&!a.ctrlKey)this.end()&&a.stop();else if(b==33&&!a.shiftKey&&!a.ctrlKey&&!gecko)this.pageUp()&&a.stop();else if(b==34&&!a.shiftKey&&!a.ctrlKey&&!gecko)this.pageDown()&&a.stop();else if((b==219||b==221)&&a.ctrlKey&&!a.altKey)this.highlightParens(a.shiftKey,!0),a.stop();else if(a.metaKey&&!a.shiftKey&&(b==37||b==39)){var d=select.selectionTopNode(this.container);if(d===!1||!this.container.firstChild)return;if(b==37)select.focusAfterNode(e(d),this.container);else{var g=f(d,this.container);select.focusAfterNode(g?g.previousSibling:this.container.lastChild,this.container)}a.stop()}else(a.ctrlKey||a.metaKey)&&!a.altKey&&(a.shiftKey&&b==90||b==89?(select.scrollToNode(this.history.redo()),a.stop()):b==90||safari&&b==8?(select.scrollToNode(this.history.undo()),a.stop()):b==83&&this.options.saveFunction?(this.options.saveFunction(),a.stop()):b==86&&!mac&&this.reroutePasteEvent())}},keyPress:function(a){var b=this.options.electricChars&&i.Parser.electricChars,c=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(b&&b.indexOf(a.character)!=-1)parent.setTimeout(function(){c.indentAtCursor(null)},0);else if(brokenOpera){if(a.code==8){var d=select.selectionTopNode(this.container),c=this,e=d?d.nextSibling:this.container.firstChild;d!==!1&&e&&isBR(e)&&parent.setTimeout(function(){select.selectionTopNode(c.container)==e&&select.focusAfterNode(e.previousSibling,c.container)},20)}else if(a.code==46){var d=select.selectionTopNode(this.container),c=this;d&&isBR(d)&&parent.setTimeout(function(){select.selectionTopNode(c.container)!=d&&select.focusAfterNode(d,c.container)},20)}}else if(slowWebkit){var d=select.selectionTopNode(this.container),e=d?d.nextSibling:this.container.firstChild;if(d&&e&&isBR(e)&&!isBR(d)){var f=document.createTextNode("");this.container.insertBefore(f,e),parent.setTimeout(function(){f.nodeValue==""?removeElement(f):f.nodeValue=f.nodeValue.replace("","")},20)}}webkit&&!this.options.textWrapping&&setTimeout(function(){var a=select.selectionTopNode(c.container,!0);a&&a.nodeType==3&&a.previousSibling&&isBR(a.previousSibling)&&a.nextSibling&&isBR(a.nextSibling)&&a.parentNode.replaceChild(document.createElement("BR"),a.previousSibling)},50)},keyUp:function(a){this.cursorActivity(j(a.keyCode))},indentLineAfter:function(a,b){function c(a){var b=a?a.nextSibling:d.container.firstChild;if(!b||!hasClass(b,"whitespace"))return null;return b}var d=this,f=c(a),g=0,h=f?f.currentText.length:0,j=f?f.nextSibling:a?a.nextSibling:this.container.firstChild;if(b=="keep"){if(a){var k=c(e(a.previousSibling));k&&(g=k.currentText.length)}}else{var l=a&&j&&j.currentText?j.currentText:"";b!=null&&this.options.tabMode!="indent"?g=b?h+indentUnit:Math.max(0,h-indentUnit):a?g=a.indentation(l,h,b,j):i.Parser.firstIndentation&&(g=i.Parser.firstIndentation(l,h,b,j))}var m=g-h;m<0?g==0?(j&&select.snapshotMove(f.firstChild,j.firstChild||j,0),removeElement(f),f=null):(select.snapshotMove(f.firstChild,f.firstChild,m,!0),f.currentText=makeWhiteSpace(g),f.firstChild.nodeValue=f.currentText):m>0?f?(f.currentText=makeWhiteSpace(g),f.firstChild.nodeValue=f.currentText,select.snapshotMove(f.firstChild,f.firstChild,m,!0)):(f=makePartSpan(makeWhiteSpace(g)),f.className="whitespace",a?insertAfter(f,a):this.container.insertBefore(f,this.container.firstChild),select.snapshotMove(j&&(j.firstChild||j),f.firstChild,g,!1,!0)):f&&select.snapshotMove(f.firstChild,f.firstChild,g,!1),m!=0&&this.addDirtyNode(a)},highlightAtCursor:function(){var a=select.selectionTopNode(this.container,!0),b=select.selectionTopNode(this.container,!1);if(a===!1||b===!1)return!1;select.markSelection();if(this.highlight(a,f(b,this.container),!0,20)===!1)return!1;select.selectMarked();return!0},handleTab:function(a){this.options.tabMode=="spaces"&&!select.somethingSelected()?select.insertTabAtCursor():this.reindentSelection(a)},home:function(){var a=select.selectionTopNode(this.container,!0),b=a;if(a===!1||!(!a||a.isPart||isBR(a))||!this.container.firstChild)return!1;while(a&&!isBR(a))a=a.previousSibling;var c=a?a.nextSibling:this.container.firstChild;c&&c!=b&&c.isPart&&hasClass(c,"whitespace")?select.focusAfterNode(c,this.container):select.focusAfterNode(a,this.container),select.scrollToCursor(this.container);return!0},end:function(){var a=select.selectionTopNode(this.container,!0);if(a===!1)return!1;a=f(a,this.container);if(!a)return!1;select.focusAfterNode(a.previousSibling,this.container),select.scrollToCursor(this.container);return!0},pageUp:function(){var a=this.cursorPosition().line,b=this.visibleLineCount();if(a===!1||b===!1)return!1;b-=2;for(var c=0;c<b;c++){a=this.prevLine(a);if(a===!1)break}if(c==0)return!1;select.setCursorPos(this.container,{node:a,offset:0}),select.scrollToCursor(this.container);return!0},pageDown:function(){var a=this.cursorPosition().line,b=this.visibleLineCount();if(a===!1||b===!1)return!1;b-=2;for(var c=0;c<b;c++){var d=this.nextLine(a);if(d===!1)break;a=d}if(c==0)return!1;select.setCursorPos(this.container,{node:a,offset:0}),select.scrollToCursor(this.container);return!0},scheduleParenHighlight:function(){this.parenEvent&&parent.clearTimeout(this.parenEvent);var a=this;this.parenEvent=parent.setTimeout(function(){a.highlightParens()},300)},highlightParens:function(a,b){function o(){var a=[],b,c=!0;for(var d=k;d;d=m?d.nextSibling:d.previousSibling)if(d.className==l&&isSpan(d)&&(b=h(d))){i(b)==m?a.push(b):a.length?a.pop()!=matching[b]&&(c=!1):c=!1;if(!a.length)break}else if(d.dirty||!isSpan(d)&&!isBR(d))return{node:d,status:"dirty"};return{node:d,status:d&&c}}function i(a){return/[\(\[\{]/.test(a)}function h(a){if(a.currentText){var b=a.currentText.match(/^[\s\u00a0]*([\(\)\[\]{}])[\s\u00a0]*$/);return b&&b[1]}}function g(a){!a||(d&&!d.call?removeClass(removeClass(a,d[0]),d[1]):c.options.unmarkParen?c.options.unmarkParen(a):(a.style.fontWeight="",a.style.color=""))}function e(a,b){!a||(d?d.call?d(a,b):a.className+=" "+d[b?0:1]:(a.style.fontWeight="bold",a.style.color=b?"#8F8":"#F88"))}var c=this,d=this.options.markParen;typeof d=="string"&&(d=[d,d]),!b&&c.highlighted&&(g(c.highlighted[0]),g(c.highlighted[1]));if(!(!window||!window.parent||!window.select)){this.parenEvent&&parent.clearTimeout(this.parenEvent),this.parenEvent=null;var j,k=select.selectionTopNode(this.container,!0);if(!k||!this.highlightAtCursor())return;k=select.selectionTopNode(this.container,!0);if(!k||!((j=h(k))||(k=k.nextSibling)&&(j=h(k))))return;var l=k.className,m=i(j),n=matching[j];for(;;){var p=o();if(p.status=="dirty"){this.highlight(p.node,f(p.node)),p.node.dirty=!1;continue}e(k,p.status),e(p.node,p.status),b?parent.setTimeout(function(){g(k),g(p.node)},500):c.highlighted=[k,p.node],a&&p.node&&select.focusAfterNode(p.node.previousSibling,this.container);break}}},indentAtCursor:function(a){if(!!this.container.firstChild){if(!this.highlightAtCursor())return;var b=select.selectionTopNode(this.container,!1);if(b===!1)return;select.markSelection(),this.indentLineAfter(e(b),a),select.selectMarked()}},indentRegion:function(a,b,c,d){var g=a=e(a),h=a&&e(a.previousSibling);isBR(b)||(b=f(b,this.container)),this.addDirtyNode(a);do{var i=f(g,this.container);g&&this.highlight(h,i,!0),this.indentLineAfter(g,c),h=g,g=i}while(g!=b);d&&select.setCursorPos(this.container,{node:a,offset:0},{node:b,offset:0})},cursorActivity:function(a){this.unloaded&&(window.document.designMode="off",window.document.designMode="on",this.unloaded=!1);if(internetExplorer){this.container.createTextRange().execCommand("unlink"),clearTimeout(this.saveSelectionSnapshot);var b=this;this.saveSelectionSnapshot=setTimeout(function(){var a=select.getBookmark(b.container);a&&(b.selectionSnapshot=a)},200)}var c=this.options.onCursorActivity;if(!a||c){var d=select.selectionTopNode(this.container,!1);if(d===!1||!this.container.firstChild)return;d=d||this.container.firstChild,c&&c(d),a||(this.scheduleHighlight(),this.addDirtyNode(d))}},reparseBuffer:function(){forEach(this.container.childNodes,function(a){a.dirty=!0}),this.container.firstChild&&this.addDirtyNode(this.container.firstChild)},addDirtyNode:function(a){a=a||this.container.firstChild;if(!!a){for(var b=0;b<this.dirty.length;b++)if(this.dirty[b]==a)return;a.nodeType!=3&&(a.dirty=!0),this.dirty.push(a)}},allClean:function(){return!this.dirty.length},scheduleHighlight:function(){var a=this;parent.clearTimeout(this.highlightTimeout),this.highlightTimeout=parent.setTimeout(function(){a.highlightDirty()},this.options.passDelay)},getDirtyNode:function(){while(this.dirty.length>0){var a=this.dirty.pop();try{while(a&&a.parentNode!=this.container)a=a.parentNode;if(a&&(a.dirty||a.nodeType==3))return a}catch(b){}}return null},highlightDirty:function(a){if(!window||!window.parent||!window.select)return!1;this.options.readOnly||select.markSelection();var b,c=a?null:g()+this.options.passTime;while((g()<c||a)&&(b=this.getDirtyNode())){var d=this.highlight(b,c);d&&d.node&&d.dirty&&this.addDirtyNode(d.node.nextSibling)}this.options.readOnly||select.selectMarked(),b&&this.scheduleHighlight();return this.dirty.length==0},documentScanner:function(a){var b=this,c=null;return function(){if(!(!window||!window.parent||!window.select)){c&&c.parentNode!=b.container&&(c=null),select.markSelection();var d=b.highlight(c,g()+a,!0);select.selectMarked();var e=d?d.node&&d.node.nextSibling:null;c=c==e?null:e,b.delayScanning()}}},delayScanning:function(){this.scanner&&(parent.clearTimeout(this.documentScan),this.documentScan=parent.setTimeout(this.scanner,this.options.continuousScanning))},highlight:function(a,b,d,e){function s(a){return(a.previousSibling==null||isBR(a.previousSibling))&&(a.nextSibling==null||isBR(a.nextSibling))}function o(a){if(a){var b=a.oldNextSibling;(u||b===undefined||a.nextSibling!=b)&&h.history.touch(a),a.oldNextSibling=a.nextSibling}else{var b=h.container.oldFirstChild;(u||b===undefined||h.container.firstChild!=b)&&h.history.touch(null),h.container.oldFirstChild=h.container.firstChild}}function n(a){var b=makePartSpan(a.value);b.className=a.style;return b}function m(a,b){a.currentText=a.currentText.substring(b),a.reduced=!0}function l(a,b){return!b.reduced&&b.currentText==a.value&&b.className==a.style}var f=this.container,h=this,j=this.options.activeTokens,k=typeof b=="number"?b:null;if(!f.firstChild)return!1;while(a&&(!a.parserFromHere||a.dirty)){if(e!=null&&isBR(a)&&--e<0)return!1;a=a.previousSibling}if(a&&!a.nextSibling)return!1;var p=c(a?a.nextSibling:f.firstChild),q=stringStream(p),r=a?a.parserFromHere(q):i.Parser.make(q),t={current:null,get:function(){this.current||(this.current=p.nodes.shift());return this.current},next:function(){this.current=null},remove:function(){f.removeChild(this.get()),this.current=null},getNonEmpty:function(){var a=this.get();while(a&&isSpan(a)&&a.currentText=="")if(window.opera&&s(a))this.next(),a=this.get();else{var b=a;this.remove(),a=this.get(),select.snapshotMove(b.firstChild,a&&(a.firstChild||a),0)}return a}},u=!1,v=!0,w=0;forEach(r,function(c){var e=t.getNonEmpty();if(c.value=="\n"){if(!isBR(e))throw"Parser out of sync. Expected BR.";if(e.dirty||!e.indentation)u=!0;o(a),a=e,e.parserFromHere=r.copy(),e.indentation=c.indentation||alwaysZero,e.dirty=!1;if(k==null&&e==b)throw StopIteration;if(k!=null&&g()>=k||!u&&!v&&w>1&&!d)throw StopIteration;v=u,u=!1,w=0,t.next()}else{if(!isSpan(e))throw"Parser out of sync. Expected SPAN.";e.dirty&&(u=!0),w++;if(l(c,e))j&&e.dirty&&j(e,c,h),e.dirty=!1,t.next();else{u=!0;var i=n(c);f.insertBefore(i,e),j&&j(i,c,h);var p=c.value.length,q=0;while(p>0){e=t.get();var s=e.currentText.length;select.snapshotReplaceNode(e.firstChild,i.firstChild,p,q),s>p?(m(e,p),p=0):(p-=s,q+=s,t.remove())}}}}),o(a),webkitLastLineHack(this.container);return{node:t.getNonEmpty(),dirty:u}}};return i}();addEventHandler(window,"load",function(){var a=window.frameElement.CodeMirror,b=a.editor=new Editor(a.options);parent.setTimeout(method(a,"init"),0)})
|
@@ -1 +0,0 @@
|
|
1
|
-
var tokenizeJavaScript=function(){function g(f,g,h,i){function p(b){var c=a(h,b);i(c?b:null);return{type:"string",style:"js-string"}}function o(){h.nextWhileMatches(c);return{type:"operator",style:"js-operator"}}function n(a){var b="/*",c=a=="*";for(;;){if(h.endOfLine())break;var d=h.next();if(d=="/"&&c){b=null;break}c=d=="*"}i(b);return{type:"comment",style:"js-comment"}}function m(){a(h,"/"),h.nextWhileMatches(/[gimy]/);return{type:"regexp",style:"js-string"}}function l(){h.nextWhileMatches(e);var a=h.get(),c=b.hasOwnProperty(a)&&b.propertyIsEnumerable(a)&&b[a];return c?{type:c.type,style:c.style,content:a}:{type:"variable",style:"js-variable",content:a}}function k(){h.nextWhileMatches(/[0-9]/),h.equals(".")&&(h.next(),h.nextWhileMatches(/[0-9]/));if(h.equals("e")||h.equals("E"))h.next(),h.equals("-")&&h.next(),h.nextWhileMatches(/[0-9]/);return{type:"number",style:"js-atom"}}function j(){h.next(),h.nextWhileMatches(d);return{type:"number",style:"js-atom"}}if(f=='"'||f=="'")return p(f);var q=h.next();if(f=="/*")return n(q);if(q=='"'||q=="'")return p(q);if(/[\[\]{}\(\),;\:\.]/.test(q))return{type:q,style:"js-punctuation"};if(q=="0"&&(h.equals("x")||h.equals("X")))return j();if(/[0-9]/.test(q))return k();if(q=="/"){if(h.equals("*")){h.next();return n(q)}if(h.equals("/")){a(h,null);return{type:"comment",style:"js-comment"}}return g?m():o()}return c.test(q)?o():l()}function f(a,b){return function(c,d){var e=a,h=g(a,b,c,function(a){e=a}),i=h.type=="operator"||h.type=="keyword c"||h.type.match(/^[\[{}\(,;:]$/);(i!=b||e!=a)&&d(f(e,i));return h}}function a(a,b){var c=!1;while(!a.endOfLine()){var d=a.next();if(d==b&&!c)return!1;c=!c&&d=="\\"}return c}var b=function(){function a(a,b){return{type:a,style:"js-"+b}}var b=a("keyword a","keyword"),c=a("keyword b","keyword"),d=a("keyword c","keyword"),e=a("operator","keyword"),f=a("atom","atom");return{"if":b,"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":d,"delete":d,"throw":d,"in":e,"typeof":e,"instanceof":e,"var":a("var","keyword"),"function":a("function","keyword"),"catch":a("catch","keyword"),"for":a("for","keyword"),"switch":a("switch","keyword"),"case":a("case","keyword"),"default":a("default","keyword"),"true":f,"false":f,"null":f,"undefined":f,NaN:f,Infinity:f}}(),c=/[+\-*&%=<>!?|]/,d=/[0-9A-Fa-f]/,e=/[\w\$_]/;return function(a,b){return tokenizer(a,b||f(!1,!0))}}(),JSParser=Editor.Parser=function(){function e(e,f){function T(a,b){a=="variable"&&(x(b),s())}function S(a,b){a=="variable"?(x(b),s(S)):a=="("&&s(v,K(T,")"),E,w)}function R(a){a==")"?t():s(F)}function Q(a,b){a==";"?s(R):b=="in"?s(F):s(F,B(";"),R)}function P(a,b){b=="in"?s(F):s(G,Q)}function O(a){a=="var"?s(M,Q):a==";"?t(Q):a=="variable"?s(P):t(Q)}function N(a,b){b=="="?s(F,N):a==","&&s(M)}function M(a,b){a=="variable"?(x(b),s(N)):s()}function L(a){a=="}"?s():t(E,L)}function K(a,b){function c(d){d==","?s(a,c):d==b?s():s(B(b))}return function(d){d==b?s():t(a,c)}}function J(b){b=="variable"&&u("js-property"),a.hasOwnProperty(b)&&s(B(":"),F)}function I(a){a=="variable"&&(u("js-property"),s())}function H(a){a==":"?s(A,E):t(G,B(";"),A)}function G(a,b){a=="operator"&&/\+\+|--/.test(b)?s(G):a=="operator"?s(F):a==";"?t():a=="("?s(z(")"),K(F,")"),A,G):a=="."?s(I,G):a=="["&&s(z("]"),F,B("]"),A,G)}function F(b){a.hasOwnProperty(b)?s(G):b=="function"?s(S):b=="keyword c"?s(F):b=="("?s(z(")"),F,B(")"),A,G):b=="operator"?s(F):b=="["?s(z("]"),K(F,"]"),A,G):b=="{"?s(z("}"),K(J,"}"),A,G):s()}function E(a){a=="var"?s(z("vardef"),M,B(";"),A):a=="keyword a"?s(z("form"),F,E,A):a=="keyword b"?s(z("form"),E,A):a=="{"?s(z("}"),L,A):a==";"?s():a=="function"?s(S):a=="for"?s(z("form"),B("("),z(")"),O,B(")"),A,E,A):a=="variable"?s(z("stat"),H):a=="switch"?s(z("form"),F,z("}","switch"),B("{"),L,A,A):a=="case"?s(F,B(":")):a=="default"?s(B(":")):a=="catch"?s(z("form"),v,B("("),T,B(")"),E,A,w):t(z("stat"),F,B(";"),A)}function D(a){return t(F,D)}function C(a){return t(E,C)}function B(a){return function(b){b==a?s():a==";"?t():s(arguments.callee)}}function A(){j.type==")"&&(l=j.indented),j=j.prev}function z(a,b){var d=function(){j=new c(l,k,a,null,j,b)};d.lex=!0;return d}function y(a){var b=i;while(b){if(b.vars[a])return!0;b=b.prev}return!1}function x(a){i&&(u("js-variabledef"),i.vars[a]=!0)}function w(){i=i.prev}function v(){i={prev:i,vars:{"this":!0,arguments:!0}}}function u(a){n=a}function t(){r(arguments),m=!1}function s(){r(arguments),m=!0}function r(a){for(var b=a.length-1;b>=0;b--)h.push(a[b])}function q(){var a=i,b=j,c=h.concat([]),d=g.state;return function(e){i=a,j=b,h=c.concat([]),k=l=0,g=tokenizeJavaScript(e,d);return o}}function p(){while(h[h.length-1].lex)h.pop()();var a=g.next();a.type=="whitespace"&&k==0&&(l=a.value.length),k+=a.value.length,a.content=="\n"&&(l=k=0,"align"in j||(j.align=!1),a.indentation=d(j));if(a.type=="whitespace"||a.type=="comment")return a;"align"in j||(j.align=!0);for(;;){m=n=!1,h.pop()(a.type,a.content);if(m){n?a.style=n:a.type=="variable"&&y(a.content)&&(a.style="js-localvariable");return a}}}var g=tokenizeJavaScript(e),h=[b?D:C],i=null,j=new c((f||0)-indentUnit,0,"block",!1),k=0,l=0,m,n,o={next:p,copy:q};A.lex=!0;return o}function d(a){return function(b){var c=b&&b.charAt(0),d=a.type,e=c==d;return d=="vardef"?a.indented+4:d=="form"&&c=="{"?a.indented:d=="stat"||d=="form"?a.indented+indentUnit:a.info=="switch"&&!e?a.indented+(/^(?:case|default)\b/.test(b)?indentUnit:2*indentUnit):a.align?a.column-(e?1:0):a.indented+(e?0:indentUnit)}}function c(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,d!=null&&(this.align=d),this.prev=e,this.info=f}var a={atom:!0,number:!0,variable:!0,string:!0,regexp:!0},b=!1;return{make:e,electricChars:"{}:",configure:function(a){a.json!=null&&(b=a.json)}}}(),XMLParser=Editor.Parser=function(){function f(a){function C(a){a=="xml-attribute"?n(C):o()}function B(a,b){b=="="?n(C):b==">"||b=="/>"?o(z):o()}function A(a){a=="xml-name"?(f.style="xml-attname",n(B,A)):o()}function z(a){return function(b,d){d=="/>"||d==">"&&c.autoSelfClosers.hasOwnProperty(j)?n():d==">"?(r(j,a),n()):(p(),n(arguments.callee))}}function y(a,b){a=="xml-name"&&(f.style="xml-tagname",k&&b.toLowerCase()==k.name?s():p()),n()}function x(a,b){a=="xml-name"?(j=b.toLowerCase(),f.style="xml-tagname",n()):(j=null,o())}function w(a,b){b=="<"?n(x,A,z(h==1)):b=="</"?n(y,q(">")):a=="xml-cdata"?((!k||k.name!="!cdata")&&r("!cdata"),/\]\]>$/.test(b)&&s(),n()):v.hasOwnProperty(a)?n():(p(),n())}function u(){return o(w,u)}function t(a){return function(b,c){var e=a;if(e&&e.noIndent)return c;if(d&&/<!\[CDATA\[/.test(b))return 0;e&&/^<\//.test(b)&&(e=e.prev);while(e&&!e.startOfLine)e=e.prev;return e?e.indent+indentUnit:0}}function s(){k=k.prev}function r(a,b){var d=c.doNotIndent.hasOwnProperty(a)||k&&k.noIndent;k={prev:k,name:a,indent:i,startOfLine:b,noIndent:d}}function q(a){return function(b,c){c==a?n():(p(),n(arguments.callee))}}function p(){f.style+=" xml-error"}function o(){m(arguments),l=!1}function n(){m(arguments),l=!0}function m(a){for(var b=a.length-1;b>=0;b--)g.push(a[b])}var b=e(a),f,g=[u],h=0,i=0,j=null,k=null,l,v={"xml-text":!0,"xml-entity":!0,"xml-comment":!0,"xml-processing":!0,"xml-doctype":!0};return{indentation:function(){return i},next:function(){f=b.next(),f.style=="whitespace"&&h==0?i=f.value.length:h++,f.content=="\n"&&(i=h=0,f.indentation=t(k));if(f.style=="whitespace"||f.type=="xml-comment")return f;for(;;){l=!1,g.pop()(f.style,f.content);if(l)return f}},copy:function(){var a=g.concat([]),c=b.state,d=k,f=this;return function(j){g=a.concat([]),h=i=0,k=d,b=e(j,c);return f}}}}var a={autoSelfClosers:{br:!0,img:!0,hr:!0,link:!0,input:!0,meta:!0,col:!0,frame:!0,base:!0,area:!0},doNotIndent:{pre:!0,"!cdata":!0}},b={autoSelfClosers:{},doNotIndent:{"!cdata":!0}},c=a,d=!1,e=function(){function d(b,c){return function(d,e){while(!d.endOfLine()){if(d.lookAhead(c,!0)){e(a);break}d.next()}return b}}function c(a){return function(c,d){while(!c.endOfLine())if(c.next()==a){d(b);break}return"xml-attribute"}}function b(b,d){var e=b.next();if(e==">"){d(a);return"xml-punctuation"}if(/[?\/]/.test(e)&&b.equals(">")){b.next(),d(a);return"xml-punctuation"}if(e=="=")return"xml-punctuation";if(/[\'\"]/.test(e)){d(c(e));return null}b.nextWhileMatches(/[^\s\u00a0=<>\"\'\/?]/);return"xml-name"}function a(a,c){var e=a.next();if(e=="<"){if(a.equals("!")){a.next();if(a.equals("[")){if(a.lookAhead("[CDATA[",!0)){c(d("xml-cdata","]]>"));return null}return"xml-text"}if(a.lookAhead("--",!0)){c(d("xml-comment","-->"));return null}if(a.lookAhead("DOCTYPE",!0)){a.nextWhileMatches(/[\w\._\-]/),c(d("xml-doctype",">"));return"xml-doctype"}return"xml-text"}if(a.equals("?")){a.next(),a.nextWhileMatches(/[\w\._\-]/),c(d("xml-processing","?>"));return"xml-processing"}a.equals("/")&&a.next(),c(b);return"xml-punctuation"}if(e=="&"){while(!a.endOfLine())if(a.next()==";")break;return"xml-entity"}a.nextWhileMatches(/[^&<\n]/);return"xml-text"}return function(b,c){return tokenizer(b,c||a)}}();return{make:f,electricChars:"/",configure:function(e){e.useHTMLKludges!=null&&(c=e.useHTMLKludges?a:b),e.alignCDATA&&(d=e.alignCDATA)}}}(),CSSParser=Editor.Parser=function(){function c(c,d){d=d||0;var e=a(c),f=!1,g=!1,h=!1,i={next:function(){var a=e.next(),c=a.style,i=a.content;c=="css-hash"&&(c=a.style=g?"css-colorcode":"css-identifier"),c=="css-identifier"&&(g?a.style="css-value":!f&&!h&&(a.style="css-selector")),i=="\n"&&(a.indentation=b(f,g,d)),i=="{"&&h=="@media"?h=!1:i=="{"?f=!0:i=="}"?f=g=h=!1:i==";"?g=h=!1:f&&c!="css-comment"&&c!="whitespace"?g=!0:!f&&c=="css-at"&&(h=i);return a},copy:function(){var b=f,c=g,d=e.state;return function(h){e=a(h,d),f=b,g=c;return i}}};return i}function b(a,b,c){return function(d){return!a||/^\}/.test(d)?c:b?c+indentUnit*2:c+indentUnit}}var a=function(){function d(b){return function(c,d){var e=!1;while(!c.endOfLine()){var f=c.next();if(f==b&&!e)break;e=!e&&f=="\\"}e||d(a);return"css-string"}}function c(b,c){var d=0;while(!b.endOfLine()){var e=b.next();if(d>=2&&e==">"){c(a);break}d=e=="-"?d+1:0}return"css-comment"}function b(b,c){var d=!1;while(!b.endOfLine()){var e=b.next();if(d&&e=="/"){c(a);break}d=e=="*"}return"css-comment"}function a(a,e){var f=a.next();if(f=="@"){a.nextWhileMatches(/\w/);return"css-at"}if(f=="/"&&a.equals("*")){e(b);return null}if(f=="<"&&a.equals("!")){e(c);return null}if(f=="=")return"css-compare";if(!a.equals("=")||f!="~"&&f!="|"){if(f=='"'||f=="'"){e(d(f));return null}if(f=="#"){a.nextWhileMatches(/\w/);return"css-hash"}if(f=="!"){a.nextWhileMatches(/[ \t]/),a.nextWhileMatches(/\w/);return"css-important"}if(/\d/.test(f)){a.nextWhileMatches(/[\w.%]/);return"css-unit"}if(/[,.+>*\/]/.test(f))return"css-select-op";if(/[;{}:\[\]]/.test(f))return"css-punctuation";a.nextWhileMatches(/[\w\\\-_]/);return"css-identifier"}a.next();return"css-compare"}return function(b,c){return tokenizer(b,c||a)}}();return{make:c,electricChars:"}"}}(),HTMLMixedParser=Editor.Parser=function(){function c(c){function j(){var a=d.copy(),b=e&&e.copy(),h=g.next,i=f;return function(j){c=j,d=a(j),e=b&&b(j),g.next=h,f=i;return g}}function i(a,b){var f=d.indentation();e=a.make(c,f+indentUnit);return function(){if(c.lookAhead(b,!1,!1,!0)){e=null,g.next=h;return h()}var a=e.next(),d=a.value.lastIndexOf("<"),i=Math.min(a.value.length-d,b.length);d!=-1&&a.value.slice(d,d+i).toLowerCase()==b.slice(0,i)&&c.lookAhead(b.slice(i),!1,!1,!0)&&(c.push(a.value.slice(d)),a.value=a.value.slice(0,d));if(a.indentation){var j=a.indentation;a.indentation=function(a){return a=="</"?f:j(a)}}return a}}function h(){var b=d.next();if(b.content=="<")f=!0;else if(b.style=="xml-tagname"&&f===!0)f=b.content.toLowerCase();else if(b.content==">"){if(a[f]){var c=window[a[f]];g.next=i(c,"</"+f)}f=!1}return b}b();var d=XMLParser.make(c),e=null,f=!1,g={next:h,copy:j};return g}function b(){var b=["XMLParser"];for(var c in a)b.push(a[c]);for(var d in b)if(!window[b[d]])throw new Error(b[d]+" parser must be loaded for HTML mixed mode to work.");XMLParser.configure({useHTMLKludges:!0})}var a={script:"JSParser",style:"CSSParser"};return{make:c,electricChars:"{}/:",configure:function(b){b.triggers&&(a=b.triggers)}}}()
|
@@ -1 +0,0 @@
|
|
1
|
-
var CodeMirrorConfig=window.CodeMirrorConfig||{},CodeMirror=function(){function g(b,g){this.options=g=g||{},a(g,CodeMirrorConfig),g.dumbTabs?g.tabMode="spaces":g.normalTab&&(g.tabMode="default"),g.cursorActivity&&(g.onCursorActivity=g.cursorActivity);var h=this.frame=c("iframe");g.iframeClass&&(h.className=g.iframeClass),h.frameBorder=0,h.style.border="0",h.style.width="100%",h.style.height="100%",h.style.display="block";var i=this.wrapping=c("div");i.style.position="relative",i.className="CodeMirror-wrapping",i.style.width=g.width,i.style.height=g.height=="dynamic"?g.minHeight+"px":g.height;var j=this.textareaHack=c("textarea");i.appendChild(j),j.style.position="absolute",j.style.left="-10000px",j.style.width="10px",j.tabIndex=1e5,h.CodeMirror=this,g.domain&&f?(this.html=e(g),h.src="javascript:(function(){document.open();"+(g.domain?'document.domain="'+g.domain+'";':"")+"document.write(window.frameElement.CodeMirror.html);document.close();})()"):h.src="javascript:;",b.appendChild?b.appendChild(i):b(i),i.appendChild(h),g.lineNumbers&&(this.lineNumbers=d(i,g.firstLineNumber)),this.win=h.contentWindow;if(!g.domain||!f)this.win.document.open(),this.win.document.write(e(g)),this.win.document.close()}function e(a){typeof a.parserfile=="string"&&(a.parserfile=[a.parserfile]),typeof a.basefiles=="string"&&(a.basefiles=[a.basefiles]),typeof a.stylesheet=="string"&&(a.stylesheet=[a.stylesheet]);var c=' spellcheck="'+(a.disableSpellcheck?"false":"true")+'"',d=['<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html'+c+"><head>"];d.push('<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>');var e=a.noScriptCaching?"?nocache="+(new Date).getTime().toString(16):"";b(a.stylesheet,function(a){d.push('<link rel="stylesheet" type="text/css" href="'+a+e+'"/>')}),b(a.basefiles.concat(a.parserfile),function(b){/^https?:/.test(b)||(b=a.path+b),d.push('<script type="text/javascript" src="'+b+e+'"><'+"/script>")}),d.push('</head><body style="border-width: 0;" class="editbox"'+c+"></body></html>");return d.join("")}function d(a,b){var d=c("div"),e=c("div");d.style.position="absolute",d.style.height="100%";if(d.style.setExpression)try{d.style.setExpression("height","this.previousSibling.offsetHeight + 'px'")}catch(f){}d.style.top="0px",d.style.left="0px",d.style.overflow="hidden",a.appendChild(d),e.className="CodeMirror-line-numbers",d.appendChild(e),e.innerHTML="<div>"+b+"</div>";return d}function c(a){return document.createElementNS&&document.documentElement.namespaceURI!==null?document.createElementNS("http://www.w3.org/1999/xhtml",a):document.createElement(a)}function b(a,b){for(var c=0;c<a.length;c++)b(a[c])}function a(a,b){for(var c in b)a.hasOwnProperty(c)||(a[c]=b[c])}a(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:!1,saveFunction:null,onLoad:null,onChange:null,undoDepth:50,undoDelay:800,disableSpellcheck:!0,textWrapping:!0,readOnly:!1,width:"",height:"300px",minHeight:100,autoMatchParens:!1,markParen:null,unmarkParen:null,parserConfig:null,tabMode:"indent",enterMode:"indent",electricChars:!0,reindentOnLoad:!1,activeTokens:null,onCursorActivity:null,lineNumbers:!1,firstLineNumber:1,onLineNumberClick:null,indentUnit:2,domain:null,noScriptCaching:!1,incrementalLoading:!1});var f=document.selection&&window.ActiveXObject&&/MSIE/.test(navigator.userAgent);g.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&&document.activeElement!=this.frame&&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!0},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){typeof a=="string"&&(a=[a]);var b={},c={},d=this.win.document.getElementsByTagName("link");for(var e=0,f;f=d[e];e++)if(f.rel.indexOf("stylesheet")!==-1)for(var g=0;g<a.length;g++){var h=a[g];f.href.substring(f.href.length-h.length)===h&&(b[f.href]=!0,c[h]=!0)}for(var e=0,f;f=d[e];e++)f.rel.indexOf("stylesheet")!==-1&&(f.disabled=!(f.href in b));for(var g=0;g<a.length;g++){var h=a[g];if(!(h in c)){var f=this.win.document.createElement("link");f.rel="stylesheet",f.type="text/css",f.href=h,this.win.document.getElementsByTagName("head")[0].appendChild(f)}}},setTextWrapping:function(a){a!=this.options.textWrapping&&(this.win.document.body.style.whiteSpace=a?"":"nowrap",this.options.textWrapping=a,this.lineNumbers&&(this.setLineNumbers(!1),this.setLineNumbers(!0)))},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){a&&!this.lineNumbers?(this.lineNumbers=d(this.wrapping,this.options.firstLineNumber),this.activateLineNumbers()):!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,d){this.win.focus(),this.editor.selectLines(a,b,c,d)},nthLine:function(a){var b=this.firstLine();for(;a>1&&b!==!1;a--)b=this.nextLine(b);return b},lineNumber:function(a){var b=0;while(a!==!1)b++,a=this.prevLine(a);return b},jumpToLine:function(a){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 p(){function t(){s&&clearTimeout(s),h.editor.allClean()?r():s=setTimeout(t,200)}function r(b){k(),n(b),a=e.firstChild,d=g.firstChild,i=0,f=h.options.firstLineNumber,q()}function q(){if(!!g.parentNode&&g.parentNode==h.lineNumbers){var c=(new Date).getTime()+h.options.lineNumberTime;while(a){o(f++,a.previousSibling);for(;a&&!b.isBR(a);a=a.nextSibling){var e=a.offsetTop+a.offsetHeight;while(g.offsetHeight&&e-3>i){var j=i;o(" ");if(i<=j)break}}a&&(a=a.nextSibling);if((new Date).getTime()>c){p(),s=setTimeout(q,h.options.lineNumberDelay);return}}while(d)o(f++);p(),k()}}function p(){for(var a=0;a<j.length;a+=2)j[a].innerHTML=j[a+1];j=[]}function o(a,b){d||(d=g.appendChild(c("div"))),m&&m(d,b,a),j.push(d),j.push(a),i=d.offsetHeight+d.offsetTop,d=d.nextSibling}var a,d,f,i,j=[],m=h.options.styleNumbers;r(!0);var s=null;h.updateNumbers=t;var u=b.addEventHandler(b,"scroll",k,!0),v=b.addEventHandler(b,"resize",t,!0);l=function(){s&&clearTimeout(s),h.updateNumbers==t&&(h.updateNumbers=null),u(),v()}}function o(){function a(){n(!0),k()}h.updateNumbers=a;var c=b.addEventHandler(b,"scroll",k,!0),d=b.addEventHandler(b,"resize",a,!0);l=function(){c(),d(),h.updateNumbers==a&&(h.updateNumbers=null)},a()}function n(b){var d=g.firstChild.offsetHeight;if(d!=0){var f=50+Math.max(e.offsetHeight,Math.max(a.offsetHeight,e.scrollHeight||0)),i=Math.ceil(f/d);for(var j=g.childNodes.length;j<=i;j++){var k=c("div");k.appendChild(document.createTextNode(b?String(j+h.options.firstLineNumber):" ")),g.appendChild(k)}}}function k(){f.scrollTop=e.scrollTop||d.documentElement.scrollTop||0}function j(){if(a.offsetWidth!=0){for(var c=a;c.parentNode;c=c.parentNode);if(!f.parentNode||c!=document||!b.Editor){try{l()}catch(d){}clearInterval(m);return}f.offsetWidth!=i&&(i=f.offsetWidth,a.parentNode.style.paddingLeft=i+"px")}}var a=this.frame,b=a.contentWindow,d=b.document,e=d.body,f=this.lineNumbers,g=f.firstChild,h=this,i=null;f.onclick=function(a){var b=h.options.onLineNumberClick;if(b){var c=(a||window.event).target||(a||window.event).srcElement,d=c==f?NaN:Number(c.innerHTML);isNaN(d)||b(d,c)}};var l=function(){};j();var m=setInterval(j,500);(this.options.textWrapping||this.options.styleNumbers?p:o)()},setDynamicHeight:function(){function h(){var b=0,f=d.lastChild,h;while(f&&c.isBR(f))f.hackBR||b++,f=f.previousSibling;f?(e=f.offsetHeight,h=f.offsetTop+(1+b)*e):e&&(h=b*e),h&&(a.wrapping.style.height=Math.max(g+h,a.options.minHeight)+"px")}var a=this,b=a.options.onCursorActivity,c=a.win,d=c.document.body,e=null,f=null,g=2*a.frame.offsetTop;d.style.overflowY="hidden",c.document.documentElement.style.overflowY="hidden",this.frame.scrolling="no",setTimeout(h,300),a.options.onCursorActivity=function(a){b&&b(a),clearTimeout(f),f=setTimeout(h,100)}}},g.InvalidLineHandle={toString:function(){return"CodeMirror.InvalidLineHandle"}},g.replace=function(a){typeof a=="string"&&(a=document.getElementById(a));return function(b){a.parentNode.replaceChild(b,a)}},g.fromTextArea=function(a,b){function f(b){a.nextSibling?a.parentNode.insertBefore(b,a.nextSibling):a.parentNode.appendChild(b)}function c(){a.value=h.getCode()}typeof a=="string"&&(a=document.getElementById(a)),b=b||{},a.style.width&&b.width==null&&(b.width=a.style.width),a.style.height&&b.height==null&&(b.height=a.style.height),b.content==null&&(b.content=a.value);if(a.form){typeof a.form.addEventListener=="function"?a.form.addEventListener("submit",c,!1):a.form.attachEvent("onsubmit",c);if(typeof a.form.submit=="function"){var d=a.form.submit;function e(){c(),a.form.submit=d,a.form.submit(),a.form.submit=e}a.form.submit=e}}a.style.display="none";var h=new g(f,b);h.save=c,h.toTextArea=function(){c(),a.parentNode.removeChild(h.wrapping),a.style.display="",a.form&&(typeof a.form.submit=="function"&&(a.form.submit=d),typeof a.form.removeEventListener=="function"?a.form.removeEventListener("submit",c,!1):a.form.detachEvent("onsubmit",c))};return h},g.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 g}()
|
@@ -1,135 +0,0 @@
|
|
1
|
-
html {
|
2
|
-
cursor: text;
|
3
|
-
}
|
4
|
-
|
5
|
-
.editbox {
|
6
|
-
margin: .4em;
|
7
|
-
padding: 0;
|
8
|
-
font-family: monospace;
|
9
|
-
font-size: 10pt;
|
10
|
-
color: black;
|
11
|
-
}
|
12
|
-
|
13
|
-
pre.code, .editbox {
|
14
|
-
color: #666;
|
15
|
-
}
|
16
|
-
|
17
|
-
.editbox p {
|
18
|
-
margin: 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
span.css-at {
|
22
|
-
color: #708;
|
23
|
-
}
|
24
|
-
|
25
|
-
span.css-unit {
|
26
|
-
color: #281;
|
27
|
-
}
|
28
|
-
|
29
|
-
span.css-value {
|
30
|
-
color: #708;
|
31
|
-
}
|
32
|
-
|
33
|
-
span.css-identifier {
|
34
|
-
color: black;
|
35
|
-
}
|
36
|
-
|
37
|
-
span.css-selector {
|
38
|
-
color: #11B;
|
39
|
-
}
|
40
|
-
|
41
|
-
span.css-important {
|
42
|
-
color: #00F;
|
43
|
-
}
|
44
|
-
|
45
|
-
span.css-colorcode {
|
46
|
-
color: #299;
|
47
|
-
}
|
48
|
-
|
49
|
-
span.css-comment {
|
50
|
-
color: #A70;
|
51
|
-
}
|
52
|
-
|
53
|
-
span.css-string {
|
54
|
-
color: #A22;
|
55
|
-
}
|
56
|
-
|
57
|
-
span.js-punctuation {
|
58
|
-
color: #666666;
|
59
|
-
}
|
60
|
-
|
61
|
-
span.js-operator {
|
62
|
-
color: #666666;
|
63
|
-
}
|
64
|
-
|
65
|
-
span.js-keyword {
|
66
|
-
color: #770088;
|
67
|
-
}
|
68
|
-
|
69
|
-
span.js-atom {
|
70
|
-
color: #228811;
|
71
|
-
}
|
72
|
-
|
73
|
-
span.js-variable {
|
74
|
-
color: black;
|
75
|
-
}
|
76
|
-
|
77
|
-
span.js-variabledef {
|
78
|
-
color: #0000FF;
|
79
|
-
}
|
80
|
-
|
81
|
-
span.js-localvariable {
|
82
|
-
color: #004499;
|
83
|
-
}
|
84
|
-
|
85
|
-
span.js-property {
|
86
|
-
color: black;
|
87
|
-
}
|
88
|
-
|
89
|
-
span.js-comment {
|
90
|
-
color: #AA7700;
|
91
|
-
}
|
92
|
-
|
93
|
-
span.js-string {
|
94
|
-
color: #AA2222;
|
95
|
-
}
|
96
|
-
|
97
|
-
span.xml-tagname {
|
98
|
-
color: #A0B;
|
99
|
-
}
|
100
|
-
|
101
|
-
span.xml-attribute {
|
102
|
-
color: #281;
|
103
|
-
}
|
104
|
-
|
105
|
-
span.xml-punctuation {
|
106
|
-
color: black;
|
107
|
-
}
|
108
|
-
|
109
|
-
span.xml-attname {
|
110
|
-
color: #00F;
|
111
|
-
}
|
112
|
-
|
113
|
-
span.xml-comment {
|
114
|
-
color: #A70;
|
115
|
-
}
|
116
|
-
|
117
|
-
span.xml-cdata {
|
118
|
-
color: #48A;
|
119
|
-
}
|
120
|
-
|
121
|
-
span.xml-processing {
|
122
|
-
color: #999;
|
123
|
-
}
|
124
|
-
|
125
|
-
span.xml-entity {
|
126
|
-
color: #A22;
|
127
|
-
}
|
128
|
-
|
129
|
-
span.xml-error {
|
130
|
-
color: #F00 !important;
|
131
|
-
}
|
132
|
-
|
133
|
-
span.xml-text {
|
134
|
-
color: black;
|
135
|
-
}
|