From 6508e2af98327434ff662be0bf34bf131276efed Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Thu, 4 Jun 2020 20:49:30 +0800 Subject: [PATCH 01/10] Use tern to auto-complete --- _server/CodeMirror/acorn.min.js | 6 + _server/CodeMirror/codeMirror.plugin.js | 2058 +++++++ _server/CodeMirror/codeMirror.plugin.min.js | 19 - _server/CodeMirror/codemirror.css | 741 ++- _server/CodeMirror/defs.js | 6087 +++++++++++++++++++ _server/CodeMirror/jshint.min.js | 1 - _server/CodeMirror/tern.js | 4891 +++++++++++++++ _server/editor_multi.js | 35 +- editor.html | 6 +- 9 files changed, 13526 insertions(+), 318 deletions(-) create mode 100644 _server/CodeMirror/acorn.min.js create mode 100644 _server/CodeMirror/codeMirror.plugin.js delete mode 100644 _server/CodeMirror/codeMirror.plugin.min.js create mode 100644 _server/CodeMirror/defs.js delete mode 100644 _server/CodeMirror/jshint.min.js create mode 100644 _server/CodeMirror/tern.js diff --git a/_server/CodeMirror/acorn.min.js b/_server/CodeMirror/acorn.min.js new file mode 100644 index 00000000..32d04821 --- /dev/null +++ b/_server/CodeMirror/acorn.min.js @@ -0,0 +1,6 @@ +/*acorn.min.js*/ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).acorn={})}(this,function(t){"use strict";var n={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},e="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",o={5:e,"5module":e+" export import",6:e+" const class extends export import super"},h=/^in(stanceof)?$/,i="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿯ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-Ᶎꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭧꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",a=new RegExp("["+i+"]"),r=new RegExp("["+i+s+"]");i=s=null;var p=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,477,28,11,0,9,21,155,22,13,52,76,44,33,24,27,35,30,0,12,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,0,33,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,0,161,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,270,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,754,9486,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,15,7472,3104,541],c=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,525,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,4,9,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,232,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,792487,239];function u(t,e){for(var i=65536,s=0;s",g),template:new f("template"),invalidTemplate:new f("invalidTemplate"),ellipsis:new f("...",g),backQuote:new f("`",x),dollarBraceL:new f("${",{beforeExpr:!0,startsExpr:!0}),eq:new f("=",{beforeExpr:!0,isAssign:!0}),assign:new f("_=",{beforeExpr:!0,isAssign:!0}),incDec:new f("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new f("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:m("||",1),logicalAND:m("&&",2),bitwiseOR:m("|",3),bitwiseXOR:m("^",4),bitwiseAND:m("&",5),equality:m("==/!=/===/!==",6),relational:m("/<=/>=",7),bitShift:m("<>/>>>",8),plusMin:new f("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:m("%",10),star:m("*",10),slash:m("/",10),starstar:new f("**",{beforeExpr:!0}),_break:v("break"),_case:v("case",g),_catch:v("catch"),_continue:v("continue"),_debugger:v("debugger"),_default:v("default",g),_do:v("do",{isLoop:!0,beforeExpr:!0}),_else:v("else",g),_finally:v("finally"),_for:v("for",{isLoop:!0}),_function:v("function",x),_if:v("if"),_return:v("return",g),_switch:v("switch"),_throw:v("throw",g),_try:v("try"),_var:v("var"),_const:v("const"),_while:v("while",{isLoop:!0}),_with:v("with"),_new:v("new",{beforeExpr:!0,startsExpr:!0}),_this:v("this",x),_super:v("super",x),_class:v("class",x),_extends:v("extends",g),_export:v("export"),_import:v("import",x),_null:v("null",x),_true:v("true",x),_false:v("false",x),_in:v("in",{beforeExpr:!0,binop:7}),_instanceof:v("instanceof",{beforeExpr:!0,binop:7}),_typeof:v("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:v("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:v("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},b=/\r\n?|\n|\u2028|\u2029/,k=new RegExp(b.source,"g");function S(t,e){return 10===t||13===t||!e&&(8232===t||8233===t)}var C=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,w=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,E=Object.prototype,A=E.hasOwnProperty,I=E.toString;function P(t,e){return A.call(t,e)}var T=Array.isArray||function(t){return"[object Array]"===I.call(t)};function L(t){return new RegExp("^(?:"+t.replace(/ /g,"|")+")$")}function N(t,e){this.line=t,this.column=e}var V=function(t,e,i){this.start=e,this.end=i,null!==t.sourceFile&&(this.source=t.sourceFile)};function R(t,e){for(var i=1,s=0;;){k.lastIndex=s;var a=k.exec(t);if(!(a&&a.index>10),56320+(1023&t)))}function vt(t){return 36===t||40<=t&&t<=43||46===t||63===t||91<=t&&t<=94||123<=t&&t<=125}function _t(t){return 65<=t&&t<=90||97<=t&&t<=122}function bt(t){return _t(t)||95===t}function kt(t){return 48<=t&&t<=57}function St(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function Ct(t){return 65<=t&&t<=70?t-65+10:97<=t&&t<=102?t-97+10:t-48}function wt(t){return 48<=t&&t<=55}gt.prototype.reset=function(t,e,i){var s=-1!==i.indexOf("u");this.start=0|t,this.source=e+"",this.flags=i,this.switchU=s&&6<=this.parser.options.ecmaVersion,this.switchN=s&&9<=this.parser.options.ecmaVersion},gt.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},gt.prototype.at=function(t){var e=this.source,i=e.length;if(i<=t)return-1;var s=e.charCodeAt(t);return!this.switchU||s<=55295||57344<=s||i<=t+1?s:(s<<10)+e.charCodeAt(t+1)-56613888},gt.prototype.nextIndex=function(t){var e=this.source,i=e.length;if(i<=t)return i;var s=e.charCodeAt(t);return!this.switchU||s<=55295||57344<=s||i<=t+1?t+1:t+2},gt.prototype.current=function(){return this.at(this.pos)},gt.prototype.lookahead=function(){return this.at(this.nextIndex(this.pos))},gt.prototype.advance=function(){this.pos=this.nextIndex(this.pos)},gt.prototype.eat=function(t){return this.current()===t&&(this.advance(),!0)},xt.validateRegExpFlags=function(t){for(var e=t.validFlags,i=t.flags,s=0;st.numCapturingParens&&t.raise("Invalid escape");for(var e=0,i=t.backReferenceNames;et.maxBackReference&&(t.maxBackReference=i),!0;if(i<=t.numCapturingParens)return!0;t.pos=e}return!1},xt.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1},xt.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)},xt.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1},xt.regexp_eatZero=function(t){return 48===t.current()&&!kt(t.lookahead())&&(t.lastIntValue=0,t.advance(),!0)},xt.regexp_eatControlEscape=function(t){var e=t.current();return 116===e?(t.lastIntValue=9,t.advance(),!0):110===e?(t.lastIntValue=10,t.advance(),!0):118===e?(t.lastIntValue=11,t.advance(),!0):102===e?(t.lastIntValue=12,t.advance(),!0):114===e&&(t.lastIntValue=13,t.advance(),!0)},xt.regexp_eatControlLetter=function(t){var e=t.current();return!!_t(e)&&(t.lastIntValue=e%32,t.advance(),!0)},xt.regexp_eatRegExpUnicodeEscapeSequence=function(t){var e=t.pos;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var i=t.lastIntValue;if(t.switchU&&55296<=i&&i<=56319){var s=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var a=t.lastIntValue;if(56320<=a&&a<=57343)return t.lastIntValue=1024*(i-55296)+(a-56320)+65536,!0}t.pos=s,t.lastIntValue=i}return!0}if(t.switchU&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&function(t){return 0<=t&&t<=1114111}(t.lastIntValue))return!0;t.switchU&&t.raise("Invalid unicode escape"),t.pos=e}return!1},xt.regexp_eatIdentityEscape=function(t){if(t.switchU)return!!this.regexp_eatSyntaxCharacter(t)||!!t.eat(47)&&(t.lastIntValue=47,!0);var e=t.current();return!(99===e||t.switchN&&107===e)&&(t.lastIntValue=e,t.advance(),!0)},xt.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(49<=e&&e<=57){for(;t.lastIntValue=10*t.lastIntValue+(e-48),t.advance(),48<=(e=t.current())&&e<=57;);return!0}return!1},xt.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(function(t){return 100===t||68===t||115===t||83===t||119===t||87===t}(e))return t.lastIntValue=-1,t.advance(),!0;if(t.switchU&&9<=this.options.ecmaVersion&&(80===e||112===e)){if(t.lastIntValue=-1,t.advance(),t.eat(123)&&this.regexp_eatUnicodePropertyValueExpression(t)&&t.eat(125))return!0;t.raise("Invalid property name")}return!1},xt.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var i=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var s=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,i,s),!0}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var a=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,a),!0}return!1},xt.regexp_validateUnicodePropertyNameAndValue=function(t,e,i){P(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(i)||t.raise("Invalid property value")},xt.regexp_validateUnicodePropertyNameOrValue=function(t,e){t.unicodeProperties.binary.test(e)||t.raise("Invalid property name")},xt.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";bt(e=t.current());)t.lastStringValue+=yt(e),t.advance();return""!==t.lastStringValue},xt.regexp_eatUnicodePropertyValue=function(t){var e,i=0;for(t.lastStringValue="";bt(e=i=t.current())||kt(e);)t.lastStringValue+=yt(i),t.advance();return""!==t.lastStringValue},xt.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)},xt.regexp_eatCharacterClass=function(t){if(t.eat(91)){if(t.eat(94),this.regexp_classRanges(t),t.eat(93))return!0;t.raise("Unterminated character class")}return!1},xt.regexp_classRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var i=t.lastIntValue;!t.switchU||-1!==e&&-1!==i||t.raise("Invalid character class"),-1!==e&&-1!==i&&i>10),56320+(1023&t)))}At.next=function(){this.options.onToken&&this.options.onToken(new Et(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},At.getToken=function(){return this.next(),new Et(this)},"undefined"!=typeof Symbol&&(At[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===_.eof,value:t}}}}),At.curContext=function(){return this.context[this.context.length-1]},At.nextToken=function(){var t=this.curContext();return t&&t.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(_.eof):t.override?t.override(this):void this.readToken(this.fullCharCodeAtPos())},At.readToken=function(t){return l(t,6<=this.options.ecmaVersion)||92===t?this.readWord():this.getTokenFromCode(t)},At.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);return t<=55295||57344<=t?t:(t<<10)+this.input.charCodeAt(this.pos+1)-56613888},At.skipBlockComment=function(){var t,e=this.options.onComment&&this.curPosition(),i=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(-1===s&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(k.lastIndex=i;(t=k.exec(this.input))&&t.index=this.input.length&&this.raise(i,"Unterminated regular expression");var s=this.input.charAt(this.pos);if(b.test(s)&&this.raise(i,"Unterminated regular expression"),t)t=!1;else{if("["===s)e=!0;else if("]"===s&&e)e=!1;else if("/"===s&&!e)break;t="\\"===s}++this.pos}var a=this.input.slice(i,this.pos);++this.pos;var r=this.pos,n=this.readWord1();this.containsEsc&&this.unexpected(r);var o=this.regexpState||(this.regexpState=new gt(this));o.reset(i,a,n),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var h=null;try{h=new RegExp(a,n)}catch(t){}return this.finishToken(_.regexp,{pattern:a,flags:n,value:h})},At.readInt=function(t,e){for(var i=this.pos,s=0,a=0,r=null==e?1/0:e;a=this.input.length&&this.raise(this.start,"Unterminated string constant");var s=this.input.charCodeAt(this.pos);if(s===t)break;92===s?(e+=this.input.slice(i,this.pos),e+=this.readEscapedChar(!1),i=this.pos):(S(s,10<=this.options.ecmaVersion)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(i,this.pos++),this.finishToken(_.string,e)};var Pt={};At.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t!==Pt)throw t;this.readInvalidTemplateToken()}this.inTemplateElement=!1},At.invalidStringToken=function(t,e){if(this.inTemplateElement&&9<=this.options.ecmaVersion)throw Pt;this.raise(t,e)},At.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(96===i||36===i&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==_.template&&this.type!==_.invalidTemplate?(t+=this.input.slice(e,this.pos),this.finishToken(_.template,t)):36===i?(this.pos+=2,this.finishToken(_.dollarBraceL)):(++this.pos,this.finishToken(_.backQuote));if(92===i)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(S(i)){switch(t+=this.input.slice(e,this.pos),++this.pos,i){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(i)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}},At.readInvalidTemplateToken=function(){for(;this.pos=this.input.length||this.indentationAfter(this.nextLineStart)=this.curLineStart;--t){var e=this.input.charCodeAt(t);if(9!==e&&32!==e)return!1}return!0},s.prototype.extend=function(t,e){this[t]=e(this[t])},s.prototype.parse=function(){return this.next(),this.parseTopLevel()},s.extend=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var s=this,i=0;i=this.nextLineStart){for(;this.tok.start>=this.nextLineStart;)this.curLineStart=this.nextLineStart,this.nextLineStart=this.lineEnd(this.curLineStart)+1;this.curIndent=this.indentationAfter(this.curLineStart)}},e.readToken=function(){for(;;)try{return this.toks.next(),this.toks.type===l.tokTypes.dot&&"."===this.input.substr(this.toks.end,1)&&6<=this.options.ecmaVersion&&(this.toks.end++,this.toks.type=l.tokTypes.ellipsis),new l.Token(this.toks)}catch(t){if(!(t instanceof SyntaxError))throw t;var e=t.message,s=t.raisedAt,i=!0;if(/unterminated/i.test(e))if(s=this.lineEnd(t.pos+1),/string/.test(e))i={start:t.pos,end:s,type:l.tokTypes.string,value:this.input.slice(t.pos+1,s)};else if(/regular expr/i.test(e)){var r=this.input.slice(t.pos,s);try{r=new RegExp(r)}catch(t){}i={start:t.pos,end:s,type:l.tokTypes.regexp,value:r}}else i=!!/template/.test(e)&&{start:t.pos,end:s,type:l.tokTypes.template,value:this.input.slice(t.pos,s)};else if(/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix/i.test(e))for(;s]/.test(s)||/[enwfd]/.test(s)&&/\b(case|else|return|throw|new|in|(instance|type)?of|delete|void)$/.test(this.input.slice(t-10,t)),this.options.locations)for(this.toks.curLine=1,this.toks.lineStart=l.lineBreakG.lastIndex=0;(e=l.lineBreakG.exec(this.input))&&e.indexthis.ahead.length;)this.ahead.push(this.readToken());return this.ahead[t-1]};var r=s.prototype;r.parseTopLevel=function(){var t=this.startNodeAt(this.options.locations?[0,l.getLineInfo(this.input,0)]:0);for(t.body=[];this.tok.type!==l.tokTypes.eof;)t.body.push(this.parseStatement());return this.toks.adaptDirectivePrologue(t.body),this.last=this.tok,t.sourceType=this.options.sourceType,this.finishNode(t,"Program")},r.parseStatement=function(){var t,e,s=this.tok.type,i=this.startNode();switch(this.toks.isLet()&&(s=l.tokTypes._var,t="let"),s){case l.tokTypes._break:case l.tokTypes._continue:this.next();var r=s===l.tokTypes._break;return this.semicolon()||this.canInsertSemicolon()?i.label=null:(i.label=this.tok.type===l.tokTypes.name?this.parseIdent():null,this.semicolon()),this.finishNode(i,r?"BreakStatement":"ContinueStatement");case l.tokTypes._debugger:return this.next(),this.semicolon(),this.finishNode(i,"DebuggerStatement");case l.tokTypes._do:return this.next(),i.body=this.parseStatement(),i.test=this.eat(l.tokTypes._while)?this.parseParenExpression():this.dummyIdent(),this.semicolon(),this.finishNode(i,"DoWhileStatement");case l.tokTypes._for:this.next();var o=9<=this.options.ecmaVersion&&this.inAsync&&this.eatContextual("await");if(this.pushCx(),this.expect(l.tokTypes.parenL),this.tok.type===l.tokTypes.semi)return this.parseFor(i,null);var n=this.toks.isLet();if(n||this.tok.type===l.tokTypes._var||this.tok.type===l.tokTypes._const){var a=this.parseVar(this.startNode(),!0,n?"let":this.tok.value);return 1!==a.declarations.length||this.tok.type!==l.tokTypes._in&&!this.isContextual("of")?this.parseFor(i,a):(9<=this.options.ecmaVersion&&this.tok.type!==l.tokTypes._in&&(i.await=o),this.parseForIn(i,a))}var h=this.parseExpression(!0);return this.tok.type===l.tokTypes._in||this.isContextual("of")?(9<=this.options.ecmaVersion&&this.tok.type!==l.tokTypes._in&&(i.await=o),this.parseForIn(i,this.toAssignable(h))):this.parseFor(i,h);case l.tokTypes._function:return this.next(),this.parseFunction(i,!0);case l.tokTypes._if:return this.next(),i.test=this.parseParenExpression(),i.consequent=this.parseStatement(),i.alternate=this.eat(l.tokTypes._else)?this.parseStatement():null,this.finishNode(i,"IfStatement");case l.tokTypes._return:return this.next(),this.eat(l.tokTypes.semi)||this.canInsertSemicolon()?i.argument=null:(i.argument=this.parseExpression(),this.semicolon()),this.finishNode(i,"ReturnStatement");case l.tokTypes._switch:var p,c,u=this.curIndent,y=this.curLineStart;for(this.next(),i.discriminant=this.parseParenExpression(),i.cases=[],this.pushCx(),this.expect(l.tokTypes.braceL);!this.closes(l.tokTypes.braceR,u,y,!0);){this.tok.type===l.tokTypes._case||this.tok.type===l.tokTypes._default?(c=this.tok.type===l.tokTypes._case,p&&this.finishNode(p,"SwitchCase"),i.cases.push(p=this.startNode()),p.consequent=[],this.next(),p.test=c?this.parseExpression():null,this.expect(l.tokTypes.colon)):(p||(i.cases.push(p=this.startNode()),p.consequent=[],p.test=null),p.consequent.push(this.parseStatement()))}return p&&this.finishNode(p,"SwitchCase"),this.popCx(),this.eat(l.tokTypes.braceR),this.finishNode(i,"SwitchStatement");case l.tokTypes._throw:return this.next(),i.argument=this.parseExpression(),this.semicolon(),this.finishNode(i,"ThrowStatement");case l.tokTypes._try:return this.next(),i.block=this.parseBlock(),i.handler=null,this.tok.type===l.tokTypes._catch&&(e=this.startNode(),this.next(),this.eat(l.tokTypes.parenL)?(e.param=this.toAssignable(this.parseExprAtom(),!0),this.expect(l.tokTypes.parenR)):e.param=null,e.body=this.parseBlock(),i.handler=this.finishNode(e,"CatchClause")),i.finalizer=this.eat(l.tokTypes._finally)?this.parseBlock():null,i.handler||i.finalizer?this.finishNode(i,"TryStatement"):i.block;case l.tokTypes._var:case l.tokTypes._const:return this.parseVar(i,!1,t||this.tok.value);case l.tokTypes._while:return this.next(),i.test=this.parseParenExpression(),i.body=this.parseStatement(),this.finishNode(i,"WhileStatement");case l.tokTypes._with:return this.next(),i.object=this.parseParenExpression(),i.body=this.parseStatement(),this.finishNode(i,"WithStatement");case l.tokTypes.braceL:return this.parseBlock();case l.tokTypes.semi:return this.next(),this.finishNode(i,"EmptyStatement");case l.tokTypes._class:return this.parseClass(!0);case l.tokTypes._import:return 10r&&(r=this.curLineStart);!this.closes(l.tokTypes.braceR,s+(this.curLineStart<=r?1:0),i);){var o=this.startNode();if(this.eat(l.tokTypes.star))o.local=this.eatContextual("as")?this.parseIdent():this.dummyIdent(),this.finishNode(o,"ImportNamespaceSpecifier");else{if(this.isContextual("from"))break;if(o.imported=this.parseIdent(),k(o.imported))break;o.local=this.eatContextual("as")?this.parseIdent():o.imported,this.finishNode(o,"ImportSpecifier")}t.push(o),this.eat(l.tokTypes.comma)}this.eat(l.tokTypes.braceR),this.popCx()}return t},r.parseExportSpecifierList=function(){var t=[],e=this.curIndent,s=this.curLineStart,i=this.nextLineStart;for(this.pushCx(),this.eat(l.tokTypes.braceL),this.curLineStart>i&&(i=this.curLineStart);!this.closes(l.tokTypes.braceR,e+(this.curLineStart<=i?1:0),s)&&!this.isContextual("from");){var r=this.startNode();if(r.local=this.parseIdent(),k(r.local))break;r.exported=this.eatContextual("as")?this.parseIdent():r.local,this.finishNode(r,"ExportSpecifier"),t.push(r),this.eat(l.tokTypes.comma)}return this.eat(l.tokTypes.braceR),this.popCx(),t};var o=s.prototype;o.checkLVal=function(t){if(!t)return t;switch(t.type){case"Identifier":case"MemberExpression":return t;case"ParenthesizedExpression":return t.expression=this.checkLVal(t.expression),t;default:return this.dummyIdent()}},o.parseExpression=function(t){var e=this.storeCurrentPos(),s=this.parseMaybeAssign(t);if(this.tok.type!==l.tokTypes.comma)return s;var i=this.startNodeAt(e);for(i.expressions=[s];this.eat(l.tokTypes.comma);)i.expressions.push(this.parseMaybeAssign(t));return this.finishNode(i,"SequenceExpression")},o.parseParenExpression=function(){this.pushCx(),this.expect(l.tokTypes.parenL);var t=this.parseExpression();return this.popCx(),this.expect(l.tokTypes.parenR),t},o.parseMaybeAssign=function(t){if(this.toks.isContextual("yield")){var e=this.startNode();return this.next(),this.semicolon()||this.canInsertSemicolon()||this.tok.type!==l.tokTypes.star&&!this.tok.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(l.tokTypes.star),e.argument=this.parseMaybeAssign()),this.finishNode(e,"YieldExpression")}var s=this.storeCurrentPos(),i=this.parseMaybeConditional(t);if(this.tok.type.isAssign){var r=this.startNodeAt(s);return r.operator=this.tok.value,r.left=this.tok.type===l.tokTypes.eq?this.toAssignable(i):this.checkLVal(i),this.next(),r.right=this.parseMaybeAssign(t),this.finishNode(r,"AssignmentExpression")}return i},o.parseMaybeConditional=function(t){var e=this.storeCurrentPos(),s=this.parseExprOps(t);if(this.eat(l.tokTypes.question)){var i=this.startNodeAt(e);return i.test=s,i.consequent=this.parseMaybeAssign(),i.alternate=this.expect(l.tokTypes.colon)?this.parseMaybeAssign(t):this.dummyIdent(),this.finishNode(i,"ConditionalExpression")}return s},o.parseExprOps=function(t){var e=this.storeCurrentPos(),s=this.curIndent,i=this.curLineStart;return this.parseExprOp(this.parseMaybeUnary(!1),e,-1,t,s,i)},o.parseExprOp=function(t,e,s,i,r,o){if(this.curLineStart!==o&&this.curIndent=i&&s(o,e))throw new u(e,n);a[o](e,n,t)}}(t,e)}catch(t){if(t instanceof u)return t;throw t}},t.findNodeAround=function(t,i,s,a,e){s=n(s),a=a||p;try{!function t(e,n,r){var o=r||e.type;if(!(e.start>i||e.end=s)&&c[o](e,n,t),(null==i||e.start===i)&&(null==s||e.end===s)&&a(o,e))throw new u(e,n)}(t,e)}catch(t){if(t instanceof u)return t;throw t}},t.findNodeBefore=function(t,i,s,a,e){var c;return s=n(s),a=a||p,function t(e,n,r){var o;e.start>i||(o=r||e.type,e.end<=i&&(!c||c.node.end 1) return; + // By default, don't allow completion when something is selected. + // A hint function can have a `supportsSelection` property to + // indicate that it can handle selections. + if (this.somethingSelected()) { + if (!options.hint.supportsSelection) return; + // Don't try with cross-line selections + for (var i = 0; i < selections.length; i++) + if (selections[i].head.line != selections[i].anchor.line) return; + } + + if (this.state.completionActive) this.state.completionActive.close(); + var completion = this.state.completionActive = new Completion(this, options); + if (!completion.options.hint) return; + + CodeMirror.signal(this, "startCompletion", this); + completion.update(true); + }); + + CodeMirror.defineExtension("closeHint", function() { + if (this.state.completionActive) this.state.completionActive.close() + }) + + function Completion(cm, options) { + this.cm = cm; + this.options = options; + this.widget = null; + this.debounce = 0; + this.tick = 0; + this.startPos = this.cm.getCursor("start"); + this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length; + + var self = this; + cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); }); + } + + var requestAnimationFrame = window.requestAnimationFrame || function(fn) { + return setTimeout(fn, 1000/60); + }; + var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout; + + Completion.prototype = { + close: function() { + if (!this.active()) return; + this.cm.state.completionActive = null; + this.tick = null; + this.cm.off("cursorActivity", this.activityFunc); + + if (this.widget && this.data) CodeMirror.signal(this.data, "close"); + if (this.widget) this.widget.close(); + CodeMirror.signal(this.cm, "endCompletion", this.cm); + }, + + active: function() { + return this.cm.state.completionActive == this; + }, + + pick: function(data, i) { + var completion = data.list[i]; + if (completion.hint) completion.hint(this.cm, data, completion); + else this.cm.replaceRange(getText(completion), completion.from || data.from, + completion.to || data.to, "complete"); + CodeMirror.signal(data, "pick", completion); + this.close(); + }, + + cursorActivity: function() { + if (this.debounce) { + cancelAnimationFrame(this.debounce); + this.debounce = 0; + } + + var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line); + if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch || + pos.ch < this.startPos.ch || this.cm.somethingSelected() || + (!pos.ch || this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) { + this.close(); + } else { + var self = this; + this.debounce = requestAnimationFrame(function() {self.update();}); + if (this.widget) this.widget.disable(); + } + }, + + update: function(first) { + if (this.tick == null) return + var self = this, myTick = ++this.tick + fetchHints(this.options.hint, this.cm, this.options, function(data) { + if (self.tick == myTick) self.finishUpdate(data, first) + }) + }, + + finishUpdate: function(data, first) { + if (this.data) CodeMirror.signal(this.data, "update"); + + var picked = (this.widget && this.widget.picked); + if (this.widget) this.widget.close(); + + this.data = data; + + if (data && data.list.length) { + if (picked && data.list.length == 1) { + this.pick(data, 0); + } else { + this.widget = new Widget(this, data); + CodeMirror.signal(data, "shown"); + } + } + } + }; + + function parseOptions(cm, pos, options) { + var editor = cm.options.hintOptions; + var out = {}; + for (var prop in defaultOptions) out[prop] = defaultOptions[prop]; + if (editor) for (var prop in editor) + if (editor[prop] !== undefined) out[prop] = editor[prop]; + if (options) for (var prop in options) + if (options[prop] !== undefined) out[prop] = options[prop]; + if (out.hint.resolve) out.hint = out.hint.resolve(cm, pos) + return out; + } + + function getText(completion) { + if (typeof completion == "string") return completion; + else return completion.text; + } + + function buildKeyMap(completion, handle) { + var baseMap = { + Up: function() {handle.moveFocus(-1);}, + Down: function() {handle.moveFocus(1);}, + PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);}, + PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);}, + Home: function() {handle.setFocus(0);}, + End: function() {handle.setFocus(handle.length - 1);}, + Enter: handle.pick, + Tab: handle.pick, + Esc: handle.close + }; + + var mac = /Mac/.test(navigator.platform); + + if (mac) { + baseMap["Ctrl-P"] = function() {handle.moveFocus(-1);}; + baseMap["Ctrl-N"] = function() {handle.moveFocus(1);}; + } + + var custom = completion.options.customKeys; + var ourMap = custom ? {} : baseMap; + function addBinding(key, val) { + var bound; + if (typeof val != "string") + bound = function(cm) { return val(cm, handle); }; + // This mechanism is deprecated + else if (baseMap.hasOwnProperty(val)) + bound = baseMap[val]; + else + bound = val; + ourMap[key] = bound; + } + if (custom) + for (var key in custom) if (custom.hasOwnProperty(key)) + addBinding(key, custom[key]); + var extra = completion.options.extraKeys; + if (extra) + for (var key in extra) if (extra.hasOwnProperty(key)) + addBinding(key, extra[key]); + return ourMap; + } + + function getHintElement(hintsElement, el) { + while (el && el != hintsElement) { + if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el; + el = el.parentNode; + } + } + + function Widget(completion, data) { + this.completion = completion; + this.data = data; + this.picked = false; + var widget = this, cm = completion.cm; + var ownerDocument = cm.getInputField().ownerDocument; + var parentWindow = ownerDocument.defaultView || ownerDocument.parentWindow; + + var hints = this.hints = ownerDocument.createElement("ul"); + var theme = completion.cm.options.theme; + hints.className = "CodeMirror-hints " + theme; + this.selectedHint = data.selectedHint || 0; + + var completions = data.list; + for (var i = 0; i < completions.length; ++i) { + var elt = hints.appendChild(ownerDocument.createElement("li")), cur = completions[i]; + var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS); + if (cur.className != null) className = cur.className + " " + className; + elt.className = className; + if (cur.render) cur.render(elt, data, cur); + else elt.appendChild(ownerDocument.createTextNode(cur.displayText || getText(cur))); + elt.hintId = i; + } + + var container = completion.options.container || ownerDocument.body; + var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null); + var left = pos.left, top = pos.bottom, below = true; + var offsetLeft = 0, offsetTop = 0; + if (container !== ownerDocument.body) { + // We offset the cursor position because left and top are relative to the offsetParent's top left corner. + var isContainerPositioned = ['absolute', 'relative', 'fixed'].indexOf(parentWindow.getComputedStyle(container).position) !== -1; + var offsetParent = isContainerPositioned ? container : container.offsetParent; + var offsetParentPosition = offsetParent.getBoundingClientRect(); + var bodyPosition = ownerDocument.body.getBoundingClientRect(); + offsetLeft = (offsetParentPosition.left - bodyPosition.left - offsetParent.scrollLeft); + offsetTop = (offsetParentPosition.top - bodyPosition.top - offsetParent.scrollTop); + } + hints.style.left = (left - offsetLeft) + "px"; + hints.style.top = (top - offsetTop) + "px"; + + // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor. + var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth); + var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight); + container.appendChild(hints); + var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH; + var scrolls = hints.scrollHeight > hints.clientHeight + 1 + var startScroll = cm.getScrollInfo(); + + if (overlapY > 0) { + var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top); + if (curTop - height > 0) { // Fits above cursor + hints.style.top = (top = pos.top - height - offsetTop) + "px"; + below = false; + } else if (height > winH) { + hints.style.height = (winH - 5) + "px"; + hints.style.top = (top = pos.bottom - box.top - offsetTop) + "px"; + var cursor = cm.getCursor(); + if (data.from.ch != cursor.ch) { + pos = cm.cursorCoords(cursor); + hints.style.left = (left = pos.left - offsetLeft) + "px"; + box = hints.getBoundingClientRect(); + } + } + } + var overlapX = box.right - winW; + if (overlapX > 0) { + if (box.right - box.left > winW) { + hints.style.width = (winW - 5) + "px"; + overlapX -= (box.right - box.left) - winW; + } + hints.style.left = (left = pos.left - overlapX - offsetLeft) + "px"; + } + if (scrolls) for (var node = hints.firstChild; node; node = node.nextSibling) + node.style.paddingRight = cm.display.nativeBarWidth + "px" + + cm.addKeyMap(this.keyMap = buildKeyMap(completion, { + moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); }, + setFocus: function(n) { widget.changeActive(n); }, + menuSize: function() { return widget.screenAmount(); }, + length: completions.length, + close: function() { completion.close(); }, + pick: function() { widget.pick(); }, + data: data + })); + + if (completion.options.closeOnUnfocus) { + var closingOnBlur; + cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); }); + cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); }); + } + + cm.on("scroll", this.onScroll = function() { + var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect(); + var newTop = top + startScroll.top - curScroll.top; + var point = newTop - (parentWindow.pageYOffset || (ownerDocument.documentElement || ownerDocument.body).scrollTop); + if (!below) point += hints.offsetHeight; + if (point <= editor.top || point >= editor.bottom) return completion.close(); + hints.style.top = newTop + "px"; + hints.style.left = (left + startScroll.left - curScroll.left) + "px"; + }); + + CodeMirror.on(hints, "dblclick", function(e) { + var t = getHintElement(hints, e.target || e.srcElement); + if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();} + }); + + CodeMirror.on(hints, "click", function(e) { + var t = getHintElement(hints, e.target || e.srcElement); + if (t && t.hintId != null) { + widget.changeActive(t.hintId); + if (completion.options.completeOnSingleClick) widget.pick(); + } + }); + + CodeMirror.on(hints, "mousedown", function() { + setTimeout(function(){cm.focus();}, 20); + }); + + CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]); + return true; + } + + Widget.prototype = { + close: function() { + if (this.completion.widget != this) return; + this.completion.widget = null; + this.hints.parentNode.removeChild(this.hints); + this.completion.cm.removeKeyMap(this.keyMap); + + var cm = this.completion.cm; + if (this.completion.options.closeOnUnfocus) { + cm.off("blur", this.onBlur); + cm.off("focus", this.onFocus); + } + cm.off("scroll", this.onScroll); + }, + + disable: function() { + this.completion.cm.removeKeyMap(this.keyMap); + var widget = this; + this.keyMap = {Enter: function() { widget.picked = true; }}; + this.completion.cm.addKeyMap(this.keyMap); + }, + + pick: function() { + this.completion.pick(this.data, this.selectedHint); + }, + + changeActive: function(i, avoidWrap) { + if (i >= this.data.list.length) + i = avoidWrap ? this.data.list.length - 1 : 0; + else if (i < 0) + i = avoidWrap ? 0 : this.data.list.length - 1; + if (this.selectedHint == i) return; + var node = this.hints.childNodes[this.selectedHint]; + if (node) node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, ""); + node = this.hints.childNodes[this.selectedHint = i]; + node.className += " " + ACTIVE_HINT_ELEMENT_CLASS; + if (node.offsetTop < this.hints.scrollTop) + this.hints.scrollTop = node.offsetTop - 3; + else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight) + this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3; + CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node); + }, + + screenAmount: function() { + return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1; + } + }; + + function applicableHelpers(cm, helpers) { + if (!cm.somethingSelected()) return helpers + var result = [] + for (var i = 0; i < helpers.length; i++) + if (helpers[i].supportsSelection) result.push(helpers[i]) + return result + } + + function fetchHints(hint, cm, options, callback) { + if (hint.async) { + hint(cm, callback, options) + } else { + var result = hint(cm, options) + if (result && result.then) result.then(callback) + else callback(result) + } + } + + function resolveAutoHints(cm, pos) { + var helpers = cm.getHelpers(pos, "hint"), words + if (helpers.length) { + var resolved = function(cm, callback, options) { + var app = applicableHelpers(cm, helpers); + function run(i) { + if (i == app.length) return callback(null) + fetchHints(app[i], cm, options, function(result) { + if (result && result.list.length > 0) callback(result) + else run(i + 1) + }) + } + run(0) + } + resolved.async = true + resolved.supportsSelection = true + return resolved + } else if (words = cm.getHelper(cm.getCursor(), "hintWords")) { + return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) } + } else if (CodeMirror.hint.anyword) { + return function(cm, options) { return CodeMirror.hint.anyword(cm, options) } + } else { + return function() {} + } + } + + CodeMirror.registerHelper("hint", "auto", { + resolve: resolveAutoHints + }); + + CodeMirror.registerHelper("hint", "fromList", function(cm, options) { + var cur = cm.getCursor(), token = cm.getTokenAt(cur) + var term, from = CodeMirror.Pos(cur.line, token.start), to = cur + if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) { + term = token.string.substr(0, cur.ch - token.start) + } else { + term = "" + from = cur + } + var found = []; + for (var i = 0; i < options.words.length; i++) { + var word = options.words[i]; + if (word.slice(0, term.length) == term) + found.push(word); + } + + if (found.length) return {list: found, from: from, to: to}; + }); + + CodeMirror.commands.autocomplete = CodeMirror.showHint; + + var defaultOptions = { + hint: CodeMirror.hint.auto, + completeSingle: true, + alignWithWord: true, + closeCharacters: /[\s()\[\]{};:>,]/, + closeOnUnfocus: true, + completeOnSingleClick: true, + container: null, + customKeys: null, + extraKeys: null + }; + + CodeMirror.defineOption("hintOptions", null); +}); + +// ========= dialog.js ========= // + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: https://codemirror.net/LICENSE + +// Open simple dialogs on top of an editor. Relies on dialog.css. + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + function dialogDiv(cm, template, bottom) { + var wrap = cm.getWrapperElement(); + var dialog; + dialog = wrap.appendChild(document.createElement("div")); + if (bottom) + dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom"; + else + dialog.className = "CodeMirror-dialog CodeMirror-dialog-top"; + + if (typeof template == "string") { + dialog.innerHTML = template; + } else { // Assuming it's a detached DOM element. + dialog.appendChild(template); + } + CodeMirror.addClass(wrap, 'dialog-opened'); + return dialog; + } + + function closeNotification(cm, newVal) { + if (cm.state.currentNotificationClose) + cm.state.currentNotificationClose(); + cm.state.currentNotificationClose = newVal; + } + + CodeMirror.defineExtension("openDialog", function(template, callback, options) { + if (!options) options = {}; + + closeNotification(this, null); + + var dialog = dialogDiv(this, template, options.bottom); + var closed = false, me = this; + function close(newVal) { + if (typeof newVal == 'string') { + inp.value = newVal; + } else { + if (closed) return; + closed = true; + CodeMirror.rmClass(dialog.parentNode, 'dialog-opened'); + dialog.parentNode.removeChild(dialog); + me.focus(); + + if (options.onClose) options.onClose(dialog); + } + } + + var inp = dialog.getElementsByTagName("input")[0], button; + if (inp) { + inp.focus(); + + if (options.value) { + inp.value = options.value; + if (options.selectValueOnOpen !== false) { + inp.select(); + } + } + + if (options.onInput) + CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);}); + if (options.onKeyUp) + CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);}); + + CodeMirror.on(inp, "keydown", function(e) { + if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; } + if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) { + inp.blur(); + CodeMirror.e_stop(e); + close(); + } + if (e.keyCode == 13) callback(inp.value, e); + }); + + if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close); + } else if (button = dialog.getElementsByTagName("button")[0]) { + CodeMirror.on(button, "click", function() { + close(); + me.focus(); + }); + + if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close); + + button.focus(); + } + return close; + }); + + CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) { + closeNotification(this, null); + var dialog = dialogDiv(this, template, options && options.bottom); + var buttons = dialog.getElementsByTagName("button"); + var closed = false, me = this, blurring = 1; + function close() { + if (closed) return; + closed = true; + CodeMirror.rmClass(dialog.parentNode, 'dialog-opened'); + dialog.parentNode.removeChild(dialog); + me.focus(); + } + buttons[0].focus(); + for (var i = 0; i < buttons.length; ++i) { + var b = buttons[i]; + (function(callback) { + CodeMirror.on(b, "click", function(e) { + CodeMirror.e_preventDefault(e); + close(); + if (callback) callback(me); + }); + })(callbacks[i]); + CodeMirror.on(b, "blur", function() { + --blurring; + setTimeout(function() { if (blurring <= 0) close(); }, 200); + }); + CodeMirror.on(b, "focus", function() { ++blurring; }); + } + }); + + /* + * openNotification + * Opens a notification, that can be closed with an optional timer + * (default 5000ms timer) and always closes on click. + * + * If a notification is opened while another is opened, it will close the + * currently opened one and open the new one immediately. + */ + CodeMirror.defineExtension("openNotification", function(template, options) { + closeNotification(this, close); + var dialog = dialogDiv(this, template, options && options.bottom); + var closed = false, doneTimer; + var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000; + + function close() { + if (closed) return; + closed = true; + clearTimeout(doneTimer); + CodeMirror.rmClass(dialog.parentNode, 'dialog-opened'); + dialog.parentNode.removeChild(dialog); + } + + CodeMirror.on(dialog, 'click', function(e) { + CodeMirror.e_preventDefault(e); + close(); + }); + + if (duration) + doneTimer = setTimeout(close, duration); + + return close; + }); +}); + +// ========= searchcursor.js ========= // + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: https://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")) + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod) + else // Plain browser env + mod(CodeMirror) +})(function(CodeMirror) { + "use strict" + var Pos = CodeMirror.Pos + + function regexpFlags(regexp) { + var flags = regexp.flags + return flags != null ? flags : (regexp.ignoreCase ? "i" : "") + + (regexp.global ? "g" : "") + + (regexp.multiline ? "m" : "") + } + + function ensureFlags(regexp, flags) { + var current = regexpFlags(regexp), target = current + for (var i = 0; i < flags.length; i++) if (target.indexOf(flags.charAt(i)) == -1) + target += flags.charAt(i) + return current == target ? regexp : new RegExp(regexp.source, target) + } + + function maybeMultiline(regexp) { + return /\\s|\\n|\n|\\W|\\D|\[\^/.test(regexp.source) + } + + function searchRegexpForward(doc, regexp, start) { + regexp = ensureFlags(regexp, "g") + for (var line = start.line, ch = start.ch, last = doc.lastLine(); line <= last; line++, ch = 0) { + regexp.lastIndex = ch + var string = doc.getLine(line), match = regexp.exec(string) + if (match) + return {from: Pos(line, match.index), + to: Pos(line, match.index + match[0].length), + match: match} + } + } + + function searchRegexpForwardMultiline(doc, regexp, start) { + if (!maybeMultiline(regexp)) return searchRegexpForward(doc, regexp, start) + + regexp = ensureFlags(regexp, "gm") + var string, chunk = 1 + for (var line = start.line, last = doc.lastLine(); line <= last;) { + // This grows the search buffer in exponentially-sized chunks + // between matches, so that nearby matches are fast and don't + // require concatenating the whole document (in case we're + // searching for something that has tons of matches), but at the + // same time, the amount of retries is limited. + for (var i = 0; i < chunk; i++) { + if (line > last) break + var curLine = doc.getLine(line++) + string = string == null ? curLine : string + "\n" + curLine + } + chunk = chunk * 2 + regexp.lastIndex = start.ch + var match = regexp.exec(string) + if (match) { + var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n") + var startLine = start.line + before.length - 1, startCh = before[before.length - 1].length + return {from: Pos(startLine, startCh), + to: Pos(startLine + inside.length - 1, + inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length), + match: match} + } + } + } + + function lastMatchIn(string, regexp) { + var cutOff = 0, match + for (;;) { + regexp.lastIndex = cutOff + var newMatch = regexp.exec(string) + if (!newMatch) return match + match = newMatch + cutOff = match.index + (match[0].length || 1) + if (cutOff == string.length) return match + } + } + + function searchRegexpBackward(doc, regexp, start) { + regexp = ensureFlags(regexp, "g") + for (var line = start.line, ch = start.ch, first = doc.firstLine(); line >= first; line--, ch = -1) { + var string = doc.getLine(line) + if (ch > -1) string = string.slice(0, ch) + var match = lastMatchIn(string, regexp) + if (match) + return {from: Pos(line, match.index), + to: Pos(line, match.index + match[0].length), + match: match} + } + } + + function searchRegexpBackwardMultiline(doc, regexp, start) { + regexp = ensureFlags(regexp, "gm") + var string, chunk = 1 + for (var line = start.line, first = doc.firstLine(); line >= first;) { + for (var i = 0; i < chunk; i++) { + var curLine = doc.getLine(line--) + string = string == null ? curLine.slice(0, start.ch) : curLine + "\n" + string + } + chunk *= 2 + + var match = lastMatchIn(string, regexp) + if (match) { + var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n") + var startLine = line + before.length, startCh = before[before.length - 1].length + return {from: Pos(startLine, startCh), + to: Pos(startLine + inside.length - 1, + inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length), + match: match} + } + } + } + + var doFold, noFold + if (String.prototype.normalize) { + doFold = function(str) { return str.normalize("NFD").toLowerCase() } + noFold = function(str) { return str.normalize("NFD") } + } else { + doFold = function(str) { return str.toLowerCase() } + noFold = function(str) { return str } + } + + // Maps a position in a case-folded line back to a position in the original line + // (compensating for codepoints increasing in number during folding) + function adjustPos(orig, folded, pos, foldFunc) { + if (orig.length == folded.length) return pos + for (var min = 0, max = pos + Math.max(0, orig.length - folded.length);;) { + if (min == max) return min + var mid = (min + max) >> 1 + var len = foldFunc(orig.slice(0, mid)).length + if (len == pos) return mid + else if (len > pos) max = mid + else min = mid + 1 + } + } + + function searchStringForward(doc, query, start, caseFold) { + // Empty string would match anything and never progress, so we + // define it to match nothing instead. + if (!query.length) return null + var fold = caseFold ? doFold : noFold + var lines = fold(query).split(/\r|\n\r?/) + + search: for (var line = start.line, ch = start.ch, last = doc.lastLine() + 1 - lines.length; line <= last; line++, ch = 0) { + var orig = doc.getLine(line).slice(ch), string = fold(orig) + if (lines.length == 1) { + var found = string.indexOf(lines[0]) + if (found == -1) continue search + var start = adjustPos(orig, string, found, fold) + ch + return {from: Pos(line, adjustPos(orig, string, found, fold) + ch), + to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold) + ch)} + } else { + var cutFrom = string.length - lines[0].length + if (string.slice(cutFrom) != lines[0]) continue search + for (var i = 1; i < lines.length - 1; i++) + if (fold(doc.getLine(line + i)) != lines[i]) continue search + var end = doc.getLine(line + lines.length - 1), endString = fold(end), lastLine = lines[lines.length - 1] + if (endString.slice(0, lastLine.length) != lastLine) continue search + return {from: Pos(line, adjustPos(orig, string, cutFrom, fold) + ch), + to: Pos(line + lines.length - 1, adjustPos(end, endString, lastLine.length, fold))} + } + } + } + + function searchStringBackward(doc, query, start, caseFold) { + if (!query.length) return null + var fold = caseFold ? doFold : noFold + var lines = fold(query).split(/\r|\n\r?/) + + search: for (var line = start.line, ch = start.ch, first = doc.firstLine() - 1 + lines.length; line >= first; line--, ch = -1) { + var orig = doc.getLine(line) + if (ch > -1) orig = orig.slice(0, ch) + var string = fold(orig) + if (lines.length == 1) { + var found = string.lastIndexOf(lines[0]) + if (found == -1) continue search + return {from: Pos(line, adjustPos(orig, string, found, fold)), + to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold))} + } else { + var lastLine = lines[lines.length - 1] + if (string.slice(0, lastLine.length) != lastLine) continue search + for (var i = 1, start = line - lines.length + 1; i < lines.length - 1; i++) + if (fold(doc.getLine(start + i)) != lines[i]) continue search + var top = doc.getLine(line + 1 - lines.length), topString = fold(top) + if (topString.slice(topString.length - lines[0].length) != lines[0]) continue search + return {from: Pos(line + 1 - lines.length, adjustPos(top, topString, top.length - lines[0].length, fold)), + to: Pos(line, adjustPos(orig, string, lastLine.length, fold))} + } + } + } + + function SearchCursor(doc, query, pos, options) { + this.atOccurrence = false + this.doc = doc + pos = pos ? doc.clipPos(pos) : Pos(0, 0) + this.pos = {from: pos, to: pos} + + var caseFold + if (typeof options == "object") { + caseFold = options.caseFold + } else { // Backwards compat for when caseFold was the 4th argument + caseFold = options + options = null + } + + if (typeof query == "string") { + if (caseFold == null) caseFold = false + this.matches = function(reverse, pos) { + return (reverse ? searchStringBackward : searchStringForward)(doc, query, pos, caseFold) + } + } else { + query = ensureFlags(query, "gm") + if (!options || options.multiline !== false) + this.matches = function(reverse, pos) { + return (reverse ? searchRegexpBackwardMultiline : searchRegexpForwardMultiline)(doc, query, pos) + } + else + this.matches = function(reverse, pos) { + return (reverse ? searchRegexpBackward : searchRegexpForward)(doc, query, pos) + } + } + } + + SearchCursor.prototype = { + findNext: function() {return this.find(false)}, + findPrevious: function() {return this.find(true)}, + + find: function(reverse) { + var result = this.matches(reverse, this.doc.clipPos(reverse ? this.pos.from : this.pos.to)) + + // Implements weird auto-growing behavior on null-matches for + // backwards-compatiblity with the vim code (unfortunately) + while (result && CodeMirror.cmpPos(result.from, result.to) == 0) { + if (reverse) { + if (result.from.ch) result.from = Pos(result.from.line, result.from.ch - 1) + else if (result.from.line == this.doc.firstLine()) result = null + else result = this.matches(reverse, this.doc.clipPos(Pos(result.from.line - 1))) + } else { + if (result.to.ch < this.doc.getLine(result.to.line).length) result.to = Pos(result.to.line, result.to.ch + 1) + else if (result.to.line == this.doc.lastLine()) result = null + else result = this.matches(reverse, Pos(result.to.line + 1, 0)) + } + } + + if (result) { + this.pos = result + this.atOccurrence = true + return this.pos.match || true + } else { + var end = Pos(reverse ? this.doc.firstLine() : this.doc.lastLine() + 1, 0) + this.pos = {from: end, to: end} + return this.atOccurrence = false + } + }, + + from: function() {if (this.atOccurrence) return this.pos.from}, + to: function() {if (this.atOccurrence) return this.pos.to}, + + replace: function(newText, origin) { + if (!this.atOccurrence) return + var lines = CodeMirror.splitLines(newText) + this.doc.replaceRange(lines, this.pos.from, this.pos.to, origin) + this.pos.to = Pos(this.pos.from.line + lines.length - 1, + lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0)) + } + } + + CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) { + return new SearchCursor(this.doc, query, pos, caseFold) + }) + CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) { + return new SearchCursor(this, query, pos, caseFold) + }) + + CodeMirror.defineExtension("selectMatches", function(query, caseFold) { + var ranges = [] + var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold) + while (cur.findNext()) { + if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break + ranges.push({anchor: cur.from(), head: cur.to()}) + } + if (ranges.length) + this.setSelections(ranges, 0) + }) +}); + +// ========= search.js ========= // + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: https://codemirror.net/LICENSE + +// Define search commands. Depends on dialog.js or another +// implementation of the openDialog method. + +// Replace works a little oddly -- it will do the replace on the next +// Ctrl-G (or whatever is bound to findNext) press. You prevent a +// replace by making sure the match is no longer selected when hitting +// Ctrl-G. + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("./searchcursor"), require("../dialog/dialog")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "./searchcursor", "../dialog/dialog"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + function searchOverlay(query, caseInsensitive) { + if (typeof query == "string") + query = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), caseInsensitive ? "gi" : "g"); + else if (!query.global) + query = new RegExp(query.source, query.ignoreCase ? "gi" : "g"); + + return {token: function(stream) { + query.lastIndex = stream.pos; + var match = query.exec(stream.string); + if (match && match.index == stream.pos) { + stream.pos += match[0].length || 1; + return "searching"; + } else if (match) { + stream.pos = match.index; + } else { + stream.skipToEnd(); + } + }}; + } + + function SearchState() { + this.posFrom = this.posTo = this.lastQuery = this.query = null; + this.overlay = null; + } + + function getSearchState(cm) { + return cm.state.search || (cm.state.search = new SearchState()); + } + + function queryCaseInsensitive(query) { + return typeof query == "string" && query == query.toLowerCase(); + } + + function getSearchCursor(cm, query, pos) { + // Heuristic: if the query string is all lowercase, do a case insensitive search. + return cm.getSearchCursor(query, pos, {caseFold: queryCaseInsensitive(query), multiline: true}); + } + + function persistentDialog(cm, text, deflt, onEnter, onKeyDown) { + cm.openDialog(text, onEnter, { + value: deflt, + selectValueOnOpen: true, + closeOnEnter: false, + onClose: function() { clearSearch(cm); }, + onKeyDown: onKeyDown + }); + } + + function dialog(cm, text, shortText, deflt, f) { + if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true}); + else f(prompt(shortText, deflt)); + } + + function confirmDialog(cm, text, shortText, fs) { + if (cm.openConfirm) cm.openConfirm(text, fs); + else if (confirm(shortText)) fs[0](); + } + + function parseString(string) { + return string.replace(/\\(.)/g, function(_, ch) { + if (ch == "n") return "\n" + if (ch == "r") return "\r" + return ch + }) + } + + function parseQuery(query) { + var isRE = query.match(/^\/(.*)\/([a-z]*)$/); + if (isRE) { + try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); } + catch(e) {} // Not a regular expression after all, do a string search + } else { + query = parseString(query) + } + if (typeof query == "string" ? query == "" : query.test("")) + query = /x^/; + return query; + } + + function startSearch(cm, state, query) { + state.queryText = query; + state.query = parseQuery(query); + cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query)); + state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query)); + cm.addOverlay(state.overlay); + if (cm.showMatchesOnScrollbar) { + if (state.annotate) { state.annotate.clear(); state.annotate = null; } + state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query)); + } + } + + function doSearch(cm, rev, persistent, immediate) { + var state = getSearchState(cm); + if (state.query) return findNext(cm, rev); + var q = cm.getSelection() || state.lastQuery; + if (q instanceof RegExp && q.source == "x^") q = null + if (persistent && cm.openDialog) { + var hiding = null + var searchNext = function(query, event) { + CodeMirror.e_stop(event); + if (!query) return; + if (query != state.queryText) { + startSearch(cm, state, query); + state.posFrom = state.posTo = cm.getCursor(); + } + if (hiding) hiding.style.opacity = 1 + findNext(cm, event.shiftKey, function(_, to) { + var dialog + if (to.line < 3 && document.querySelector && + (dialog = cm.display.wrapper.querySelector(".CodeMirror-dialog")) && + dialog.getBoundingClientRect().bottom - 4 > cm.cursorCoords(to, "window").top) + (hiding = dialog).style.opacity = .4 + }) + }; + persistentDialog(cm, getQueryDialog(cm), q, searchNext, function(event, query) { + var keyName = CodeMirror.keyName(event) + var extra = cm.getOption('extraKeys'), cmd = (extra && extra[keyName]) || CodeMirror.keyMap[cm.getOption("keyMap")][keyName] + if (cmd == "findNext" || cmd == "findPrev" || + cmd == "findPersistentNext" || cmd == "findPersistentPrev") { + CodeMirror.e_stop(event); + startSearch(cm, getSearchState(cm), query); + cm.execCommand(cmd); + } else if (cmd == "find" || cmd == "findPersistent") { + CodeMirror.e_stop(event); + searchNext(query, event); + } + }); + if (immediate && q) { + startSearch(cm, state, q); + findNext(cm, rev); + } + } else { + dialog(cm, getQueryDialog(cm), "Search for:", q, function(query) { + if (query && !state.query) cm.operation(function() { + startSearch(cm, state, query); + state.posFrom = state.posTo = cm.getCursor(); + findNext(cm, rev); + }); + }); + } + } + + function findNext(cm, rev, callback) {cm.operation(function() { + var state = getSearchState(cm); + var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo); + if (!cursor.find(rev)) { + cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0)); + if (!cursor.find(rev)) return; + } + cm.setSelection(cursor.from(), cursor.to()); + cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 20); + state.posFrom = cursor.from(); state.posTo = cursor.to(); + if (callback) callback(cursor.from(), cursor.to()) + });} + + function clearSearch(cm) {cm.operation(function() { + var state = getSearchState(cm); + state.lastQuery = state.query; + if (!state.query) return; + state.query = state.queryText = null; + cm.removeOverlay(state.overlay); + if (state.annotate) { state.annotate.clear(); state.annotate = null; } + });} + + + function getQueryDialog(cm) { + return '' + cm.phrase("Search:") + ' ' + cm.phrase("(Use /re/ syntax for regexp search)") + ''; + } + function getReplaceQueryDialog(cm) { + return ' ' + cm.phrase("(Use /re/ syntax for regexp search)") + ''; + } + function getReplacementQueryDialog(cm) { + return '' + cm.phrase("With:") + ' '; + } + function getDoReplaceConfirm(cm) { + return '' + cm.phrase("Replace?") + ' '; + } + + function replaceAll(cm, query, text) { + cm.operation(function() { + for (var cursor = getSearchCursor(cm, query); cursor.findNext();) { + if (typeof query != "string") { + var match = cm.getRange(cursor.from(), cursor.to()).match(query); + cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];})); + } else cursor.replace(text); + } + }); + } + + function replace(cm, all) { + if (cm.getOption("readOnly")) return; + var query = cm.getSelection() || getSearchState(cm).lastQuery; + var dialogText = '' + (all ? cm.phrase("Replace all:") : cm.phrase("Replace:")) + ''; + dialog(cm, dialogText + getReplaceQueryDialog(cm), dialogText, query, function(query) { + if (!query) return; + query = parseQuery(query); + dialog(cm, getReplacementQueryDialog(cm), cm.phrase("Replace with:"), "", function(text) { + text = parseString(text) + if (all) { + replaceAll(cm, query, text) + } else { + clearSearch(cm); + var cursor = getSearchCursor(cm, query, cm.getCursor("from")); + var advance = function() { + var start = cursor.from(), match; + if (!(match = cursor.findNext())) { + cursor = getSearchCursor(cm, query); + if (!(match = cursor.findNext()) || + (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return; + } + cm.setSelection(cursor.from(), cursor.to()); + cm.scrollIntoView({from: cursor.from(), to: cursor.to()}); + confirmDialog(cm, getDoReplaceConfirm(cm), cm.phrase("Replace?"), + [function() {doReplace(match);}, advance, + function() {replaceAll(cm, query, text)}]); + }; + var doReplace = function(match) { + cursor.replace(typeof query == "string" ? text : + text.replace(/\$(\d)/g, function(_, i) {return match[i];})); + advance(); + }; + advance(); + } + }); + }); + } + + CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);}; + CodeMirror.commands.findPersistent = function(cm) {clearSearch(cm); doSearch(cm, false, true);}; + CodeMirror.commands.findPersistentNext = function(cm) {doSearch(cm, false, true, true);}; + CodeMirror.commands.findPersistentPrev = function(cm) {doSearch(cm, true, true, true);}; + CodeMirror.commands.findNext = doSearch; + CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);}; + CodeMirror.commands.clearSearch = clearSearch; + CodeMirror.commands.replace = replace; + CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);}; +}); + +// ========= matchbrackets.js ========= // + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: https://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + var ie_lt8 = /MSIE \d/.test(navigator.userAgent) && + (document.documentMode == null || document.documentMode < 8); + + var Pos = CodeMirror.Pos; + + var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<", "<": ">>", ">": "<<"}; + + function bracketRegex(config) { + return config && config.bracketRegex || /[(){}[\]]/ + } + + function findMatchingBracket(cm, where, config) { + var line = cm.getLineHandle(where.line), pos = where.ch - 1; + var afterCursor = config && config.afterCursor + if (afterCursor == null) + afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className) + var re = bracketRegex(config) + + // A cursor is defined as between two characters, but in in vim command mode + // (i.e. not insert mode), the cursor is visually represented as a + // highlighted box on top of the 2nd character. Otherwise, we allow matches + // from before or after the cursor. + var match = (!afterCursor && pos >= 0 && re.test(line.text.charAt(pos)) && matching[line.text.charAt(pos)]) || + re.test(line.text.charAt(pos + 1)) && matching[line.text.charAt(++pos)]; + if (!match) return null; + var dir = match.charAt(1) == ">" ? 1 : -1; + if (config && config.strict && (dir > 0) != (pos == where.ch)) return null; + var style = cm.getTokenTypeAt(Pos(where.line, pos + 1)); + + var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config); + if (found == null) return null; + return {from: Pos(where.line, pos), to: found && found.pos, + match: found && found.ch == match.charAt(0), forward: dir > 0}; + } + + // bracketRegex is used to specify which type of bracket to scan + // should be a regexp, e.g. /[[\]]/ + // + // Note: If "where" is on an open bracket, then this bracket is ignored. + // + // Returns false when no bracket was found, null when it reached + // maxScanLines and gave up + function scanForBracket(cm, where, dir, style, config) { + var maxScanLen = (config && config.maxScanLineLength) || 10000; + var maxScanLines = (config && config.maxScanLines) || 1000; + + var stack = []; + var re = bracketRegex(config) + var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1) + : Math.max(cm.firstLine() - 1, where.line - maxScanLines); + for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) { + var line = cm.getLine(lineNo); + if (!line) continue; + var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1; + if (line.length > maxScanLen) continue; + if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0); + for (; pos != end; pos += dir) { + var ch = line.charAt(pos); + if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) { + var match = matching[ch]; + if (match && (match.charAt(1) == ">") == (dir > 0)) stack.push(ch); + else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch}; + else stack.pop(); + } + } + } + return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null; + } + + function matchBrackets(cm, autoclear, config) { + // Disable brace matching in long lines, since it'll cause hugely slow updates + var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000; + var marks = [], ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) { + var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, config); + if (match && cm.getLine(match.from.line).length <= maxHighlightLen) { + var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; + marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style})); + if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen) + marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style})); + } + } + + if (marks.length) { + // Kludge to work around the IE bug from issue #1193, where text + // input stops going to the textare whever this fires. + if (ie_lt8 && cm.state.focused) cm.focus(); + + var clear = function() { + cm.operation(function() { + for (var i = 0; i < marks.length; i++) marks[i].clear(); + }); + }; + if (autoclear) setTimeout(clear, 800); + else return clear; + } + } + + function doMatchBrackets(cm) { + cm.operation(function() { + if (cm.state.matchBrackets.currentlyHighlighted) { + cm.state.matchBrackets.currentlyHighlighted(); + cm.state.matchBrackets.currentlyHighlighted = null; + } + cm.state.matchBrackets.currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets); + }); + } + + CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) { + cm.off("cursorActivity", doMatchBrackets); + if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) { + cm.state.matchBrackets.currentlyHighlighted(); + cm.state.matchBrackets.currentlyHighlighted = null; + } + } + if (val) { + cm.state.matchBrackets = typeof val == "object" ? val : {}; + cm.on("cursorActivity", doMatchBrackets); + } + }); + + CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);}); + CodeMirror.defineExtension("findMatchingBracket", function(pos, config, oldConfig){ + // Backwards-compatibility kludge + if (oldConfig || typeof config == "boolean") { + if (!oldConfig) { + config = config ? {strict: true} : null + } else { + oldConfig.strict = config + config = oldConfig + } + } + return findMatchingBracket(this, pos, config) + }); + CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){ + return scanForBracket(this, pos, dir, style, config); + }); +}); + +// ========= tern.js ========= // + +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: https://codemirror.net/LICENSE + +// Glue code between CodeMirror and Tern. +// +// Create a CodeMirror.TernServer to wrap an actual Tern server, +// register open documents (CodeMirror.Doc instances) with it, and +// call its methods to activate the assisting functions that Tern +// provides. +// +// Options supported (all optional): +// * defs: An array of JSON definition data structures. +// * plugins: An object mapping plugin names to configuration +// options. +// * getFile: A function(name, c) that can be used to access files in +// the project that haven't been loaded yet. Simply do c(null) to +// indicate that a file is not available. +// * fileFilter: A function(value, docName, doc) that will be applied +// to documents before passing them on to Tern. +// * switchToDoc: A function(name, doc) that should, when providing a +// multi-file view, switch the view or focus to the named file. +// * showError: A function(editor, message) that can be used to +// override the way errors are displayed. +// * completionTip: Customize the content in tooltips for completions. +// Is passed a single argument—the completion's data as returned by +// Tern—and may return a string, DOM node, or null to indicate that +// no tip should be shown. By default the docstring is shown. +// * typeTip: Like completionTip, but for the tooltips shown for type +// queries. +// * responseFilter: A function(doc, query, request, error, data) that +// will be applied to the Tern responses before treating them +// +// +// It is possible to run the Tern server in a web worker by specifying +// these additional options: +// * useWorker: Set to true to enable web worker mode. You'll probably +// want to feature detect the actual value you use here, for example +// !!window.Worker. +// * workerScript: The main script of the worker. Point this to +// wherever you are hosting worker.js from this directory. +// * workerDeps: An array of paths pointing (relative to workerScript) +// to the Acorn and Tern libraries and any Tern plugins you want to +// load. Or, if you minified those into a single script and included +// them in the workerScript, simply leave this undefined. + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + // declare global: tern + + CodeMirror.TernServer = function(options) { + var self = this; + this.options = options || {}; + var plugins = this.options.plugins || (this.options.plugins = {}); + if (!plugins.doc_comment) plugins.doc_comment = true; + this.docs = Object.create(null); + if (this.options.useWorker) { + this.server = new WorkerServer(this); + } else { + this.server = new tern.Server({ + getFile: function(name, c) { return getFile(self, name, c); }, + async: true, + defs: this.options.defs || [], + plugins: plugins + }); + } + this.trackChange = function(doc, change) { trackChange(self, doc, change); }; + + this.cachedArgHints = null; + this.activeArgHints = null; + this.jumpStack = []; + + this.getHint = function(cm, c) { return hint(self, cm, c); }; + this.getHint.async = true; + }; + + CodeMirror.TernServer.prototype = { + addDoc: function(name, doc) { + var data = {doc: doc, name: name, changed: null}; + this.server.addFile(name, docValue(this, data)); + CodeMirror.on(doc, "change", this.trackChange); + return this.docs[name] = data; + }, + + delDoc: function(id) { + var found = resolveDoc(this, id); + if (!found) return; + CodeMirror.off(found.doc, "change", this.trackChange); + delete this.docs[found.name]; + this.server.delFile(found.name); + }, + + hideDoc: function(id) { + closeArgHints(this); + var found = resolveDoc(this, id); + if (found && found.changed) sendDoc(this, found); + }, + + complete: function(cm) { + cm.showHint({hint: this.getHint}); + }, + + showType: function(cm, pos, c) { showContextInfo(this, cm, pos, "type", c); }, + + showDocs: function(cm, pos, c) { showContextInfo(this, cm, pos, "documentation", c); }, + + updateArgHints: function(cm) { updateArgHints(this, cm); }, + + jumpToDef: function(cm) { jumpToDef(this, cm); }, + + jumpBack: function(cm) { jumpBack(this, cm); }, + + rename: function(cm) { rename(this, cm); }, + + selectName: function(cm) { selectName(this, cm); }, + + request: function (cm, query, c, pos) { + var self = this; + var doc = findDoc(this, cm.getDoc()); + var request = buildRequest(this, doc, query, pos); + var extraOptions = request.query && this.options.queryOptions && this.options.queryOptions[request.query.type] + if (extraOptions) for (var prop in extraOptions) request.query[prop] = extraOptions[prop]; + + this.server.request(request, function (error, data) { + if (!error && self.options.responseFilter) + data = self.options.responseFilter(doc, query, request, error, data); + c(error, data); + }); + }, + + destroy: function () { + closeArgHints(this) + if (this.worker) { + this.worker.terminate(); + this.worker = null; + } + } + }; + + var Pos = CodeMirror.Pos; + var cls = "CodeMirror-Tern-"; + var bigDoc = 250; + + function getFile(ts, name, c) { + var buf = ts.docs[name]; + if (buf) + c(docValue(ts, buf)); + else if (ts.options.getFile) + ts.options.getFile(name, c); + else + c(null); + } + + function findDoc(ts, doc, name) { + for (var n in ts.docs) { + var cur = ts.docs[n]; + if (cur.doc == doc) return cur; + } + if (!name) for (var i = 0;; ++i) { + n = "[doc" + (i || "") + "]"; + if (!ts.docs[n]) { name = n; break; } + } + return ts.addDoc(name, doc); + } + + function resolveDoc(ts, id) { + if (typeof id == "string") return ts.docs[id]; + if (id instanceof CodeMirror) id = id.getDoc(); + if (id instanceof CodeMirror.Doc) return findDoc(ts, id); + } + + function trackChange(ts, doc, change) { + var data = findDoc(ts, doc); + + var argHints = ts.cachedArgHints; + if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) >= 0) + ts.cachedArgHints = null; + + var changed = data.changed; + if (changed == null) + data.changed = changed = {from: change.from.line, to: change.from.line}; + var end = change.from.line + (change.text.length - 1); + if (change.from.line < changed.to) changed.to = changed.to - (change.to.line - end); + if (end >= changed.to) changed.to = end + 1; + if (changed.from > change.from.line) changed.from = change.from.line; + + if (doc.lineCount() > bigDoc && change.to - changed.from > 100) setTimeout(function() { + if (data.changed && data.changed.to - data.changed.from > 100) sendDoc(ts, data); + }, 200); + } + + function sendDoc(ts, doc) { + ts.server.request({files: [{type: "full", name: doc.name, text: docValue(ts, doc)}]}, function(error) { + if (error) window.console.error(error); + else doc.changed = null; + }); + } + + // Completion + + function hint(ts, cm, c) { + ts.request(cm, {type: "completions", types: true, docs: true, urls: true}, function(error, data) { + if (error) return showError(ts, cm, error); + var completions = [], after = ""; + var from = data.start, to = data.end; + if (cm.getRange(Pos(from.line, from.ch - 2), from) == "[\"" && + cm.getRange(to, Pos(to.line, to.ch + 2)) != "\"]") + after = "\"]"; + + for (var i = 0; i < data.completions.length; ++i) { + var completion = data.completions[i], className = typeToIcon(completion.type); + if (data.guess) className += " " + cls + "guess"; + completions.push({text: completion.name + after, + displayText: completion.displayName || completion.name, + className: className, + data: completion}); + } + + var obj = {from: from, to: to, list: completions}; + var tooltip = null; + CodeMirror.on(obj, "close", function() { remove(tooltip); }); + CodeMirror.on(obj, "update", function() { remove(tooltip); }); + CodeMirror.on(obj, "select", function(cur, node) { + remove(tooltip); + var content = ts.options.completionTip ? ts.options.completionTip(cur.data) : cur.data.doc; + if (content) { + tooltip = makeTooltip(node.parentNode.getBoundingClientRect().right + window.pageXOffset, + node.getBoundingClientRect().top + window.pageYOffset, content); + tooltip.className += " " + cls + "hint-doc"; + } + }); + c(obj); + }); + } + + function typeToIcon(type) { + var suffix; + if (type == "?") suffix = "unknown"; + else if (type == "number" || type == "string" || type == "bool") suffix = type; + else if (/^fn\(/.test(type)) suffix = "fn"; + else if (/^\[/.test(type)) suffix = "array"; + else suffix = "object"; + return cls + "completion " + cls + "completion-" + suffix; + } + + // Type queries + + function showContextInfo(ts, cm, pos, queryName, c) { + ts.request(cm, queryName, function(error, data) { + if (error) return showError(ts, cm, error); + if (ts.options.typeTip) { + var tip = ts.options.typeTip(data); + } else { + var tip = elt("span", null, elt("strong", null, data.type || "not found")); + if (data.doc) + tip.appendChild(document.createTextNode(" — " + data.doc)); + if (data.url) { + tip.appendChild(document.createTextNode(" ")); + var child = tip.appendChild(elt("a", null, "[docs]")); + child.href = data.url; + child.target = "_blank"; + } + } + tempTooltip(cm, tip, ts); + if (c) c(); + }, pos); + } + + // Maintaining argument hints + + function updateArgHints(ts, cm) { + closeArgHints(ts); + + if (cm.somethingSelected()) return; + var state = cm.getTokenAt(cm.getCursor()).state; + var inner = CodeMirror.innerMode(cm.getMode(), state); + if (inner.mode.name != "javascript") return; + var lex = inner.state.lexical; + if (lex.info != "call") return; + + var ch, argPos = lex.pos || 0, tabSize = cm.getOption("tabSize"); + for (var line = cm.getCursor().line, e = Math.max(0, line - 9), found = false; line >= e; --line) { + var str = cm.getLine(line), extra = 0; + for (var pos = 0;;) { + var tab = str.indexOf("\t", pos); + if (tab == -1) break; + extra += tabSize - (tab + extra) % tabSize - 1; + pos = tab + 1; + } + ch = lex.column - extra; + if (str.charAt(ch) == "(") {found = true; break;} + } + if (!found) return; + + var start = Pos(line, ch); + var cache = ts.cachedArgHints; + if (cache && cache.doc == cm.getDoc() && cmpPos(start, cache.start) == 0) + return showArgHints(ts, cm, argPos); + + ts.request(cm, {type: "type", preferFunction: true, end: start}, function(error, data) { + if (error || !data.type || !(/^fn\(/).test(data.type)) return; + ts.cachedArgHints = { + start: start, + type: parseFnType(data.type), + name: data.exprName || data.name || "fn", + guess: data.guess, + doc: cm.getDoc() + }; + showArgHints(ts, cm, argPos); + }); + } + + function showArgHints(ts, cm, pos) { + closeArgHints(ts); + + var cache = ts.cachedArgHints, tp = cache.type; + var tip = elt("span", cache.guess ? cls + "fhint-guess" : null, + elt("span", cls + "fname", cache.name), "("); + for (var i = 0; i < tp.args.length; ++i) { + if (i) tip.appendChild(document.createTextNode(", ")); + var arg = tp.args[i]; + tip.appendChild(elt("span", cls + "farg" + (i == pos ? " " + cls + "farg-current" : ""), arg.name || "?")); + if (arg.type != "?") { + tip.appendChild(document.createTextNode(":\u00a0")); + tip.appendChild(elt("span", cls + "type", arg.type)); + } + } + tip.appendChild(document.createTextNode(tp.rettype ? ") ->\u00a0" : ")")); + if (tp.rettype) tip.appendChild(elt("span", cls + "type", tp.rettype)); + var place = cm.cursorCoords(null, "page"); + var tooltip = ts.activeArgHints = makeTooltip(place.right + 1, place.bottom, tip) + setTimeout(function() { + tooltip.clear = onEditorActivity(cm, function() { + if (ts.activeArgHints == tooltip) closeArgHints(ts) }) + }, 20) + } + + function parseFnType(text) { + var args = [], pos = 3; + + function skipMatching(upto) { + var depth = 0, start = pos; + for (;;) { + var next = text.charAt(pos); + if (upto.test(next) && !depth) return text.slice(start, pos); + if (/[{\[\(]/.test(next)) ++depth; + else if (/[}\]\)]/.test(next)) --depth; + ++pos; + } + } + + // Parse arguments + if (text.charAt(pos) != ")") for (;;) { + var name = text.slice(pos).match(/^([^, \(\[\{]+): /); + if (name) { + pos += name[0].length; + name = name[1]; + } + args.push({name: name, type: skipMatching(/[\),]/)}); + if (text.charAt(pos) == ")") break; + pos += 2; + } + + var rettype = text.slice(pos).match(/^\) -> (.*)$/); + + return {args: args, rettype: rettype && rettype[1]}; + } + + // Moving to the definition of something + + function jumpToDef(ts, cm) { + function inner(varName) { + var req = {type: "definition", variable: varName || null}; + var doc = findDoc(ts, cm.getDoc()); + ts.server.request(buildRequest(ts, doc, req), function(error, data) { + if (error) return showError(ts, cm, error); + if (!data.file && data.url) { window.open(data.url); return; } + + if (data.file) { + var localDoc = ts.docs[data.file], found; + if (localDoc && (found = findContext(localDoc.doc, data))) { + ts.jumpStack.push({file: doc.name, + start: cm.getCursor("from"), + end: cm.getCursor("to")}); + moveTo(ts, doc, localDoc, found.start, found.end); + return; + } + } + showError(ts, cm, "Could not find a definition."); + }); + } + + if (!atInterestingExpression(cm)) + dialog(cm, "Jump to variable", function(name) { if (name) inner(name); }); + else + inner(); + } + + function jumpBack(ts, cm) { + var pos = ts.jumpStack.pop(), doc = pos && ts.docs[pos.file]; + if (!doc) return; + moveTo(ts, findDoc(ts, cm.getDoc()), doc, pos.start, pos.end); + } + + function moveTo(ts, curDoc, doc, start, end) { + doc.doc.setSelection(start, end); + if (curDoc != doc && ts.options.switchToDoc) { + closeArgHints(ts); + ts.options.switchToDoc(doc.name, doc.doc); + } + } + + // The {line,ch} representation of positions makes this rather awkward. + function findContext(doc, data) { + var before = data.context.slice(0, data.contextOffset).split("\n"); + var startLine = data.start.line - (before.length - 1); + var start = Pos(startLine, (before.length == 1 ? data.start.ch : doc.getLine(startLine).length) - before[0].length); + + var text = doc.getLine(startLine).slice(start.ch); + for (var cur = startLine + 1; cur < doc.lineCount() && text.length < data.context.length; ++cur) + text += "\n" + doc.getLine(cur); + if (text.slice(0, data.context.length) == data.context) return data; + + var cursor = doc.getSearchCursor(data.context, 0, false); + var nearest, nearestDist = Infinity; + while (cursor.findNext()) { + var from = cursor.from(), dist = Math.abs(from.line - start.line) * 10000; + if (!dist) dist = Math.abs(from.ch - start.ch); + if (dist < nearestDist) { nearest = from; nearestDist = dist; } + } + if (!nearest) return null; + + if (before.length == 1) + nearest.ch += before[0].length; + else + nearest = Pos(nearest.line + (before.length - 1), before[before.length - 1].length); + if (data.start.line == data.end.line) + var end = Pos(nearest.line, nearest.ch + (data.end.ch - data.start.ch)); + else + var end = Pos(nearest.line + (data.end.line - data.start.line), data.end.ch); + return {start: nearest, end: end}; + } + + function atInterestingExpression(cm) { + var pos = cm.getCursor("end"), tok = cm.getTokenAt(pos); + if (tok.start < pos.ch && tok.type == "comment") return false; + return /[\w)\]]/.test(cm.getLine(pos.line).slice(Math.max(pos.ch - 1, 0), pos.ch + 1)); + } + + // Variable renaming + + function rename(ts, cm) { + var token = cm.getTokenAt(cm.getCursor()); + if (!/\w/.test(token.string)) return showError(ts, cm, "Not at a variable"); + dialog(cm, "New name for " + token.string, function(newName) { + ts.request(cm, {type: "rename", newName: newName, fullDocs: true}, function(error, data) { + if (error) return showError(ts, cm, error); + applyChanges(ts, data.changes); + }); + }); + } + + function selectName(ts, cm) { + var name = findDoc(ts, cm.doc).name; + ts.request(cm, {type: "refs"}, function(error, data) { + if (error) return showError(ts, cm, error); + var ranges = [], cur = 0; + var curPos = cm.getCursor(); + for (var i = 0; i < data.refs.length; i++) { + var ref = data.refs[i]; + if (ref.file == name) { + ranges.push({anchor: ref.start, head: ref.end}); + if (cmpPos(curPos, ref.start) >= 0 && cmpPos(curPos, ref.end) <= 0) + cur = ranges.length - 1; + } + } + cm.setSelections(ranges, cur); + }); + } + + var nextChangeOrig = 0; + function applyChanges(ts, changes) { + var perFile = Object.create(null); + for (var i = 0; i < changes.length; ++i) { + var ch = changes[i]; + (perFile[ch.file] || (perFile[ch.file] = [])).push(ch); + } + for (var file in perFile) { + var known = ts.docs[file], chs = perFile[file];; + if (!known) continue; + chs.sort(function(a, b) { return cmpPos(b.start, a.start); }); + var origin = "*rename" + (++nextChangeOrig); + for (var i = 0; i < chs.length; ++i) { + var ch = chs[i]; + known.doc.replaceRange(ch.text, ch.start, ch.end, origin); + } + } + } + + // Generic request-building helper + + function buildRequest(ts, doc, query, pos) { + var files = [], offsetLines = 0, allowFragments = !query.fullDocs; + if (!allowFragments) delete query.fullDocs; + if (typeof query == "string") query = {type: query}; + query.lineCharPositions = true; + if (query.end == null) { + query.end = pos || doc.doc.getCursor("end"); + if (doc.doc.somethingSelected()) + query.start = doc.doc.getCursor("start"); + } + var startPos = query.start || query.end; + + if (doc.changed) { + if (doc.doc.lineCount() > bigDoc && allowFragments !== false && + doc.changed.to - doc.changed.from < 100 && + doc.changed.from <= startPos.line && doc.changed.to > query.end.line) { + files.push(getFragmentAround(doc, startPos, query.end)); + query.file = "#0"; + var offsetLines = files[0].offsetLines; + if (query.start != null) query.start = Pos(query.start.line - -offsetLines, query.start.ch); + query.end = Pos(query.end.line - offsetLines, query.end.ch); + } else { + files.push({type: "full", + name: doc.name, + text: docValue(ts, doc)}); + query.file = doc.name; + doc.changed = null; + } + } else { + query.file = doc.name; + } + for (var name in ts.docs) { + var cur = ts.docs[name]; + if (cur.changed && cur != doc) { + files.push({type: "full", name: cur.name, text: docValue(ts, cur)}); + cur.changed = null; + } + } + + return {query: query, files: files}; + } + + function getFragmentAround(data, start, end) { + var doc = data.doc; + var minIndent = null, minLine = null, endLine, tabSize = 4; + for (var p = start.line - 1, min = Math.max(0, p - 50); p >= min; --p) { + var line = doc.getLine(p), fn = line.search(/\bfunction\b/); + if (fn < 0) continue; + var indent = CodeMirror.countColumn(line, null, tabSize); + if (minIndent != null && minIndent <= indent) continue; + minIndent = indent; + minLine = p; + } + if (minLine == null) minLine = min; + var max = Math.min(doc.lastLine(), end.line + 20); + if (minIndent == null || minIndent == CodeMirror.countColumn(doc.getLine(start.line), null, tabSize)) + endLine = max; + else for (endLine = end.line + 1; endLine < max; ++endLine) { + var indent = CodeMirror.countColumn(doc.getLine(endLine), null, tabSize); + if (indent <= minIndent) break; + } + var from = Pos(minLine, 0); + + return {type: "part", + name: data.name, + offsetLines: from.line, + text: doc.getRange(from, Pos(endLine, end.line == endLine ? null : 0))}; + } + + // Generic utilities + + var cmpPos = CodeMirror.cmpPos; + + function elt(tagname, cls /*, ... elts*/) { + var e = document.createElement(tagname); + if (cls) e.className = cls; + for (var i = 2; i < arguments.length; ++i) { + var elt = arguments[i]; + if (typeof elt == "string") elt = document.createTextNode(elt); + e.appendChild(elt); + } + return e; + } + + function dialog(cm, text, f) { + if (cm.openDialog) + cm.openDialog(text + ": ", f); + else + f(prompt(text, "")); + } + + // Tooltips + + function tempTooltip(cm, content, ts) { + if (cm.state.ternTooltip) remove(cm.state.ternTooltip); + var where = cm.cursorCoords(); + var tip = cm.state.ternTooltip = makeTooltip(where.right + 1, where.bottom, content); + function maybeClear() { + old = true; + if (!mouseOnTip) clear(); + } + function clear() { + cm.state.ternTooltip = null; + if (tip.parentNode) fadeOut(tip) + clearActivity() + } + var mouseOnTip = false, old = false; + CodeMirror.on(tip, "mousemove", function() { mouseOnTip = true; }); + CodeMirror.on(tip, "mouseout", function(e) { + var related = e.relatedTarget || e.toElement + if (!related || !CodeMirror.contains(tip, related)) { + if (old) clear(); + else mouseOnTip = false; + } + }); + setTimeout(maybeClear, ts.options.hintDelay ? ts.options.hintDelay : 1700); + var clearActivity = onEditorActivity(cm, clear) + } + + function onEditorActivity(cm, f) { + cm.on("cursorActivity", f) + cm.on("blur", f) + cm.on("scroll", f) + cm.on("setDoc", f) + return function() { + cm.off("cursorActivity", f) + cm.off("blur", f) + cm.off("scroll", f) + cm.off("setDoc", f) + } + } + + function makeTooltip(x, y, content) { + var node = elt("div", cls + "tooltip", content); + node.style.left = x + "px"; + node.style.top = y + "px"; + document.body.appendChild(node); + return node; + } + + function remove(node) { + var p = node && node.parentNode; + if (p) p.removeChild(node); + } + + function fadeOut(tooltip) { + tooltip.style.opacity = "0"; + setTimeout(function() { remove(tooltip); }, 1100); + } + + function showError(ts, cm, msg) { + if (ts.options.showError) + ts.options.showError(cm, msg); + else + tempTooltip(cm, String(msg), ts); + } + + function closeArgHints(ts) { + if (ts.activeArgHints) { + if (ts.activeArgHints.clear) ts.activeArgHints.clear() + remove(ts.activeArgHints) + ts.activeArgHints = null + } + } + + function docValue(ts, doc) { + var val = doc.doc.getValue(); + if (ts.options.fileFilter) val = ts.options.fileFilter(val, doc.name, doc.doc); + return val; + } + + // Worker wrapper + + function WorkerServer(ts) { + var worker = ts.worker = new Worker(ts.options.workerScript); + worker.postMessage({type: "init", + defs: ts.options.defs, + plugins: ts.options.plugins, + scripts: ts.options.workerDeps}); + var msgId = 0, pending = {}; + + function send(data, c) { + if (c) { + data.id = ++msgId; + pending[msgId] = c; + } + worker.postMessage(data); + } + worker.onmessage = function(e) { + var data = e.data; + if (data.type == "getFile") { + getFile(ts, data.name, function(err, text) { + send({type: "getFile", err: String(err), text: text, id: data.id}); + }); + } else if (data.type == "debug") { + window.console.log(data.message); + } else if (data.id && pending[data.id]) { + pending[data.id](data.err, data.body); + delete pending[data.id]; + } + }; + worker.onerror = function(e) { + for (var id in pending) pending[id](e); + pending = {}; + }; + + this.addFile = function(name, text) { send({type: "add", name: name, text: text}); }; + this.delFile = function(name) { send({type: "del", name: name}); }; + this.request = function(body, c) { send({type: "req", body: body}, c); }; + } +}); + diff --git a/_server/CodeMirror/codeMirror.plugin.min.js b/_server/CodeMirror/codeMirror.plugin.min.js deleted file mode 100644 index 76b0471c..00000000 --- a/_server/CodeMirror/codeMirror.plugin.min.js +++ /dev/null @@ -1,19 +0,0 @@ -(function(mod){if(typeof exports=="object"&&typeof module=="object"){mod(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],mod)}else{mod(CodeMirror)}}})(function(CodeMirror){var HINT_ELEMENT_CLASS="CodeMirror-hint";var ACTIVE_HINT_ELEMENT_CLASS="CodeMirror-hint-active";CodeMirror.showHint=function(cm,getHints,options){if(!getHints){return cm.showHint(options)}if(options&&options.async){getHints.async=true}var newOpts={hint:getHints};if(options){for(var prop in options){newOpts[prop]=options[prop]}}return cm.showHint(newOpts)};CodeMirror.defineExtension("showHint",function(options){options=parseOptions(this,this.getCursor("start"),options);var selections=this.listSelections();if(selections.length>1){return}if(this.somethingSelected()){if(!options.hint.supportsSelection){return}for(var i=0;ihints.clientHeight+1;var startScroll=cm.getScrollInfo();if(overlapY>0){var height=box.bottom-box.top,curTop=pos.top-(pos.bottom-box.top);if(curTop-height>0){hints.style.top=(top=pos.top-height)+"px";below=false}else{if(height>winH){hints.style.height=(winH-5)+"px";hints.style.top=(top=pos.bottom-box.top)+"px";var cursor=cm.getCursor();if(data.from.ch!=cursor.ch){pos=cm.cursorCoords(cursor);hints.style.left=(left=pos.left)+"px";box=hints.getBoundingClientRect()}}}}var overlapX=box.right-winW;if(overlapX>0){if(box.right-box.left>winW){hints.style.width=(winW-5)+"px";overlapX-=(box.right-box.left)-winW}hints.style.left=(left=pos.left-overlapX)+"px"}if(scrolls){for(var node=hints.firstChild;node;node=node.nextSibling){node.style.paddingRight=cm.display.nativeBarWidth+"px"}}cm.addKeyMap(this.keyMap=buildKeyMap(completion,{moveFocus:function(n,avoidWrap){widget.changeActive(widget.selectedHint+n,avoidWrap)},setFocus:function(n){widget.changeActive(n)},menuSize:function(){return widget.screenAmount()},length:completions.length,close:function(){completion.close()},pick:function(){widget.pick()},data:data}));if(completion.options.closeOnUnfocus){var closingOnBlur;cm.on("blur",this.onBlur=function(){closingOnBlur=setTimeout(function(){completion.close()},100)});cm.on("focus",this.onFocus=function(){clearTimeout(closingOnBlur)})}cm.on("scroll",this.onScroll=function(){var curScroll=cm.getScrollInfo(),editor=cm.getWrapperElement().getBoundingClientRect();var newTop=top+startScroll.top-curScroll.top;var point=newTop-(window.pageYOffset||(document.documentElement||document.body).scrollTop);if(!below){point+=hints.offsetHeight}if(point<=editor.top||point>=editor.bottom){return completion.close()}hints.style.top=newTop+"px";hints.style.left=(left+startScroll.left-curScroll.left)+"px"});CodeMirror.on(hints,"dblclick",function(e){var t=getHintElement(hints,e.target||e.srcElement); -if(t&&t.hintId!=null){widget.changeActive(t.hintId);widget.pick()}});CodeMirror.on(hints,"click",function(e){var t=getHintElement(hints,e.target||e.srcElement);if(t&&t.hintId!=null){widget.changeActive(t.hintId);if(completion.options.completeOnSingleClick){widget.pick()}}});CodeMirror.on(hints,"mousedown",function(){setTimeout(function(){cm.focus()},20)});CodeMirror.signal(data,"select",completions[this.selectedHint],hints.childNodes[this.selectedHint]);return true}Widget.prototype={close:function(){if(this.completion.widget!=this){return}this.completion.widget=null;this.hints.parentNode.removeChild(this.hints);this.completion.cm.removeKeyMap(this.keyMap);var cm=this.completion.cm;if(this.completion.options.closeOnUnfocus){cm.off("blur",this.onBlur);cm.off("focus",this.onFocus)}cm.off("scroll",this.onScroll)},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var widget=this;this.keyMap={Enter:function(){widget.picked=true}};this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(i,avoidWrap){if(i>=this.data.list.length){i=avoidWrap?this.data.list.length-1:0}else{if(i<0){i=avoidWrap?0:this.data.list.length-1}}if(this.selectedHint==i){return}var node=this.hints.childNodes[this.selectedHint];node.className=node.className.replace(" "+ACTIVE_HINT_ELEMENT_CLASS,"");node=this.hints.childNodes[this.selectedHint=i];node.className+=" "+ACTIVE_HINT_ELEMENT_CLASS;if(node.offsetTopthis.hints.scrollTop+this.hints.clientHeight){this.hints.scrollTop=node.offsetTop+node.offsetHeight-this.hints.clientHeight+3}}CodeMirror.signal(this.data,"select",this.data.list[this.selectedHint],node)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}};function applicableHelpers(cm,helpers){if(!cm.somethingSelected()){return helpers}var result=[];for(var i=0; -i0){callback(result)}else{run(i+1)}})}run(0)};resolved.async=true;resolved.supportsSelection=true;return resolved}else{if(words=cm.getHelper(cm.getCursor(),"hintWords")){return function(cm){return CodeMirror.hint.fromList(cm,{words:words})}}else{if(CodeMirror.hint.anyword){return function(cm,options){return CodeMirror.hint.anyword(cm,options)}}else{return function(){}}}}}CodeMirror.registerHelper("hint","auto",{resolve:resolveAutoHints});CodeMirror.registerHelper("hint","fromList",function(cm,options){var cur=cm.getCursor(),token=cm.getTokenAt(cur);var to=CodeMirror.Pos(cur.line,token.end);if(token.string&&/\w/.test(token.string[token.string.length-1])){var term=token.string,from=CodeMirror.Pos(cur.line,token.start)}else{var term="",from=to}var found=[];for(var i=0;i,]/,closeOnUnfocus:true,completeOnSingleClick:true,container:null,customKeys:null,extraKeys:null};CodeMirror.defineOption("hintOptions",null)}); -(function(mod){if(typeof exports=="object"&&typeof module=="object"){mod(require("../../lib/codemirror"),require("./matchesonscrollbar"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror","./matchesonscrollbar"],mod)}else{mod(CodeMirror)}}})(function(CodeMirror){var defaults={style:"matchhighlight",minChars:2,delay:100,wordsOnly:false,annotateScrollbar:false,showToken:false,trim:true};function State(options){this.options={};for(var name in defaults){this.options[name]=(options&&options.hasOwnProperty(name)?options:defaults)[name]}this.overlay=this.timeout=null;this.matchesonscroll=null;this.active=false}CodeMirror.defineOption("highlightSelectionMatches",false,function(cm,val,old){if(old&&old!=CodeMirror.Init){removeOverlay(cm);clearTimeout(cm.state.matchHighlighter.timeout);cm.state.matchHighlighter=null;cm.off("cursorActivity",cursorActivity);cm.off("focus",onFocus)}if(val){var state=cm.state.matchHighlighter=new State(val);if(cm.hasFocus()){state.active=true;highlightMatches(cm)}else{cm.on("focus",onFocus)}cm.on("cursorActivity",cursorActivity)}});function cursorActivity(cm){var state=cm.state.matchHighlighter;if(state.active||cm.hasFocus()){scheduleHighlight(cm,state)}}function onFocus(cm){var state=cm.state.matchHighlighter;if(!state.active){state.active=true;scheduleHighlight(cm,state)}}function scheduleHighlight(cm,state){clearTimeout(state.timeout);state.timeout=setTimeout(function(){highlightMatches(cm)},state.options.delay)}function addOverlay(cm,query,hasBoundary,style){var state=cm.state.matchHighlighter;cm.addOverlay(state.overlay=makeOverlay(query,hasBoundary,style));if(state.options.annotateScrollbar&&cm.showMatchesOnScrollbar){var searchFor=hasBoundary?new RegExp("\\b"+query.replace(/[\\\[.+*?(){|^$]/g,"\\$&")+"\\b"):query;state.matchesonscroll=cm.showMatchesOnScrollbar(searchFor,false,{className:"CodeMirror-selection-highlight-scrollbar"})}}function removeOverlay(cm){var state=cm.state.matchHighlighter;if(state.overlay){cm.removeOverlay(state.overlay); -state.overlay=null;if(state.matchesonscroll){state.matchesonscroll.clear();state.matchesonscroll=null}}}function highlightMatches(cm){cm.operation(function(){var state=cm.state.matchHighlighter;removeOverlay(cm);if(!cm.somethingSelected()&&state.options.showToken){var re=state.options.showToken===true?/[\w$]/:state.options.showToken;var cur=cm.getCursor(),line=cm.getLine(cur.line),start=cur.ch,end=start;while(start&&re.test(line.charAt(start-1))){--start}while(end=state.options.minChars){addOverlay(cm,selection,false,state.options.style)}})}function isWord(cm,from,to){var str=cm.getRange(from,to);if(str.match(/^\w+$/)!==null){if(from.ch>0){var pos={line:from.line,ch:from.ch-1};var chr=cm.getRange(pos,from);if(chr.match(/\W/)===null){return false}}if(to.ch1,state.options.tooltips))}}if(options.onUpdateLinting){options.onUpdateLinting(annotationsNotSorted,annotations,cm)}}function onChange(cm){var state=cm.state.lint;if(!state){return}clearTimeout(state.timeout);state.timeout=setTimeout(function(){startLinting(cm)},state.options.delay||500)}function popupTooltips(annotations,e){var target=e.target||e.srcElement;var tooltip=document.createDocumentFragment();for(var i=0;i-1){end+=index}}var hint={message:error.reason,severity:error.code?(error.code.startsWith("W")?"warning":"error"):"error",from:CodeMirror.Pos(error.line-1,start),to:CodeMirror.Pos(error.line-1,end)};output.push(hint)}}}}); -(function(mod){if(typeof exports=="object"&&typeof module=="object"){mod(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],mod)}else{mod(CodeMirror)}}})(function(CodeMirror){var defaults={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"};var Pos=CodeMirror.Pos;CodeMirror.defineOption("autoCloseBrackets",false,function(cm,val,old){if(old&&old!=CodeMirror.Init){cm.removeKeyMap(keyMap);cm.state.closeBrackets=null}if(val){ensureBound(getOption(val,"pairs"));cm.state.closeBrackets=val;cm.addKeyMap(keyMap)}});function getOption(conf,name){if(name=="pairs"&&typeof conf=="string"){return conf}if(typeof conf=="object"&&conf[name]!=null){return conf[name]}return defaults[name]}var keyMap={Backspace:handleBackspace,Enter:handleEnter};function ensureBound(chars){for(var i=0;i=0;i--){var cur=ranges[i].head;cm.replaceRange("",Pos(cur.line,cur.ch-1),Pos(cur.line,cur.ch+1),"+delete")}}function handleEnter(cm){var conf=getConfig(cm);var explode=conf&&getOption(conf,"explode");if(!explode||cm.getOption("disableInput")){return CodeMirror.Pass}var ranges=cm.listSelections();for(var i=0;i0;return{anchor:new Pos(sel.anchor.line,sel.anchor.ch+(inverted?-1:1)),head:new Pos(sel.head.line,sel.head.ch+(inverted?1:-1))}}function handleChar(cm,ch){var conf=getConfig(cm);if(!conf||cm.getOption("disableInput")){return CodeMirror.Pass}var pairs=getOption(conf,"pairs");var pos=pairs.indexOf(ch);if(pos==-1){return CodeMirror.Pass}var triples=getOption(conf,"triples");var identical=pairs.charAt(pos+1)==ch;var ranges=cm.listSelections();var opening=pos%2==0;var type;for(var i=0;i=0&&cm.getRange(cur,Pos(cur.line,cur.ch+3))==ch+ch+ch){curType="skipThree"}else{curType="skip"}}}else{if(identical&&cur.ch>1&&triples.indexOf(ch)>=0&&cm.getRange(Pos(cur.line,cur.ch-2),cur)==ch+ch){if(cur.ch>2&&/\bstring/.test(cm.getTokenTypeAt(Pos(cur.line,cur.ch-2)))){return CodeMirror.Pass}curType="addFour"}else{if(identical){var prev=cur.ch==0?" ":cm.getRange(Pos(cur.line,cur.ch-1),cur);if(!CodeMirror.isWordChar(next)&&prev!=ch&&!CodeMirror.isWordChar(prev)){curType="both"}else{return CodeMirror.Pass}}else{if(opening&&(cm.getLine(cur.line).length==cur.ch||isClosingBracket(next,pairs)||/\s/.test(next))){curType="both"}else{return CodeMirror.Pass}}}}}if(!type){type=curType}else{if(type!=curType){return CodeMirror.Pass}}}var left=pos%2?pairs.charAt(pos-1):ch;var right=pos%2?ch:pairs.charAt(pos+1); -cm.operation(function(){if(type=="skip"){cm.execCommand("goCharRight")}else{if(type=="skipThree"){for(var i=0;i<3;i++){cm.execCommand("goCharRight")}}else{if(type=="surround"){var sels=cm.getSelections();for(var i=0;i-1&&pos%2==1}function charsAround(cm,pos){var str=cm.getRange(Pos(pos.line,pos.ch-1),Pos(pos.line,pos.ch+1));return str.length==2?str:null}function stringStartsAfter(cm,pos){var token=cm.getTokenAt(Pos(pos.line,pos.ch+1));return/\bstring/.test(token.type)&&token.start==pos.ch&&(pos.ch==0||!/\bstring/.test(cm.getTokenTypeAt(pos)))}}); -(function(mod){if(typeof exports=="object"&&typeof module=="object"){mod(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],mod)}else{mod(CodeMirror)}}})(function(CodeMirror){var Pos=CodeMirror.Pos;function forEach(arr,f){for(var i=0,e=arr.length;icur.ch){token.end=cur.ch;token.string=token.string.slice(0,cur.ch-token.start)}}var tprop=token;while(tprop.type=="property"){tprop=getToken(editor,Pos(cur.line,tprop.start));if(tprop.string!="."){return}tprop=getToken(editor,Pos(cur.line,tprop.start));if(!context){var context=[]}context.push(tprop)}return{list:getCompletions(token,context,keywords,options),from:Pos(cur.line,token.start),to:Pos(cur.line,token.end)}}function javascriptHint(editor,options){return scriptHint(editor,javascriptKeywords,function(e,cur){return e.getTokenAt(cur)},options)}CodeMirror.registerHelper("hint","javascript",javascriptHint);function getCoffeeScriptToken(editor,cur){var token=editor.getTokenAt(cur);if(cur.ch==token.start+1&&token.string.charAt(0)=="."){token.end=token.start;token.string=".";token.type="property"}else{if(/^\.[\w$_]*$/.test(token.string)){token.type="property";token.start++;token.string=token.string.replace(/\./,"")}}return token}function coffeescriptHint(editor,options){return scriptHint(editor,coffeescriptKeywords,getCoffeeScriptToken,options)}CodeMirror.registerHelper("hint","coffeescript",coffeescriptHint);var stringProps=("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight "+"toUpperCase toLowerCase split concat match replace search").split(" "); -var arrayProps=("length concat join splice push pop shift unshift slice reverse sort indexOf "+"lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");var funcProps="prototype apply call bind".split(" ");var javascriptKeywords=("break case catch class const continue debugger default delete do else export extends false finally for function "+"if in import instanceof new null return super switch this throw true try typeof var void while with yield").split(" ");var coffeescriptKeywords=("and break catch class continue delete do else extends false finally for "+"if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");function forAllProps(obj,callback){if(!Object.getOwnPropertyNames||!Object.getPrototypeOf){for(var name in obj){callback(name)}}else{for(var o=obj;o;o=Object.getPrototypeOf(o)){Object.getOwnPropertyNames(o).forEach(callback)}}}function getCompletions(token,context,keywords,options){var found=[],start=token.string,global=options&&options.globalScope||window;function maybeAdd(str){if(str==null||str==undefined){return}if(str.lastIndexOf(start,0)==0&&!arrayContains(found,str)){found.push(str)}}function gatherCompletions(obj){if(typeof obj=="string"){forEach(stringProps,maybeAdd)}else{if(obj instanceof Array){forEach(arrayProps,maybeAdd)}else{if(obj instanceof Function){forEach(funcProps,maybeAdd)}}}forAllProps(obj,maybeAdd)}if(context&&context.length){var obj=context.pop(),base;if(obj.type&&obj.type.indexOf("variable")===0){if(options&&options.additionalContext){base=options.additionalContext[obj.string]}if(!options||options.useGlobalScope!==false){base=base||global[obj.string]}}else{if(obj.type=="string"){base=""}else{if(obj.type=="atom"){base=1}else{if(obj.type=="function"){if(global.jQuery!=null&&(obj.string=="$"||obj.string=="jQuery")&&(typeof global.jQuery=="function")){base=global.jQuery()}else{if(global._!=null&&(obj.string=="_")&&(typeof global._=="function")){base=global._() -}}}}}}while(base!=null&&context.length){base=base[context.pop().string]}if(base!=null){gatherCompletions(base)}}else{for(var v=token.state.localVars;v;v=v.next){maybeAdd(v.name)}for(var v=token.state.globalVars;v;v=v.next){maybeAdd(v.name)}if(!options||options.useGlobalScope!==false){gatherCompletions(global)}forEach(keywords,maybeAdd)}return found}}); diff --git a/_server/CodeMirror/codemirror.css b/_server/CodeMirror/codemirror.css index e290de7f..3fdde9c3 100644 --- a/_server/CodeMirror/codemirror.css +++ b/_server/CodeMirror/codemirror.css @@ -1,121 +1,121 @@ -/* BASICS */ +/* ========== CodeMirror.css ========= */ .CodeMirror { - /* Set height, width, borders, and global font properties here */ - font-family: monospace; - height: 300px; - color: black; - direction: ltr; + /* Set height, width, borders, and global font properties here */ + font-family: monospace; + height: 300px; + color: black; + direction: ltr; } /* PADDING */ .CodeMirror-lines { - padding: 4px 0; /* Vertical padding around content */ + padding: 4px 0; /* Vertical padding around content */ } .CodeMirror pre { - padding: 0 4px; /* Horizontal padding of content */ + padding: 0 4px; /* Horizontal padding of content */ } .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { - background-color: white; /* The little square between H and V scrollbars */ + background-color: white; /* The little square between H and V scrollbars */ } /* GUTTER */ .CodeMirror-gutters { - border-right: 1px solid #ddd; - background-color: #f7f7f7; - white-space: nowrap; + border-right: 1px solid #ddd; + background-color: #f7f7f7; + white-space: nowrap; } .CodeMirror-linenumbers { } .CodeMirror-linenumber { - padding: 0 3px 0 5px; - min-width: 20px; - text-align: right; - color: #999; - white-space: nowrap; + padding: 0 3px 0 5px; + min-width: 20px; + text-align: right; + color: #999; + white-space: nowrap; } .CodeMirror-guttermarker { - color: black; + color: black; } .CodeMirror-guttermarker-subtle { - color: #999; + color: #999; } /* CURSOR */ .CodeMirror-cursor { - border-left: 1px solid black; - border-right: none; - width: 0; + border-left: 1px solid black; + border-right: none; + width: 0; } /* Shown when moving in bi-directional text */ .CodeMirror div.CodeMirror-secondarycursor { - border-left: 1px solid silver; + border-left: 1px solid silver; } .cm-fat-cursor .CodeMirror-cursor { - width: auto; - border: 0 !important; - background: #7e7; + width: auto; + border: 0 !important; + background: #7e7; } .cm-fat-cursor div.CodeMirror-cursors { - z-index: 1; + z-index: 1; } .cm-fat-cursor-mark { - background-color: rgba(20, 255, 20, 0.5); - -webkit-animation: blink 1.06s steps(1) infinite; - -moz-animation: blink 1.06s steps(1) infinite; - animation: blink 1.06s steps(1) infinite; + background-color: rgba(20, 255, 20, 0.5); + -webkit-animation: blink 1.06s steps(1) infinite; + -moz-animation: blink 1.06s steps(1) infinite; + animation: blink 1.06s steps(1) infinite; } .cm-animate-fat-cursor { - width: auto; - border: 0; - -webkit-animation: blink 1.06s steps(1) infinite; - -moz-animation: blink 1.06s steps(1) infinite; - animation: blink 1.06s steps(1) infinite; - background-color: #7e7; + width: auto; + border: 0; + -webkit-animation: blink 1.06s steps(1) infinite; + -moz-animation: blink 1.06s steps(1) infinite; + animation: blink 1.06s steps(1) infinite; + background-color: #7e7; } @-moz-keyframes blink { - 0% { - } - 50% { - background-color: transparent; - } - 100% { - } + 0% { + } + 50% { + background-color: transparent; + } + 100% { + } } @-webkit-keyframes blink { - 0% { - } - 50% { - background-color: transparent; - } - 100% { - } + 0% { + } + 50% { + background-color: transparent; + } + 100% { + } } @keyframes blink { - 0% { - } - 50% { - background-color: transparent; - } - 100% { - } + 0% { + } + 50% { + background-color: transparent; + } + 100% { + } } /* Can style cursor different in overwrite (non-insert) mode */ @@ -123,74 +123,74 @@ } .cm-tab { - display: inline-block; - text-decoration: inherit; + display: inline-block; + text-decoration: inherit; } .CodeMirror-rulers { - position: absolute; - left: 0; - right: 0; - top: -50px; - bottom: -20px; - overflow: hidden; + position: absolute; + left: 0; + right: 0; + top: -50px; + bottom: -20px; + overflow: hidden; } .CodeMirror-ruler { - border-left: 1px solid #ccc; - top: 0; - bottom: 0; - position: absolute; + border-left: 1px solid #ccc; + top: 0; + bottom: 0; + position: absolute; } /* DEFAULT THEME */ .cm-s-default .cm-header { - color: blue; + color: blue; } .cm-s-default .cm-quote { - color: #090; + color: #090; } .cm-negative { - color: #d44; + color: #d44; } .cm-positive { - color: #292; + color: #292; } .cm-header, .cm-strong { - font-weight: bold; + font-weight: bold; } .cm-em { - font-style: italic; + font-style: italic; } .cm-link { - text-decoration: underline; + text-decoration: underline; } .cm-strikethrough { - text-decoration: line-through; + text-decoration: line-through; } .cm-s-default .cm-keyword { - color: #708; + color: #708; } .cm-s-default .cm-atom { - color: #219; + color: #219; } .cm-s-default .cm-number { - color: #164; + color: #164; } .cm-s-default .cm-def { - color: #00f; + color: #00f; } .cm-s-default .cm-variable, @@ -200,249 +200,249 @@ } .cm-s-default .cm-variable-2 { - color: #05a; + color: #05a; } .cm-s-default .cm-variable-3, .cm-s-default .cm-type { - color: #085; + color: #085; } .cm-s-default .cm-comment { - color: #a50; + color: #a50; } .cm-s-default .cm-string { - color: #a11; + color: #a11; } .cm-s-default .cm-string-2 { - color: #f50; + color: #f50; } .cm-s-default .cm-meta { - color: #555; + color: #555; } .cm-s-default .cm-qualifier { - color: #555; + color: #555; } .cm-s-default .cm-builtin { - color: #30a; + color: #30a; } .cm-s-default .cm-bracket { - color: #997; + color: #997; } .cm-s-default .cm-tag { - color: #170; + color: #170; } .cm-s-default .cm-attribute { - color: #00c; + color: #00c; } .cm-s-default .cm-hr { - color: #999; + color: #999; } .cm-s-default .cm-link { - color: #00c; + color: #00c; } .cm-s-default .cm-error { - color: #f00; + color: #f00; } .cm-invalidchar { - color: #f00; + color: #f00; } .CodeMirror-composing { - border-bottom: 2px solid; + border-bottom: 2px solid; } /* Default styles for common addons */ div.CodeMirror span.CodeMirror-matchingbracket { - color: #0b0; + color: #0b0; } div.CodeMirror span.CodeMirror-nonmatchingbracket { - color: #a22; + color: #a22; } .CodeMirror-matchingtag { - background: rgba(255, 150, 0, .3); + background: rgba(255, 150, 0, .3); } .CodeMirror-activeline-background { - background: #e8f2ff; + background: #e8f2ff; } /* STOP */ /* The rest of this file contains styles related to the mechanics of - the editor. You probably shouldn't touch them. */ + the editor. You probably shouldn't touch them. */ .CodeMirror { - position: relative; - overflow: hidden; - background: white; + position: relative; + overflow: hidden; + background: white; } .CodeMirror-scroll { - overflow: scroll !important; /* Things will break if this is overridden */ - /* 30px is the magic margin used to hide the element's real scrollbars */ - /* See overflow: hidden in .CodeMirror */ - margin-bottom: -30px; - margin-right: -30px; - padding-bottom: 30px; - height: 100%; - outline: none; /* Prevent dragging from highlighting the element */ - position: relative; + overflow: scroll !important; /* Things will break if this is overridden */ + /* 30px is the magic margin used to hide the element's real scrollbars */ + /* See overflow: hidden in .CodeMirror */ + margin-bottom: -30px; + margin-right: -30px; + padding-bottom: 30px; + height: 100%; + outline: none; /* Prevent dragging from highlighting the element */ + position: relative; } .CodeMirror-sizer { - position: relative; - border-right: 30px solid transparent; + position: relative; + border-right: 30px solid transparent; } /* The fake, visible scrollbars. Used to force redraw during scrolling - before actual scrolling happens, thus preventing shaking and - flickering artifacts. */ + before actual scrolling happens, thus preventing shaking and + flickering artifacts. */ .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { - position: absolute; - z-index: 6; - display: none; + position: absolute; + z-index: 6; + display: none; } .CodeMirror-vscrollbar { - right: 0; - top: 0; - overflow-x: hidden; - overflow-y: scroll; + right: 0; + top: 0; + overflow-x: hidden; + overflow-y: scroll; } .CodeMirror-hscrollbar { - bottom: 0; - left: 0; - overflow-y: hidden; - overflow-x: scroll; + bottom: 0; + left: 0; + overflow-y: hidden; + overflow-x: scroll; } .CodeMirror-scrollbar-filler { - right: 0; - bottom: 0; + right: 0; + bottom: 0; } .CodeMirror-gutter-filler { - left: 0; - bottom: 0; + left: 0; + bottom: 0; } .CodeMirror-gutters { - position: absolute; - left: 0; - top: 0; - min-height: 100%; - z-index: 3; + position: absolute; + left: 0; + top: 0; + min-height: 100%; + z-index: 3; } .CodeMirror-gutter { - white-space: normal; - height: 100%; - display: inline-block; - vertical-align: top; - margin-bottom: -30px; + white-space: normal; + height: 100%; + display: inline-block; + vertical-align: top; + margin-bottom: -30px; } .CodeMirror-gutter-wrapper { - position: absolute; - z-index: 4; - background: none !important; - border: none !important; + position: absolute; + z-index: 4; + background: none !important; + border: none !important; } .CodeMirror-gutter-background { - position: absolute; - top: 0; - bottom: 0; - z-index: 4; + position: absolute; + top: 0; + bottom: 0; + z-index: 4; } .CodeMirror-gutter-elt { - position: absolute; - cursor: default; - z-index: 4; + position: absolute; + cursor: default; + z-index: 4; } .CodeMirror-gutter-wrapper ::selection { - background-color: transparent + background-color: transparent } .CodeMirror-gutter-wrapper ::-moz-selection { - background-color: transparent + background-color: transparent } .CodeMirror-lines { - cursor: text; - min-height: 1px; /* prevents collapsing before first draw */ + cursor: text; + min-height: 1px; /* prevents collapsing before first draw */ } .CodeMirror pre { - /* Reset some styles that the rest of the page might have set */ - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; - border-width: 0; - background: transparent; - font-family: inherit; - font-size: inherit; - margin: 0; - white-space: pre; - word-wrap: normal; - line-height: inherit; - color: inherit; - z-index: 2; - position: relative; - overflow: visible; - -webkit-tap-highlight-color: transparent; - -webkit-font-variant-ligatures: contextual; - font-variant-ligatures: contextual; + /* Reset some styles that the rest of the page might have set */ + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; + border-width: 0; + background: transparent; + font-family: inherit; + font-size: inherit; + margin: 0; + white-space: pre; + word-wrap: normal; + line-height: inherit; + color: inherit; + z-index: 2; + position: relative; + overflow: visible; + -webkit-tap-highlight-color: transparent; + -webkit-font-variant-ligatures: contextual; + font-variant-ligatures: contextual; } .CodeMirror-wrap pre { - word-wrap: break-word; - white-space: pre-wrap; - word-break: normal; + word-wrap: break-word; + white-space: pre-wrap; + word-break: normal; } .CodeMirror-linebackground { - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - z-index: 0; + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 0; } .CodeMirror-linewidget { - position: relative; - z-index: 2; - padding: 0.1px; /* Force widget margins to stay inside of the container */ + position: relative; + z-index: 2; + padding: 0.1px; /* Force widget margins to stay inside of the container */ } .CodeMirror-widget { } .CodeMirror-rtl pre { - direction: rtl; + direction: rtl; } .CodeMirror-code { - outline: none; + outline: none; } /* Force content-box sizing for the elements where we expect it */ @@ -451,196 +451,361 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket { .CodeMirror-gutter, .CodeMirror-gutters, .CodeMirror-linenumber { - -moz-box-sizing: content-box; - box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; } .CodeMirror-measure { - position: absolute; - width: 100%; - height: 0; - overflow: hidden; - visibility: hidden; + position: absolute; + width: 100%; + height: 0; + overflow: hidden; + visibility: hidden; } .CodeMirror-cursor { - position: absolute; - pointer-events: none; + position: absolute; + pointer-events: none; } .CodeMirror-measure pre { - position: static; + position: static; } div.CodeMirror-cursors { - visibility: hidden; - position: relative; - z-index: 3; + visibility: hidden; + position: relative; + z-index: 3; } div.CodeMirror-dragcursors { - visibility: visible; + visibility: visible; } .CodeMirror-focused div.CodeMirror-cursors { - visibility: visible; + visibility: visible; } .CodeMirror-selected { - background: #d9d9d9; + background: #d9d9d9; } .CodeMirror-focused .CodeMirror-selected { - background: #d7d4f0; + background: #d7d4f0; } .CodeMirror-crosshair { - cursor: crosshair; + cursor: crosshair; } .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { - background: #d7d4f0; + background: #d7d4f0; } .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { - background: #d7d4f0; + background: #d7d4f0; } .cm-searching { - background-color: #ffa; - background-color: rgba(255, 255, 0, .4); + background-color: #ffa; + background-color: rgba(255, 255, 0, .4); } /* Used to force a border model for a node */ .cm-force-border { - padding-right: .1px; + padding-right: .1px; } @media print { - /* Hide the cursor when printing */ - .CodeMirror div.CodeMirror-cursors { - visibility: hidden; - } + /* Hide the cursor when printing */ + .CodeMirror div.CodeMirror-cursors { + visibility: hidden; + } } /* See issue #2901 */ .cm-tab-wrap-hack:after { - content: ''; + content: ''; } /* Help users use markselection to safely style text background */ span.CodeMirror-selectedtext { - background: none; + background: none; } +/* ========= show-hint.css ========= */ + .cm-matchhighlight {background-color: #dedede} .CodeMirror-hints { - position: absolute; - z-index: 301; - overflow: hidden; - list-style: none; + position: absolute; + z-index: 301; + overflow: hidden; + list-style: none; - margin: 0; - padding: 2px; + margin: 0; + padding: 2px; - -webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2); - -moz-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2); - box-shadow: 2px 3px 5px rgba(0, 0, 0, .2); - border-radius: 3px; - border: 1px solid silver; + -webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2); + -moz-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2); + box-shadow: 2px 3px 5px rgba(0, 0, 0, .2); + border-radius: 3px; + border: 1px solid silver; - background: white; - font-size: 90%; - font-family: monospace; + background: white; + font-size: 90%; + font-family: monospace; - max-height: 20em; - overflow-y: auto; + max-height: 20em; + overflow-y: auto; } .CodeMirror-hint { - margin: 0; - padding: 0 4px; - border-radius: 2px; - white-space: pre; - color: black; - cursor: pointer; + margin: 0; + padding: 0 4px; + border-radius: 2px; + white-space: pre; + color: black; + cursor: pointer; } li.CodeMirror-hint-active { - background: #08f; - color: white; + background: #08f; + color: white; } +/* ========= lint.css ========= */ + /* The lint marker gutter */ .CodeMirror-lint-markers { - width: 16px; + width: 16px; } .CodeMirror-lint-tooltip { - background-color: #ffd; - border: 1px solid black; - border-radius: 4px 4px 4px 4px; - color: black; - font-family: monospace; - font-size: 10pt; - overflow: hidden; - padding: 2px 5px; - position: fixed; - white-space: pre; - white-space: pre-wrap; - z-index: 330; - max-width: 600px; - opacity: 0; - transition: opacity .4s; - -moz-transition: opacity .4s; - -webkit-transition: opacity .4s; - -o-transition: opacity .4s; - -ms-transition: opacity .4s; + background-color: #ffd; + border: 1px solid black; + border-radius: 4px 4px 4px 4px; + color: black; + font-family: monospace; + font-size: 10pt; + overflow: hidden; + padding: 2px 5px; + position: fixed; + white-space: pre; + white-space: pre-wrap; + z-index: 330; + max-width: 600px; + opacity: 0; + transition: opacity .4s; + -moz-transition: opacity .4s; + -webkit-transition: opacity .4s; + -o-transition: opacity .4s; + -ms-transition: opacity .4s; } .CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning { - background-position: left bottom; - background-repeat: repeat-x; + background-position: left bottom; + background-repeat: repeat-x; } .CodeMirror-lint-mark-error { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg=="); + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg=="); } .CodeMirror-lint-mark-warning { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII="); + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII="); } .CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning { - background-position: center center; - background-repeat: no-repeat; - cursor: pointer; - display: inline-block; - height: 16px; - width: 16px; - vertical-align: middle; - position: relative; + background-position: center center; + background-repeat: no-repeat; + cursor: pointer; + display: inline-block; + height: 16px; + width: 16px; + vertical-align: middle; + position: relative; } .CodeMirror-lint-message-error, .CodeMirror-lint-message-warning { - padding-left: 18px; - background-position: top left; - background-repeat: no-repeat; + padding-left: 18px; + background-position: top left; + background-repeat: no-repeat; } .CodeMirror-lint-marker-error, .CodeMirror-lint-message-error { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII="); + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII="); } .CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII="); + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII="); } .CodeMirror-lint-marker-multiple { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC"); - background-repeat: no-repeat; - background-position: right bottom; - width: 100%; - height: 100%; -} \ No newline at end of file + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC"); + background-repeat: no-repeat; + background-position: right bottom; + width: 100%; + height: 100%; +} + +/* ========= dialog.css ========= */ + +.CodeMirror-dialog { + position: absolute; + left: 0; right: 0; + background: inherit; + z-index: 15; + padding: .1em .8em; + overflow: hidden; + color: inherit; +} + +.CodeMirror-dialog-top { + border-bottom: 1px solid #eee; + top: 0; +} + +.CodeMirror-dialog-bottom { + border-top: 1px solid #eee; + bottom: 0; +} + +.CodeMirror-dialog input { + border: none; + outline: none; + background: transparent; + width: 20em; + color: inherit; + font-family: monospace; +} + +.CodeMirror-dialog button { + font-size: 70%; +} + +/* ========= dialog.css ========= */ + +.CodeMirror-dialog { + position: absolute; + left: 0; right: 0; + background: inherit; + z-index: 15; + padding: .1em .8em; + overflow: hidden; + color: inherit; +} + +.CodeMirror-dialog-top { + border-bottom: 1px solid #eee; + top: 0; +} + +.CodeMirror-dialog-bottom { + border-top: 1px solid #eee; + bottom: 0; +} + +.CodeMirror-dialog input { + border: none; + outline: none; + background: transparent; + width: 20em; + color: inherit; + font-family: monospace; +} + +.CodeMirror-dialog button { + font-size: 70%; +} + + +/* ========= tern.css ========= */ + +.CodeMirror-Tern-completion { + padding-left: 22px; + position: relative; + line-height: 1.5; +} +.CodeMirror-Tern-completion:before { + position: absolute; + left: 2px; + bottom: 2px; + border-radius: 50%; + font-size: 12px; + font-weight: bold; + height: 15px; + width: 15px; + line-height: 16px; + text-align: center; + color: white; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.CodeMirror-Tern-completion-unknown:before { + content: "?"; + background: #4bb; +} +.CodeMirror-Tern-completion-object:before { + content: "O"; + background: #77c; +} +.CodeMirror-Tern-completion-fn:before { + content: "F"; + background: #7c7; +} +.CodeMirror-Tern-completion-array:before { + content: "A"; + background: #c66; +} +.CodeMirror-Tern-completion-number:before { + content: "1"; + background: #999; +} +.CodeMirror-Tern-completion-string:before { + content: "S"; + background: #999; +} +.CodeMirror-Tern-completion-bool:before { + content: "B"; + background: #999; +} + +.CodeMirror-Tern-completion-guess { + color: #999; +} + +.CodeMirror-Tern-tooltip { + border: 1px solid silver; + border-radius: 3px; + color: #444; + padding: 2px 5px; + font-size: 90%; + font-family: monospace; + background-color: white; + white-space: pre-wrap; + + max-width: 40em; + position: absolute; + z-index: 330; + -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + box-shadow: 2px 3px 5px rgba(0,0,0,.2); + + transition: opacity 1s; + -moz-transition: opacity 1s; + -webkit-transition: opacity 1s; + -o-transition: opacity 1s; + -ms-transition: opacity 1s; +} + +.CodeMirror-Tern-hint-doc { + max-width: 25em; + margin-top: -3px; +} + +.CodeMirror-Tern-fname { color: black; } +.CodeMirror-Tern-farg { color: #70a; } +.CodeMirror-Tern-farg-current { text-decoration: underline; } +.CodeMirror-Tern-type { color: #07c; } +.CodeMirror-Tern-fhint-guess { opacity: .7; } diff --git a/_server/CodeMirror/defs.js b/_server/CodeMirror/defs.js new file mode 100644 index 00000000..3b940fd8 --- /dev/null +++ b/_server/CodeMirror/defs.js @@ -0,0 +1,6087 @@ +var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ +{ + "!name": "browser", + "!define": { + "Geolocation": { + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Geolocation", + "!doc": "The Geolocation interface represents an object able to programmatically obtain the position of the device. It gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location.", + "clearWatch": { + "!type": "fn(id: number)", + "!doc": "The Geolocation.clearWatch() method is used to unregister location/error monitoring handlers previously installed using Geolocation.watchPosition().", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/clearWatch" + }, + "getCurrentPosition": { + "!type": "fn(sucess: fn(Position), error?: fn(PositionError), options?: PositionOptions)", + "!doc": "The Geolocation.getCurrentPosition() method is used to get the current position of the device.", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition" + }, + "watchPosition": { + "!type": "fn(sucess: fn(Position), error?: fn(PositionError), options?: PositionOptions)", + "!doc": "The Geolocation.watchPosition() method is used to register a handler function that will be called automatically each time the position of the device changes. You can also, optionally, specify an error handling callback function.", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition" + } + }, + "PositionOptions": { + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions", + "!doc": "The PositionOptions interface describes an object containing option properties to pass as a parameter of Geolocation.getCurrentPosition() and Geolocation.watchPosition().", + "enableHighAccuracy": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions/enableHighAccuracy", + "!doc": "The PositionOptions.enableHighAccuracy property is a Boolean that indicates the application would like to receive the best possible results. If true and if the device is able to provide a more accurate position, it will do so. Note that this can result in slower response times or increased power consumption (with a GPS chip on a mobile device for example). On the other hand, if false (the default value), the device can take the liberty to save resources by responding more quickly and/or using less power." + }, + "timeout": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions/timeout", + "!doc": "The PositionOptions.timeout property is a positive long value representing the maximum length of time (in milliseconds) the device is allowed to take in order to return a position. The default value is Infinity, meaning that getCurrentPosition() won't return until the position is available." + }, + "maximumAge": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions/maximumAge", + "!doc": "The PositionOptions.maximumAge property is a positive long value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return. If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position. If set to Infinity the device must return a cached position regardless of its age." + } + }, + "PositionError": { + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/PositionError", + "!doc": "The PositionError interface represents the reason of an error occurring when using the geolocating device.", + "code": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/PositionError/code", + "!doc": "The PositionError.code read-only property is an unsigned short representing the error code." + }, + "message": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/PositionError/message", + "!doc": "The PositionError.message read-only property returns a human-readable DOMString describing the details of the error." + } + }, + "Position": { + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Position", + "!doc": "The Position interface represents the position of the concerned device at a given time. The position, represented by a Coordinates object, comprehends the 2D position of the device, on a spheroid representing the Earth, but also its altitude and its speed.", + "coords": { + "!type": "Coordinates", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Position/coords", + "!doc": "The Position.coords read-only property, a Coordinates object, represents a geographic attitude: it contains the location, that is longitude and latitude on the Earth, the altitude, and the speed of the object concerned, regrouped inside the returned value. It also contains accuracy information about these values." + }, + "timestamp": { + "!type": "+DOMTimeStamp", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Position/timestamp", + "!doc": "The Position.timestamp read-only property, a DOMTimeStamp object, represents the date and the time of the creation of the Position object it belongs to. The precision is to the millisecond." + } + }, + "Coordinates": { + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Coordinates", + "!doc": "The Coordinates interface represents the position and altitude of the device on Earth, as well as the accuracy with which these properties are calculated.", + "latitude": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Coordinates/latitude", + "!doc": "The Coordinates.latitude read-only property is a double representing the latitude of the position in decimal degrees." + }, + "longitude": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Coordinates/longitude", + "!doc": "The Coordinates.longitude read-only property is a double representing the longitude of the position in decimal degrees." + }, + "altitude": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Coordinates/altitude", + "!doc": "The Coordinates.altitude read-only property is a double representing the altitude of the position in meters, relative to sea level. This value is null if the implementation cannot provide this data." + }, + "accuracy": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Coordinates/accuracy", + "!doc": "The Coordinates.accuracy read-only property is a strictly positive double representing the accuracy, with a 95% confidence level, of the Coordinates.latitude and Coordinates.longitude properties expressed in meters." + }, + "altitudeAccuracy": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Coordinates/altitudeAccuracy", + "!doc": "The Coordinates.altitudeAccuracy read-only property is a strictly positive double representing the accuracy, with a 95% confidence level, of the altitude expressed in meters. This value is null if the implementation doesn't support measuring altitude." + }, + "heading": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Coordinates/heading", + "!doc": "The Coordinates.heading read-only property is a double representing the direction in which the device is traveling. This value, specified in degrees, indicates how far off from heading due north the device is. 0 degrees represents true true north, and the direction is determined clockwise (which means that east is 90 degrees and west is 270 degrees). If Coordinates.speed is 0, heading is NaN. If the device is not able to provide heading information, this value is null." + }, + "speed": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Coordinates/speed", + "!doc": "The Coordinates.speed read-only property is a double representing the velocity of the device in meters per second. This value is null if the implementation is not able to measure it." + } + }, + "MutationObserverInit": { + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver#MutationObserverInit", + "childList": "bool", + "attributes": "bool", + "characterData": "bool", + "subtree": "bool", + "attributeOldValue": "bool", + "characterDataOldValue": "bool", + "attributeFilter": "[string]" + }, + "Permissions": { + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Permissions", + "query": { + "!type": "fn(descriptor: PermissionDescriptor) -> +Promise[:t=PermissionStatus]", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query", + "!doc": "Returns the user permission status for a given API." + }, + "revoke": { + "!type": "fn(descriptor: PermissionDescriptor) -> +Promise[:t=PermissionStatus]", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Permissions/revoke", + "!doc": "Revokes the permission currently set on a given API." + } + }, + "PermissionDescriptor": { + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query", + "name": { + "!type": "string", + "!doc": "The name of the API whose permissions you want to query. Valid values are 'geolocation', 'midi', 'notifications', 'push', 'persistent-storage', 'camera' and 'microphone'." + }, + "userVisibleOnly": { + "!type": "bool", + "!doc": "Indicates whether you want to show a notification for every message or be able to send silent push notifications. The default is false." + }, + "sysex": { + "!type": "bool", + "!doc": "Indicates whether you need and/or receive system exclusive messages. The default is false." + } + }, + "PermissionStatus": { + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/PermissionStatus", + "state": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/PermissionStatus/state", + "!doc": "Returns the state of a requested permission; one of 'granted', 'denied', or 'prompt'." + }, + "onchange": { + "!type": "?", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/PermissionStatus/onchange", + "!doc": "An event called whenever PermissionStatus.status changes." + } + } + }, + "location": { + "assign": { + "!type": "fn(url: string)", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "Load the document at the provided URL." + }, + "replace": { + "!type": "fn(url: string)", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "Replace the current document with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session history, meaning the user won't be able to use the Back button to navigate to it." + }, + "reload": { + "!type": "fn()", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "Reload the document from the current URL. forceget is a boolean, which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache." + }, + "origin": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "The origin of the URL." + }, + "hash": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "The part of the URL that follows the # symbol, including the # symbol." + }, + "search": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "The part of the URL that follows the ? symbol, including the ? symbol." + }, + "pathname": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "The path (relative to the host)." + }, + "port": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "The port number of the URL." + }, + "hostname": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "The host name (without the port number or square brackets)." + }, + "host": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "The host name and port number." + }, + "protocol": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "The protocol of the URL." + }, + "href": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "The entire URL." + }, + "!url": "https://developer.mozilla.org/en/docs/DOM/window.location", + "!doc": "Returns a location object with information about the current location of the document. Assigning to the location property changes the current page to the new address." + }, + "Node": { + "!type": "fn()", + "prototype": { + "parentElement": { + "!type": "+Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.parentElement", + "!doc": "Returns the DOM node's parent Element, or null if the node either has no parent, or its parent isn't a DOM Element." + }, + "textContent": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.textContent", + "!doc": "Gets or sets the text content of a node and its descendants." + }, + "baseURI": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.baseURI", + "!doc": "The absolute base URI of a node or null if unable to obtain an absolute URI." + }, + "localName": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.localName", + "!doc": "Returns the local part of the qualified name of this node." + }, + "prefix": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.prefix", + "!doc": "Returns the namespace prefix of the specified node, or null if no prefix is specified. This property is read only." + }, + "namespaceURI": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.namespaceURI", + "!doc": "The namespace URI of the node, or null if the node is not in a namespace (read-only). When the node is a document, it returns the XML namespace for the current document." + }, + "ownerDocument": { + "!type": "+Document", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.ownerDocument", + "!doc": "The ownerDocument property returns the top-level document object for this node." + }, + "attributes": { + "!type": "+NamedNodeMap", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.attributes", + "!doc": "A collection of all attribute nodes registered to the specified node. It is a NamedNodeMap,not an Array, so it has no Array methods and the Attr nodes' indexes may differ among browsers." + }, + "nextSibling": { + "!type": "+Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.nextSibling", + "!doc": "Returns the node immediately following the specified one in its parent's childNodes list, or null if the specified node is the last node in that list." + }, + "previousSibling": { + "!type": "+Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.previousSibling", + "!doc": "Returns the node immediately preceding the specified one in its parent's childNodes list, null if the specified node is the first in that list." + }, + "lastChild": { + "!type": "+Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.lastChild", + "!doc": "Returns the last child of a node." + }, + "firstChild": { + "!type": "+Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.firstChild", + "!doc": "Returns the node's first child in the tree, or null if the node is childless. If the node is a Document, it returns the first node in the list of its direct children." + }, + "childNodes": { + "!type": "+NodeList", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.childNodes", + "!doc": "Returns a collection of child nodes of the given element." + }, + "parentNode": { + "!type": "+Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.parentNode", + "!doc": "Returns the parent of the specified node in the DOM tree." + }, + "nodeType": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.nodeType", + "!doc": "Returns an integer code representing the type of the node." + }, + "nodeValue": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.nodeValue", + "!doc": "Returns or sets the value of the current node." + }, + "nodeName": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.nodeName", + "!doc": "Returns the name of the current node as a string." + }, + "tagName": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.nodeName", + "!doc": "Returns the name of the current node as a string." + }, + "insertBefore": { + "!type": "fn(newElt: +Element, before: +Element) -> +Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.insertBefore", + "!doc": "Inserts the specified node before a reference element as a child of the current node." + }, + "replaceChild": { + "!type": "fn(newChild: +Element, oldChild: +Element) -> +Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.replaceChild", + "!doc": "Replaces one child node of the specified element with another." + }, + "removeChild": { + "!type": "fn(oldNode: +Element) -> +Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.removeChild", + "!doc": "Removes a child node from the DOM. Returns removed node." + }, + "appendChild": { + "!type": "fn(newNode: +Element) -> +Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.appendChild", + "!doc": "Adds a node to the end of the list of children of a specified parent node. If the node already exists it is removed from current parent node, then added to new parent node." + }, + "hasChildNodes": { + "!type": "fn() -> bool", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.hasChildNodes", + "!doc": "Returns a Boolean value indicating whether the current Node has child nodes or not." + }, + "cloneNode": { + "!type": "fn(deep: bool) -> +Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.cloneNode", + "!doc": "Returns a duplicate of the node on which this method was called." + }, + "normalize": { + "!type": "fn()", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.normalize", + "!doc": "Puts the specified node and all of its subtree into a \"normalized\" form. In a normalized subtree, no text nodes in the subtree are empty and there are no adjacent text nodes." + }, + "isSupported": { + "!type": "fn(features: string, version: number) -> bool", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.isSupported", + "!doc": "Tests whether the DOM implementation implements a specific feature and that feature is supported by this node." + }, + "hasAttributes": { + "!type": "fn() -> bool", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.hasAttributes", + "!doc": "Returns a boolean value of true or false, indicating if the current element has any attributes or not." + }, + "lookupPrefix": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.lookupPrefix", + "!doc": "Returns the prefix for a given namespaceURI if present, and null if not. When multiple prefixes are possible, the result is implementation-dependent." + }, + "isDefaultNamespace": { + "!type": "fn(uri: string) -> bool", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.isDefaultNamespace", + "!doc": "Accepts a namespace URI as an argument and returns true if the namespace is the default namespace on the given node or false if not." + }, + "lookupNamespaceURI": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.lookupNamespaceURI", + "!doc": "Takes a prefix and returns the namespaceURI associated with it on the given node if found (and null if not). Supplying null for the prefix will return the default namespace." + }, + "addEventListener": { + "!type": "fn(type: string, listener: fn(e: +Event), capture: bool)", + "!url": "https://developer.mozilla.org/en/docs/DOM/EventTarget.addEventListener", + "!doc": "Registers a single event listener on a single target. The event target may be a single element in a document, the document itself, a window, or an XMLHttpRequest." + }, + "removeEventListener": { + "!type": "fn(type: string, listener: fn(), capture: bool)", + "!url": "https://developer.mozilla.org/en/docs/DOM/EventTarget.removeEventListener", + "!doc": "Allows the removal of event listeners from the event target." + }, + "isSameNode": { + "!type": "fn(other: +Element) -> bool", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.isSameNode", + "!doc": "Tests whether two nodes are the same, that is they reference the same object." + }, + "isEqualNode": { + "!type": "fn(other: +Element) -> bool", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.isEqualNode", + "!doc": "Tests whether two nodes are equal." + }, + "compareDocumentPosition": { + "!type": "fn(other: +Element) -> number", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.compareDocumentPosition", + "!doc": "Compares the position of the current node against another node in any other document." + }, + "contains": { + "!type": "fn(other: +Element) -> bool", + "!url": "https://developer.mozilla.org/en/docs/DOM/Node.contains", + "!doc": "Indicates whether a node is a descendent of a given node." + }, + "dispatchEvent": { + "!type": "fn(event: +Event) -> bool", + "!url": "https://developer.mozilla.org/en/docs/DOM/EventTarget.dispatchEvent", + "!doc": "Dispatches an event into the event system. The event is subject to the same capturing and bubbling behavior as directly dispatched events." + }, + "innerText": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText", + "!doc": "Gets or sets the text content of a node and its descendants." + }, + "ELEMENT_NODE": "number", + "ATTRIBUTE_NODE": "number", + "TEXT_NODE": "number", + "CDATA_SECTION_NODE": "number", + "ENTITY_REFERENCE_NODE": "number", + "ENTITY_NODE": "number", + "PROCESSING_INSTRUCTION_NODE": "number", + "COMMENT_NODE": "number", + "DOCUMENT_NODE": "number", + "DOCUMENT_TYPE_NODE": "number", + "DOCUMENT_FRAGMENT_NODE": "number", + "NOTATION_NODE": "number", + "DOCUMENT_POSITION_DISCONNECTED": "number", + "DOCUMENT_POSITION_PRECEDING": "number", + "DOCUMENT_POSITION_FOLLOWING": "number", + "DOCUMENT_POSITION_CONTAINS": "number", + "DOCUMENT_POSITION_CONTAINED_BY": "number", + "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC": "number" + }, + "!url": "https://developer.mozilla.org/en/docs/DOM/Node", + "!doc": "A Node is an interface from which a number of DOM types inherit, and allows these various types to be treated (or tested) similarly." + }, + "Element": { + "!type": "fn()", + "prototype": { + "!proto": "Node.prototype", + "getAttribute": { + "!type": "fn(name: string) -> string", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.getAttribute", + "!doc": "Returns the value of the named attribute on the specified element. If the named attribute does not exist, the value returned will either be null or \"\" (the empty string)." + }, + "setAttribute": { + "!type": "fn(name: string, value: string)", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.setAttribute", + "!doc": "Adds a new attribute or changes the value of an existing attribute on the specified element." + }, + "removeAttribute": { + "!type": "fn(name: string)", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.removeAttribute", + "!doc": "Removes an attribute from the specified element." + }, + "getAttributeNode": { + "!type": "fn(name: string) -> +Attr", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.getAttributeNode", + "!doc": "Returns the specified attribute of the specified element, as an Attr node." + }, + "getElementsByTagName": { + "!type": "fn(tagName: string) -> +NodeList", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.getElementsByTagName", + "!doc": "Returns a list of elements with the given tag name. The subtree underneath the specified element is searched, excluding the element itself. The returned list is live, meaning that it updates itself with the DOM tree automatically. Consequently, there is no need to call several times element.getElementsByTagName with the same element and arguments." + }, + "getElementsByTagNameNS": { + "!type": "fn(ns: string, tagName: string) -> +NodeList", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.getElementsByTagNameNS", + "!doc": "Returns a list of elements with the given tag name belonging to the given namespace." + }, + "getAttributeNS": { + "!type": "fn(ns: string, name: string) -> string", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.getAttributeNS", + "!doc": "Returns the string value of the attribute with the specified namespace and name. If the named attribute does not exist, the value returned will either be null or \"\" (the empty string)." + }, + "setAttributeNS": { + "!type": "fn(ns: string, name: string, value: string)", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.setAttributeNS", + "!doc": "Adds a new attribute or changes the value of an attribute with the given namespace and name." + }, + "removeAttributeNS": { + "!type": "fn(ns: string, name: string)", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.removeAttributeNS", + "!doc": "removeAttributeNS removes the specified attribute from an element." + }, + "getAttributeNodeNS": { + "!type": "fn(ns: string, name: string) -> +Attr", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.getAttributeNodeNS", + "!doc": "Returns the Attr node for the attribute with the given namespace and name." + }, + "hasAttribute": { + "!type": "fn(name: string) -> bool", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.hasAttribute", + "!doc": "hasAttribute returns a boolean value indicating whether the specified element has the specified attribute or not." + }, + "hasAttributeNS": { + "!type": "fn(ns: string, name: string) -> bool", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.hasAttributeNS", + "!doc": "hasAttributeNS returns a boolean value indicating whether the current element has the specified attribute." + }, + "matches": { + "!type": "fn(selectorString: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/Element/matches", + "!doc": "The Element.matches() method returns true if the element would be selected by the specified selector string; otherwise, returns false." + }, + "append": { + "!type": "fn(...nodes: [string|Node])", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/append", + "!doc": "This is an experimental technology\n\nThe Element.append method inserts a set of Node objects or DOMString objects after the last child of the ParentNode. DOMString objects are inserted as equivalent Text nodes." + }, + "prepend": { + "!type": "fn(...nodes: [string|Node])", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/prepend", + "!doc": "This is an experimental technology.\n\nThe Element.prepend method inserts a set of Node objects or DOMString objects before the first child of the ParentNode. DOMString objects are inserted as equivalent Text nodes." + }, + "before": { + "!type": "fn(...nodes: [string|Node])", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/before", + "!doc": "This is an experimental technology.\n\nThe Element.before method inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just before this ChildNode. DOMString objects are inserted as equivalent Text nodes." + }, + "after": { + "!type": "fn(...nodes: [string|Node])", + "!url": "https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/after", + "!doc": "This is an experimental technology.\n\nThe Element.after() method inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just after this ChildNode. DOMString objects are inserted as equivalent Text nodes." + }, + "closest": { + "!type": "fn(selectors?: string)", + "!url": "https://developer.mozilla.org/en/docs/Web/API/Element/closest", + "!doc": "This is an experimental technology.\n\nThe Element.closest() method returns the closest ancestor of the current element (or the current element itself) which matches the selectors given in parameter. If there isn't such an ancestor, it returns null." + }, + "focus": { + "!type": "fn()", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.focus", + "!doc": "Sets focus on the specified element, if it can be focused." + }, + "blur": { + "!type": "fn()", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.blur", + "!doc": "The blur method removes keyboard focus from the current element." + }, + "scrollIntoView": { + "!type": "fn(top: bool)", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.scrollIntoView", + "!doc": "The scrollIntoView() method scrolls the element into view." + }, + "scrollByLines": { + "!type": "fn(lines: number)", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.scrollByLines", + "!doc": "Scrolls the document by the given number of lines." + }, + "scrollByPages": { + "!type": "fn(pages: number)", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.scrollByPages", + "!doc": "Scrolls the current document by the specified number of pages." + }, + "getElementsByClassName": { + "!type": "fn(name: string) -> +NodeList", + "!url": "https://developer.mozilla.org/en/docs/DOM/document.getElementsByClassName", + "!doc": "Returns a set of elements which have all the given class names. When called on the document object, the complete document is searched, including the root node. You may also call getElementsByClassName on any element; it will return only elements which are descendants of the specified root element with the given class names." + }, + "querySelector": { + "!type": "fn(selectors: string) -> +Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Element.querySelector", + "!doc": "Returns the first element that is a descendent of the element on which it is invoked that matches the specified group of selectors." + }, + "querySelectorAll": { + "!type": "fn(selectors: string) -> +NodeList", + "!url": "https://developer.mozilla.org/en/docs/DOM/Element.querySelectorAll", + "!doc": "Returns a non-live NodeList of all elements descended from the element on which it is invoked that match the specified group of CSS selectors." + }, + "getClientRects": { + "!type": "fn() -> [+ClientRect]", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.getClientRects", + "!doc": "Returns a collection of rectangles that indicate the bounding rectangles for each box in a client." + }, + "getBoundingClientRect": { + "!type": "fn() -> +ClientRect", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.getBoundingClientRect", + "!doc": "Returns a text rectangle object that encloses a group of text rectangles." + }, + "setAttributeNode": { + "!type": "fn(attr: +Attr) -> +Attr", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.setAttributeNode", + "!doc": "Adds a new Attr node to the specified element." + }, + "removeAttributeNode": { + "!type": "fn(attr: +Attr) -> +Attr", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.removeAttributeNode", + "!doc": "Removes the specified attribute from the current element." + }, + "setAttributeNodeNS": { + "!type": "fn(attr: +Attr) -> +Attr", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.setAttributeNodeNS", + "!doc": "Adds a new namespaced attribute node to an element." + }, + "insertAdjacentHTML": { + "!type": "fn(position: string, text: string)", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.insertAdjacentHTML", + "!doc": "Parses the specified text as HTML or XML and inserts the resulting nodes into the DOM tree at a specified position. It does not reparse the element it is being used on and thus it does not corrupt the existing elements inside the element. This, and avoiding the extra step of serialization make it much faster than direct innerHTML manipulation." + }, + "children": { + "!type": "+HTMLCollection", + "!url": "https://developer.mozilla.org/en/docs/DOM/Element.children", + "!doc": "Returns a collection of child elements of the given element." + }, + "childElementCount": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/Element.childElementCount", + "!doc": "Returns the number of child elements of the given element." + }, + "className": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.className", + "!doc": "Gets and sets the value of the class attribute of the specified element." + }, + "style": { + "cssText": "string", + "alignmentBaseline": "string", + "background": "string", + "backgroundAttachment": "string", + "backgroundClip": "string", + "backgroundColor": "string", + "backgroundImage": "string", + "backgroundOrigin": "string", + "backgroundPosition": "string", + "backgroundPositionX": "string", + "backgroundPositionY": "string", + "backgroundRepeat": "string", + "backgroundRepeatX": "string", + "backgroundRepeatY": "string", + "backgroundSize": "string", + "baselineShift": "string", + "border": "string", + "borderBottom": "string", + "borderBottomColor": "string", + "borderBottomLeftRadius": "string", + "borderBottomRightRadius": "string", + "borderBottomStyle": "string", + "borderBottomWidth": "string", + "borderCollapse": "string", + "borderColor": "string", + "borderImage": "string", + "borderImageOutset": "string", + "borderImageRepeat": "string", + "borderImageSlice": "string", + "borderImageSource": "string", + "borderImageWidth": "string", + "borderLeft": "string", + "borderLeftColor": "string", + "borderLeftStyle": "string", + "borderLeftWidth": "string", + "borderRadius": "string", + "borderRight": "string", + "borderRightColor": "string", + "borderRightStyle": "string", + "borderRightWidth": "string", + "borderSpacing": "string", + "borderStyle": "string", + "borderTop": "string", + "borderTopColor": "string", + "borderTopLeftRadius": "string", + "borderTopRightRadius": "string", + "borderTopStyle": "string", + "borderTopWidth": "string", + "borderWidth": "string", + "bottom": "string", + "boxShadow": "string", + "boxSizing": "string", + "captionSide": "string", + "clear": "string", + "clip": "string", + "clipPath": "string", + "clipRule": "string", + "color": "string", + "colorInterpolation": "string", + "colorInterpolationFilters": "string", + "colorProfile": "string", + "colorRendering": "string", + "content": "string", + "counterIncrement": "string", + "counterReset": "string", + "cursor": "string", + "direction": "string", + "display": "string", + "dominantBaseline": "string", + "emptyCells": "string", + "enableBackground": "string", + "fill": "string", + "fillOpacity": "string", + "fillRule": "string", + "filter": "string", + "float": "string", + "floodColor": "string", + "floodOpacity": "string", + "font": "string", + "fontFamily": "string", + "fontSize": "string", + "fontStretch": "string", + "fontStyle": "string", + "fontVariant": "string", + "fontWeight": "string", + "glyphOrientationHorizontal": "string", + "glyphOrientationVertical": "string", + "height": "string", + "imageRendering": "string", + "kerning": "string", + "left": "string", + "letterSpacing": "string", + "lightingColor": "string", + "lineHeight": "string", + "listStyle": "string", + "listStyleImage": "string", + "listStylePosition": "string", + "listStyleType": "string", + "margin": "string", + "marginBottom": "string", + "marginLeft": "string", + "marginRight": "string", + "marginTop": "string", + "marker": "string", + "markerEnd": "string", + "markerMid": "string", + "markerStart": "string", + "mask": "string", + "maxHeight": "string", + "maxWidth": "string", + "minHeight": "string", + "minWidth": "string", + "opacity": "string", + "orphans": "string", + "outline": "string", + "outlineColor": "string", + "outlineOffset": "string", + "outlineStyle": "string", + "outlineWidth": "string", + "overflow": "string", + "overflowWrap": "string", + "overflowX": "string", + "overflowY": "string", + "padding": "string", + "paddingBottom": "string", + "paddingLeft": "string", + "paddingRight": "string", + "paddingTop": "string", + "page": "string", + "pageBreakAfter": "string", + "pageBreakBefore": "string", + "pageBreakInside": "string", + "pointerEvents": "string", + "position": "string", + "quotes": "string", + "resize": "string", + "right": "string", + "shapeRendering": "string", + "size": "string", + "speak": "string", + "src": "string", + "stopColor": "string", + "stopOpacity": "string", + "stroke": "string", + "strokeDasharray": "string", + "strokeDashoffset": "string", + "strokeLinecap": "string", + "strokeLinejoin": "string", + "strokeMiterlimit": "string", + "strokeOpacity": "string", + "strokeWidth": "string", + "tabSize": "string", + "tableLayout": "string", + "textAlign": "string", + "textAnchor": "string", + "textDecoration": "string", + "textIndent": "string", + "textLineThrough": "string", + "textLineThroughColor": "string", + "textLineThroughMode": "string", + "textLineThroughStyle": "string", + "textLineThroughWidth": "string", + "textOverflow": "string", + "textOverline": "string", + "textOverlineColor": "string", + "textOverlineMode": "string", + "textOverlineStyle": "string", + "textOverlineWidth": "string", + "textRendering": "string", + "textShadow": "string", + "textTransform": "string", + "textUnderline": "string", + "textUnderlineColor": "string", + "textUnderlineMode": "string", + "textUnderlineStyle": "string", + "textUnderlineWidth": "string", + "top": "string", + "unicodeBidi": "string", + "unicodeRange": "string", + "vectorEffect": "string", + "verticalAlign": "string", + "visibility": "string", + "whiteSpace": "string", + "width": "string", + "wordBreak": "string", + "wordSpacing": "string", + "wordWrap": "string", + "writingMode": "string", + "zIndex": "string", + "zoom": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.style", + "!doc": "Returns an object that represents the element's style attribute." + }, + "classList": { + "!type": "+DOMTokenList", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.classList", + "!doc": "Returns a token list of the class attribute of the element." + }, + "contentEditable": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en/docs/DOM/Element.contentEditable", + "!doc": "Indicates whether or not the element is editable." + }, + "firstElementChild": { + "!type": "+Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Element.firstElementChild", + "!doc": "Returns the element's first child element or null if there are no child elements." + }, + "lastElementChild": { + "!type": "+Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Element.lastElementChild", + "!doc": "Returns the element's last child element or null if there are no child elements." + }, + "nextElementSibling": { + "!type": "+Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Element.nextElementSibling", + "!doc": "Returns the element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list." + }, + "previousElementSibling": { + "!type": "+Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/Element.previousElementSibling", + "!doc": "Returns the element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list." + }, + "tabIndex": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.tabIndex", + "!doc": "Gets/sets the tab order of the current element." + }, + "title": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.title", + "!doc": "Establishes the text to be displayed in a 'tool tip' popup when the mouse is over the displayed node." + }, + "width": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.offsetWidth", + "!doc": "Returns the layout width of an element." + }, + "height": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.offsetHeight", + "!doc": "Height of an element relative to the element's offsetParent." + }, + "getContext": { + "!type": "fn(id: string) -> CanvasRenderingContext2D", + "!url": "https://developer.mozilla.org/en/docs/DOM/HTMLCanvasElement", + "!doc": "DOM canvas elements expose the HTMLCanvasElement interface, which provides properties and methods for manipulating the layout and presentation of canvas elements. The HTMLCanvasElement interface inherits the properties and methods of the element object interface." + }, + "supportsContext": "fn(id: string) -> bool", + "oncopy": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.oncopy", + "!doc": "The oncopy property returns the onCopy event handler code on the current element." + }, + "oncut": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.oncut", + "!doc": "The oncut property returns the onCut event handler code on the current element." + }, + "onpaste": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onpaste", + "!doc": "The onpaste property returns the onPaste event handler code on the current element." + }, + "onbeforeunload": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/HTML/Element/body", + "!doc": "The HTML element represents the main content of an HTML document. There is only one element in a document." + }, + "onfocus": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onfocus", + "!doc": "The onfocus property returns the onFocus event handler code on the current element." + }, + "onblur": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onblur", + "!doc": "The onblur property returns the onBlur event handler code, if any, that exists on the current element." + }, + "onchange": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onchange", + "!doc": "The onchange property sets and returns the onChange event handler code for the current element." + }, + "onclick": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onclick", + "!doc": "The onclick property returns the onClick event handler code on the current element." + }, + "ondblclick": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.ondblclick", + "!doc": "The ondblclick property returns the onDblClick event handler code on the current element." + }, + "onmousedown": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onmousedown", + "!doc": "The onmousedown property returns the onMouseDown event handler code on the current element." + }, + "onmouseup": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onmouseup", + "!doc": "The onmouseup property returns the onMouseUp event handler code on the current element." + }, + "onmousewheel": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/Mozilla_event_reference/wheel", + "!doc": "The wheel event is fired when a wheel button of a pointing device (usually a mouse) is rotated. This event deprecates the legacy mousewheel event." + }, + "onmouseover": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onmouseover", + "!doc": "The onmouseover property returns the onMouseOver event handler code on the current element." + }, + "onmouseout": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onmouseout", + "!doc": "The onmouseout property returns the onMouseOut event handler code on the current element." + }, + "onmousemove": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onmousemove", + "!doc": "The onmousemove property returns the mousemove event handler code on the current element." + }, + "oncontextmenu": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/window.oncontextmenu", + "!doc": "An event handler property for right-click events on the window. Unless the default behavior is prevented, the browser context menu will activate. Note that this event will occur with any non-disabled right-click event and does not depend on an element possessing the \"contextmenu\" attribute." + }, + "onkeydown": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onkeydown", + "!doc": "The onkeydown property returns the onKeyDown event handler code on the current element." + }, + "onkeyup": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onkeyup", + "!doc": "The onkeyup property returns the onKeyUp event handler code for the current element." + }, + "onkeypress": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onkeypress", + "!doc": "The onkeypress property sets and returns the onKeyPress event handler code for the current element." + }, + "onresize": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onresize", + "!doc": "onresize returns the element's onresize event handler code. It can also be used to set the code to be executed when the resize event occurs." + }, + "onscroll": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.onscroll", + "!doc": "The onscroll property returns the onScroll event handler code on the current element." + }, + "ondragstart": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DragDrop/Drag_Operations", + "!doc": "The following describes the steps that occur during a drag and drop operation." + }, + "ondragover": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/Mozilla_event_reference/dragover", + "!doc": "The dragover event is fired when an element or text selection is being dragged over a valid drop target (every few hundred milliseconds)." + }, + "ondragleave": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/Mozilla_event_reference/dragleave", + "!doc": "The dragleave event is fired when a dragged element or text selection leaves a valid drop target." + }, + "ondragenter": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/Mozilla_event_reference/dragenter", + "!doc": "The dragenter event is fired when a dragged element or text selection enters a valid drop target." + }, + "ondragend": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/Mozilla_event_reference/dragend", + "!doc": "The dragend event is fired when a drag operation is being ended (by releasing a mouse button or hitting the escape key)." + }, + "ondrag": { + "!type": "?", + "!url": "https://developer.mozilla.org/en/docs/DOM/Mozilla_event_reference/drag", + "!doc": "The drag event is fired when an element or text selection is being dragged (every few hundred milliseconds)." + }, + "offsetTop": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.offsetTop", + "!doc": "Returns the distance of the current element relative to the top of the offsetParent node." + }, + "offsetLeft": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.offsetLeft", + "!doc": "Returns the number of pixels that the upper left corner of the current element is offset to the left within the offsetParent node." + }, + "offsetHeight": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.offsetHeight", + "!doc": "Height of an element relative to the element's offsetParent." + }, + "offsetWidth": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.offsetWidth", + "!doc": "Returns the layout width of an element." + }, + "scrollTop": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.scrollTop", + "!doc": "Gets or sets the number of pixels that the content of an element is scrolled upward." + }, + "scrollLeft": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.scrollLeft", + "!doc": "Gets or sets the number of pixels that an element's content is scrolled to the left." + }, + "scrollHeight": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.scrollHeight", + "!doc": "Height of the scroll view of an element; it includes the element padding but not its margin." + }, + "scrollWidth": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.scrollWidth", + "!doc": "Read-only property that returns either the width in pixels of the content of an element or the width of the element itself, whichever is greater." + }, + "clientTop": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.clientTop", + "!doc": "The width of the top border of an element in pixels. It does not include the top margin or padding. clientTop is read-only." + }, + "clientLeft": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.clientLeft", + "!doc": "The width of the left border of an element in pixels. It includes the width of the vertical scrollbar if the text direction of the element is right-to-left and if there is an overflow causing a left vertical scrollbar to be rendered. clientLeft does not include the left margin or the left padding. clientLeft is read-only." + }, + "clientHeight": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.clientHeight", + "!doc": "Returns the inner height of an element in pixels, including padding but not the horizontal scrollbar height, border, or margin." + }, + "clientWidth": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.clientWidth", + "!doc": "The inner width of an element in pixels. It includes padding but not the vertical scrollbar (if present, if rendered), border or margin." + }, + "innerHTML": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/element.innerHTML", + "!doc": "Sets or gets the HTML syntax describing the element's descendants." + }, + "createdCallback": { + "!type": "fn()", + "!url": "http://w3c.github.io/webcomponents/spec/custom/index.html#dfn-created-callback", + "!doc": "This callback is invoked after custom element instance is created and its definition is registered. The actual timing of this callback is defined further in this specification." + }, + "attachedCallback": { + "!type": "fn()", + "!url": "http://w3c.github.io/webcomponents/spec/custom/index.html#dfn-entered-view-callback", + "!doc": "Unless specified otherwise, this callback must be enqueued whenever custom element is inserted into a document and this document has a browsing context." + }, + "detachedCallback": { + "!type": "fn()", + "!url": "http://w3c.github.io/webcomponents/spec/custom/index.html#dfn-left-view-callback", + "!doc": "Unless specified otherwise, this callback must be enqueued whenever custom element is removed from the document and this document has a browsing context." + }, + "attributeChangedCallback": { + "!type": "fn()", + "!url": "http://w3c.github.io/webcomponents/spec/custom/index.html#dfn-attribute-changed-callback", + "!doc": "Unless specified otherwise, this callback must be enqueued whenever custom element's attribute is added, changed or removed." + } + }, + "!url": "https://developer.mozilla.org/en/docs/DOM/Element", + "!doc": "Represents an element in an HTML or XML document." + }, + "Text": { + "!type": "fn()", + "prototype": { + "!proto": "Node.prototype", + "wholeText": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/Text.wholeText", + "!doc": "Returns all text of all Text nodes logically adjacent to the node. The text is concatenated in document order. This allows you to specify any text node and obtain all adjacent text as a single string." + }, + "splitText": { + "!type": "fn(offset: number) -> +Text", + "!url": "https://developer.mozilla.org/en/docs/DOM/Text.splitText", + "!doc": "Breaks the Text node into two nodes at the specified offset, keeping both nodes in the tree as siblings." + } + }, + "!url": "https://developer.mozilla.org/en/docs/DOM/Text", + "!doc": "In the DOM, the Text interface represents the textual content of an Element or Attr. If an element has no markup within its content, it has a single child implementing Text that contains the element's text. However, if the element contains markup, it is parsed into information items and Text nodes that form its children." + }, + "Document": { + "!type": "fn()", + "prototype": { + "!proto": "Node.prototype", + "activeElement": { + "!type": "+Element", + "!url": "https://developer.mozilla.org/en/docs/DOM/document.activeElement", + "!doc": "Returns the currently focused element, that is, the element that will get keystroke events if the user types any. This attribute is read only." + }, + "compatMode": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/document.compatMode", + "!doc": "Indicates whether the document is rendered in Quirks mode or Strict mode." + }, + "designMode": { + "!type": "string", + "!url": "https://developer.mozilla.org/en/docs/DOM/document.designMode", + "!doc": "Can be used to make any document editable, for example in a