fluentd-ui 0.3.12 → 0.3.13
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fluentd-ui might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/application.js +2 -0
- data/app/assets/javascripts/codemirror.js +29 -0
- data/app/assets/javascripts/codemirror_fluentd.js +59 -0
- data/app/assets/stylesheets/application.css +6 -0
- data/app/views/fluentd/settings/edit.html.haml +1 -1
- data/app/views/shared/vue/_setting.html.erb +1 -1
- data/bower.json +2 -1
- data/lib/fluentd-ui/version.rb +1 -1
- data/spec/features/source_and_output_spec.rb +16 -6
- data/vendor/assets/javascripts/bower/codemirror/.bower.json +29 -0
- data/vendor/assets/javascripts/bower/codemirror/AUTHORS +423 -0
- data/vendor/assets/javascripts/bower/codemirror/CONTRIBUTING.md +76 -0
- data/vendor/assets/javascripts/bower/codemirror/LICENSE +19 -0
- data/vendor/assets/javascripts/bower/codemirror/README.md +11 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/comment/comment.js +183 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/comment/continuecomment.js +85 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/dialog/dialog.css +32 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/dialog/dialog.js +155 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/display/fullscreen.css +6 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/display/fullscreen.js +41 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/display/panel.js +94 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/display/placeholder.js +58 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/display/rulers.js +64 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/edit/closebrackets.js +159 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/edit/closetag.js +159 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/edit/continuelist.js +51 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/edit/matchbrackets.js +120 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/edit/matchtags.js +66 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/edit/trailingspace.js +27 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/fold/brace-fold.js +105 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/fold/comment-fold.js +57 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldcode.js +145 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldgutter.css +20 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldgutter.js +134 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/fold/indent-fold.js +44 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/fold/markdown-fold.js +49 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/fold/xml-fold.js +182 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/hint/anyword-hint.js +41 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/hint/css-hint.js +56 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/hint/html-hint.js +348 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/hint/javascript-hint.js +146 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/hint/show-hint.css +38 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/hint/show-hint.js +389 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/hint/sql-hint.js +197 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/hint/xml-hint.js +110 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/lint/coffeescript-lint.js +41 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/lint/css-lint.js +35 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/lint/javascript-lint.js +136 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/lint/json-lint.js +31 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/lint/lint.css +73 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/lint/lint.js +204 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/lint/yaml-lint.js +28 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/merge/merge.css +112 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/merge/merge.js +643 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/mode/loadmode.js +64 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/mode/multiplex.js +118 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/mode/multiplex_test.js +33 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/mode/overlay.js +85 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/mode/simple.js +213 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/runmode/colorize.js +40 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode-standalone.js +157 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode.js +72 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode.node.js +120 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/scroll/annotatescrollbar.js +76 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/scroll/scrollpastend.js +46 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/scroll/simplescrollbars.css +66 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/scroll/simplescrollbars.js +139 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/search/match-highlighter.js +128 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/search/matchesonscrollbar.js +90 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/search/search.js +164 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/search/searchcursor.js +189 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/selection/active-line.js +71 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/selection/mark-selection.js +118 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/tern/tern.css +86 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/tern/tern.js +670 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/tern/worker.js +44 -0
- data/vendor/assets/javascripts/bower/codemirror/addon/wrap/hardwrap.js +139 -0
- data/vendor/assets/javascripts/bower/codemirror/bower.json +16 -0
- data/vendor/assets/javascripts/bower/codemirror/keymap/emacs.js +411 -0
- data/vendor/assets/javascripts/bower/codemirror/keymap/sublime.js +540 -0
- data/vendor/assets/javascripts/bower/codemirror/keymap/vim.js +4901 -0
- data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.css +309 -0
- data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.js +8029 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/apl/apl.js +175 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/asterisk/asterisk.js +198 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/clike/clike.js +489 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/clike/scala.html +767 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/clojure/clojure.js +243 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/cobol/cobol.js +255 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/coffeescript/coffeescript.js +369 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/commonlisp/commonlisp.js +122 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/css/css.js +717 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/css/less.html +152 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/css/less_test.js +51 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/css/scss.html +157 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/css/scss_test.js +110 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/css/test.js +135 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/cypher/cypher.js +146 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/d/d.js +218 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/dart/dart.js +50 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/diff/diff.js +47 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/django/django.js +67 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/dockerfile/dockerfile.js +76 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/dtd/dtd.js +142 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/dylan/dylan.js +299 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/ebnf/ebnf.js +195 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/ecl/ecl.js +207 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/eiffel/eiffel.js +162 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/erlang/erlang.js +622 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/fortran/fortran.js +188 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/gas/gas.js +345 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/gfm/gfm.js +123 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/gfm/test.js +213 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/gherkin/gherkin.js +178 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/go/go.js +184 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/groovy/groovy.js +226 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/haml/haml.js +159 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/haml/test.js +97 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/haskell/haskell.js +267 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/haxe/haxe.js +518 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/htmlembedded/htmlembedded.js +86 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/htmlmixed/htmlmixed.js +121 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/http/http.js +113 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/idl/idl.js +290 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/jade/jade.js +590 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/javascript/javascript.js +686 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/javascript/json-ld.html +72 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/javascript/test.js +200 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/javascript/typescript.html +61 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/jinja2/jinja2.js +142 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/julia/julia.js +301 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/kotlin/kotlin.js +280 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/livescript/livescript.js +280 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/lua/lua.js +159 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/markdown/markdown.js +765 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/markdown/test.js +754 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/meta.js +165 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/mirc/mirc.js +193 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/mllike/mllike.js +205 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/modelica/modelica.js +245 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/nginx/nginx.js +178 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/ntriples/ntriples.js +186 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/octave/octave.js +135 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/pascal/pascal.js +109 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/pegjs/pegjs.js +114 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/perl/perl.js +832 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/php/php.js +226 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/php/test.js +154 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/pig/pig.js +188 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/properties/properties.js +78 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/puppet/puppet.js +220 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/python/python.js +359 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/q/q.js +139 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/r/r.js +162 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/rpm/rpm.js +101 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/rst/rst.js +557 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/ruby/ruby.js +285 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/ruby/test.js +14 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/rust/rust.js +451 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/sass/sass.js +327 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/scheme/scheme.js +248 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/shell/shell.js +139 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/shell/test.js +58 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/sieve/sieve.js +193 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/slim/slim.js +575 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/slim/test.js +96 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/smalltalk/smalltalk.js +168 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/smarty/smarty.js +221 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/smartymixed/smartymixed.js +197 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/solr/solr.js +104 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/soy/soy.js +198 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/sparql/sparql.js +174 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/spreadsheet/spreadsheet.js +109 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/sql/sql.js +391 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/stex/stex.js +251 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/stex/test.js +123 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/tcl/tcl.js +147 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/textile/test.js +417 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/textile/textile.js +469 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/tiddlywiki/tiddlywiki.js +369 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/tiki/tiki.css +26 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/tiki/tiki.js +323 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/toml/toml.js +88 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/tornado/tornado.js +68 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/turtle/turtle.js +162 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/vb/vb.js +274 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/vbscript/vbscript.js +350 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/velocity/velocity.js +201 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/verilog/test.js +273 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/verilog/verilog.js +364 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/xml/test.js +51 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/xml/xml.js +384 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/xquery/test.js +67 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/xquery/xquery.js +447 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/yaml/yaml.js +117 -0
- data/vendor/assets/javascripts/bower/codemirror/mode/z80/z80.js +100 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/3024-day.css +38 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/3024-night.css +37 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/ambiance-mobile.css +5 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/ambiance.css +77 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/base16-dark.css +36 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/base16-light.css +36 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/blackboard.css +30 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/cobalt.css +23 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/eclipse.css +23 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/elegant.css +13 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/erlang-dark.css +32 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/lesser-dark.css +45 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/mbo.css +35 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/mdn-like.css +44 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/midnight.css +45 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/monokai.css +31 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/neat.css +12 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/neo.css +43 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/night.css +26 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-dark.css +36 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-light.css +36 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/pastel-on-dark.css +50 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/rubyblue.css +23 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/solarized.css +165 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/the-matrix.css +28 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-bright.css +35 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-eighties.css +36 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/twilight.css +30 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/vibrant-ink.css +32 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/xq-dark.css +51 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/xq-light.css +43 -0
- data/vendor/assets/javascripts/bower/codemirror/theme/zenburn.css +37 -0
- metadata +225 -2
@@ -0,0 +1,56 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"), require("../../mode/css/css"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror", "../../mode/css/css"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
var pseudoClasses = {link: 1, visited: 1, active: 1, hover: 1, focus: 1,
|
15
|
+
"first-letter": 1, "first-line": 1, "first-child": 1,
|
16
|
+
before: 1, after: 1, lang: 1};
|
17
|
+
|
18
|
+
CodeMirror.registerHelper("hint", "css", function(cm) {
|
19
|
+
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
|
20
|
+
var inner = CodeMirror.innerMode(cm.getMode(), token.state);
|
21
|
+
if (inner.mode.name != "css") return;
|
22
|
+
|
23
|
+
var start = token.start, end = cur.ch, word = token.string.slice(0, end - start);
|
24
|
+
if (/[^\w$_-]/.test(word)) {
|
25
|
+
word = ""; start = end = cur.ch;
|
26
|
+
}
|
27
|
+
|
28
|
+
var spec = CodeMirror.resolveMode("text/css");
|
29
|
+
|
30
|
+
var result = [];
|
31
|
+
function add(keywords) {
|
32
|
+
for (var name in keywords)
|
33
|
+
if (!word || name.lastIndexOf(word, 0) == 0)
|
34
|
+
result.push(name);
|
35
|
+
}
|
36
|
+
|
37
|
+
var st = inner.state.state;
|
38
|
+
if (st == "pseudo" || token.type == "variable-3") {
|
39
|
+
add(pseudoClasses);
|
40
|
+
} else if (st == "block" || st == "maybeprop") {
|
41
|
+
add(spec.propertyKeywords);
|
42
|
+
} else if (st == "prop" || st == "parens" || st == "at" || st == "params") {
|
43
|
+
add(spec.valueKeywords);
|
44
|
+
add(spec.colorKeywords);
|
45
|
+
} else if (st == "media" || st == "media_parens") {
|
46
|
+
add(spec.mediaTypes);
|
47
|
+
add(spec.mediaFeatures);
|
48
|
+
}
|
49
|
+
|
50
|
+
if (result.length) return {
|
51
|
+
list: result,
|
52
|
+
from: CodeMirror.Pos(cur.line, start),
|
53
|
+
to: CodeMirror.Pos(cur.line, end)
|
54
|
+
};
|
55
|
+
});
|
56
|
+
});
|
@@ -0,0 +1,348 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"), require("./xml-hint"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror", "./xml-hint"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
var langs = "ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" ");
|
15
|
+
var targets = ["_blank", "_self", "_top", "_parent"];
|
16
|
+
var charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
|
17
|
+
var methods = ["get", "post", "put", "delete"];
|
18
|
+
var encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
|
19
|
+
var media = ["all", "screen", "print", "embossed", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "speech",
|
20
|
+
"3d-glasses", "resolution [>][<][=] [X]", "device-aspect-ratio: X/Y", "orientation:portrait",
|
21
|
+
"orientation:landscape", "device-height: [X]", "device-width: [X]"];
|
22
|
+
var s = { attrs: {} }; // Simple tag, reused for a whole lot of tags
|
23
|
+
|
24
|
+
var data = {
|
25
|
+
a: {
|
26
|
+
attrs: {
|
27
|
+
href: null, ping: null, type: null,
|
28
|
+
media: media,
|
29
|
+
target: targets,
|
30
|
+
hreflang: langs
|
31
|
+
}
|
32
|
+
},
|
33
|
+
abbr: s,
|
34
|
+
acronym: s,
|
35
|
+
address: s,
|
36
|
+
applet: s,
|
37
|
+
area: {
|
38
|
+
attrs: {
|
39
|
+
alt: null, coords: null, href: null, target: null, ping: null,
|
40
|
+
media: media, hreflang: langs, type: null,
|
41
|
+
shape: ["default", "rect", "circle", "poly"]
|
42
|
+
}
|
43
|
+
},
|
44
|
+
article: s,
|
45
|
+
aside: s,
|
46
|
+
audio: {
|
47
|
+
attrs: {
|
48
|
+
src: null, mediagroup: null,
|
49
|
+
crossorigin: ["anonymous", "use-credentials"],
|
50
|
+
preload: ["none", "metadata", "auto"],
|
51
|
+
autoplay: ["", "autoplay"],
|
52
|
+
loop: ["", "loop"],
|
53
|
+
controls: ["", "controls"]
|
54
|
+
}
|
55
|
+
},
|
56
|
+
b: s,
|
57
|
+
base: { attrs: { href: null, target: targets } },
|
58
|
+
basefont: s,
|
59
|
+
bdi: s,
|
60
|
+
bdo: s,
|
61
|
+
big: s,
|
62
|
+
blockquote: { attrs: { cite: null } },
|
63
|
+
body: s,
|
64
|
+
br: s,
|
65
|
+
button: {
|
66
|
+
attrs: {
|
67
|
+
form: null, formaction: null, name: null, value: null,
|
68
|
+
autofocus: ["", "autofocus"],
|
69
|
+
disabled: ["", "autofocus"],
|
70
|
+
formenctype: encs,
|
71
|
+
formmethod: methods,
|
72
|
+
formnovalidate: ["", "novalidate"],
|
73
|
+
formtarget: targets,
|
74
|
+
type: ["submit", "reset", "button"]
|
75
|
+
}
|
76
|
+
},
|
77
|
+
canvas: { attrs: { width: null, height: null } },
|
78
|
+
caption: s,
|
79
|
+
center: s,
|
80
|
+
cite: s,
|
81
|
+
code: s,
|
82
|
+
col: { attrs: { span: null } },
|
83
|
+
colgroup: { attrs: { span: null } },
|
84
|
+
command: {
|
85
|
+
attrs: {
|
86
|
+
type: ["command", "checkbox", "radio"],
|
87
|
+
label: null, icon: null, radiogroup: null, command: null, title: null,
|
88
|
+
disabled: ["", "disabled"],
|
89
|
+
checked: ["", "checked"]
|
90
|
+
}
|
91
|
+
},
|
92
|
+
data: { attrs: { value: null } },
|
93
|
+
datagrid: { attrs: { disabled: ["", "disabled"], multiple: ["", "multiple"] } },
|
94
|
+
datalist: { attrs: { data: null } },
|
95
|
+
dd: s,
|
96
|
+
del: { attrs: { cite: null, datetime: null } },
|
97
|
+
details: { attrs: { open: ["", "open"] } },
|
98
|
+
dfn: s,
|
99
|
+
dir: s,
|
100
|
+
div: s,
|
101
|
+
dl: s,
|
102
|
+
dt: s,
|
103
|
+
em: s,
|
104
|
+
embed: { attrs: { src: null, type: null, width: null, height: null } },
|
105
|
+
eventsource: { attrs: { src: null } },
|
106
|
+
fieldset: { attrs: { disabled: ["", "disabled"], form: null, name: null } },
|
107
|
+
figcaption: s,
|
108
|
+
figure: s,
|
109
|
+
font: s,
|
110
|
+
footer: s,
|
111
|
+
form: {
|
112
|
+
attrs: {
|
113
|
+
action: null, name: null,
|
114
|
+
"accept-charset": charsets,
|
115
|
+
autocomplete: ["on", "off"],
|
116
|
+
enctype: encs,
|
117
|
+
method: methods,
|
118
|
+
novalidate: ["", "novalidate"],
|
119
|
+
target: targets
|
120
|
+
}
|
121
|
+
},
|
122
|
+
frame: s,
|
123
|
+
frameset: s,
|
124
|
+
h1: s, h2: s, h3: s, h4: s, h5: s, h6: s,
|
125
|
+
head: {
|
126
|
+
attrs: {},
|
127
|
+
children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
|
128
|
+
},
|
129
|
+
header: s,
|
130
|
+
hgroup: s,
|
131
|
+
hr: s,
|
132
|
+
html: {
|
133
|
+
attrs: { manifest: null },
|
134
|
+
children: ["head", "body"]
|
135
|
+
},
|
136
|
+
i: s,
|
137
|
+
iframe: {
|
138
|
+
attrs: {
|
139
|
+
src: null, srcdoc: null, name: null, width: null, height: null,
|
140
|
+
sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
|
141
|
+
seamless: ["", "seamless"]
|
142
|
+
}
|
143
|
+
},
|
144
|
+
img: {
|
145
|
+
attrs: {
|
146
|
+
alt: null, src: null, ismap: null, usemap: null, width: null, height: null,
|
147
|
+
crossorigin: ["anonymous", "use-credentials"]
|
148
|
+
}
|
149
|
+
},
|
150
|
+
input: {
|
151
|
+
attrs: {
|
152
|
+
alt: null, dirname: null, form: null, formaction: null,
|
153
|
+
height: null, list: null, max: null, maxlength: null, min: null,
|
154
|
+
name: null, pattern: null, placeholder: null, size: null, src: null,
|
155
|
+
step: null, value: null, width: null,
|
156
|
+
accept: ["audio/*", "video/*", "image/*"],
|
157
|
+
autocomplete: ["on", "off"],
|
158
|
+
autofocus: ["", "autofocus"],
|
159
|
+
checked: ["", "checked"],
|
160
|
+
disabled: ["", "disabled"],
|
161
|
+
formenctype: encs,
|
162
|
+
formmethod: methods,
|
163
|
+
formnovalidate: ["", "novalidate"],
|
164
|
+
formtarget: targets,
|
165
|
+
multiple: ["", "multiple"],
|
166
|
+
readonly: ["", "readonly"],
|
167
|
+
required: ["", "required"],
|
168
|
+
type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month",
|
169
|
+
"week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio",
|
170
|
+
"file", "submit", "image", "reset", "button"]
|
171
|
+
}
|
172
|
+
},
|
173
|
+
ins: { attrs: { cite: null, datetime: null } },
|
174
|
+
kbd: s,
|
175
|
+
keygen: {
|
176
|
+
attrs: {
|
177
|
+
challenge: null, form: null, name: null,
|
178
|
+
autofocus: ["", "autofocus"],
|
179
|
+
disabled: ["", "disabled"],
|
180
|
+
keytype: ["RSA"]
|
181
|
+
}
|
182
|
+
},
|
183
|
+
label: { attrs: { "for": null, form: null } },
|
184
|
+
legend: s,
|
185
|
+
li: { attrs: { value: null } },
|
186
|
+
link: {
|
187
|
+
attrs: {
|
188
|
+
href: null, type: null,
|
189
|
+
hreflang: langs,
|
190
|
+
media: media,
|
191
|
+
sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
|
192
|
+
}
|
193
|
+
},
|
194
|
+
map: { attrs: { name: null } },
|
195
|
+
mark: s,
|
196
|
+
menu: { attrs: { label: null, type: ["list", "context", "toolbar"] } },
|
197
|
+
meta: {
|
198
|
+
attrs: {
|
199
|
+
content: null,
|
200
|
+
charset: charsets,
|
201
|
+
name: ["viewport", "application-name", "author", "description", "generator", "keywords"],
|
202
|
+
"http-equiv": ["content-language", "content-type", "default-style", "refresh"]
|
203
|
+
}
|
204
|
+
},
|
205
|
+
meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } },
|
206
|
+
nav: s,
|
207
|
+
noframes: s,
|
208
|
+
noscript: s,
|
209
|
+
object: {
|
210
|
+
attrs: {
|
211
|
+
data: null, type: null, name: null, usemap: null, form: null, width: null, height: null,
|
212
|
+
typemustmatch: ["", "typemustmatch"]
|
213
|
+
}
|
214
|
+
},
|
215
|
+
ol: { attrs: { reversed: ["", "reversed"], start: null, type: ["1", "a", "A", "i", "I"] } },
|
216
|
+
optgroup: { attrs: { disabled: ["", "disabled"], label: null } },
|
217
|
+
option: { attrs: { disabled: ["", "disabled"], label: null, selected: ["", "selected"], value: null } },
|
218
|
+
output: { attrs: { "for": null, form: null, name: null } },
|
219
|
+
p: s,
|
220
|
+
param: { attrs: { name: null, value: null } },
|
221
|
+
pre: s,
|
222
|
+
progress: { attrs: { value: null, max: null } },
|
223
|
+
q: { attrs: { cite: null } },
|
224
|
+
rp: s,
|
225
|
+
rt: s,
|
226
|
+
ruby: s,
|
227
|
+
s: s,
|
228
|
+
samp: s,
|
229
|
+
script: {
|
230
|
+
attrs: {
|
231
|
+
type: ["text/javascript"],
|
232
|
+
src: null,
|
233
|
+
async: ["", "async"],
|
234
|
+
defer: ["", "defer"],
|
235
|
+
charset: charsets
|
236
|
+
}
|
237
|
+
},
|
238
|
+
section: s,
|
239
|
+
select: {
|
240
|
+
attrs: {
|
241
|
+
form: null, name: null, size: null,
|
242
|
+
autofocus: ["", "autofocus"],
|
243
|
+
disabled: ["", "disabled"],
|
244
|
+
multiple: ["", "multiple"]
|
245
|
+
}
|
246
|
+
},
|
247
|
+
small: s,
|
248
|
+
source: { attrs: { src: null, type: null, media: null } },
|
249
|
+
span: s,
|
250
|
+
strike: s,
|
251
|
+
strong: s,
|
252
|
+
style: {
|
253
|
+
attrs: {
|
254
|
+
type: ["text/css"],
|
255
|
+
media: media,
|
256
|
+
scoped: null
|
257
|
+
}
|
258
|
+
},
|
259
|
+
sub: s,
|
260
|
+
summary: s,
|
261
|
+
sup: s,
|
262
|
+
table: s,
|
263
|
+
tbody: s,
|
264
|
+
td: { attrs: { colspan: null, rowspan: null, headers: null } },
|
265
|
+
textarea: {
|
266
|
+
attrs: {
|
267
|
+
dirname: null, form: null, maxlength: null, name: null, placeholder: null,
|
268
|
+
rows: null, cols: null,
|
269
|
+
autofocus: ["", "autofocus"],
|
270
|
+
disabled: ["", "disabled"],
|
271
|
+
readonly: ["", "readonly"],
|
272
|
+
required: ["", "required"],
|
273
|
+
wrap: ["soft", "hard"]
|
274
|
+
}
|
275
|
+
},
|
276
|
+
tfoot: s,
|
277
|
+
th: { attrs: { colspan: null, rowspan: null, headers: null, scope: ["row", "col", "rowgroup", "colgroup"] } },
|
278
|
+
thead: s,
|
279
|
+
time: { attrs: { datetime: null } },
|
280
|
+
title: s,
|
281
|
+
tr: s,
|
282
|
+
track: {
|
283
|
+
attrs: {
|
284
|
+
src: null, label: null, "default": null,
|
285
|
+
kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
|
286
|
+
srclang: langs
|
287
|
+
}
|
288
|
+
},
|
289
|
+
tt: s,
|
290
|
+
u: s,
|
291
|
+
ul: s,
|
292
|
+
"var": s,
|
293
|
+
video: {
|
294
|
+
attrs: {
|
295
|
+
src: null, poster: null, width: null, height: null,
|
296
|
+
crossorigin: ["anonymous", "use-credentials"],
|
297
|
+
preload: ["auto", "metadata", "none"],
|
298
|
+
autoplay: ["", "autoplay"],
|
299
|
+
mediagroup: ["movie"],
|
300
|
+
muted: ["", "muted"],
|
301
|
+
controls: ["", "controls"]
|
302
|
+
}
|
303
|
+
},
|
304
|
+
wbr: s
|
305
|
+
};
|
306
|
+
|
307
|
+
var globalAttrs = {
|
308
|
+
accesskey: ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
309
|
+
"class": null,
|
310
|
+
contenteditable: ["true", "false"],
|
311
|
+
contextmenu: null,
|
312
|
+
dir: ["ltr", "rtl", "auto"],
|
313
|
+
draggable: ["true", "false", "auto"],
|
314
|
+
dropzone: ["copy", "move", "link", "string:", "file:"],
|
315
|
+
hidden: ["hidden"],
|
316
|
+
id: null,
|
317
|
+
inert: ["inert"],
|
318
|
+
itemid: null,
|
319
|
+
itemprop: null,
|
320
|
+
itemref: null,
|
321
|
+
itemscope: ["itemscope"],
|
322
|
+
itemtype: null,
|
323
|
+
lang: ["en", "es"],
|
324
|
+
spellcheck: ["true", "false"],
|
325
|
+
style: null,
|
326
|
+
tabindex: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
327
|
+
title: null,
|
328
|
+
translate: ["yes", "no"],
|
329
|
+
onclick: null,
|
330
|
+
rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"]
|
331
|
+
};
|
332
|
+
function populate(obj) {
|
333
|
+
for (var attr in globalAttrs) if (globalAttrs.hasOwnProperty(attr))
|
334
|
+
obj.attrs[attr] = globalAttrs[attr];
|
335
|
+
}
|
336
|
+
|
337
|
+
populate(s);
|
338
|
+
for (var tag in data) if (data.hasOwnProperty(tag) && data[tag] != s)
|
339
|
+
populate(data[tag]);
|
340
|
+
|
341
|
+
CodeMirror.htmlSchema = data;
|
342
|
+
function htmlHint(cm, options) {
|
343
|
+
var local = {schemaInfo: data};
|
344
|
+
if (options) for (var opt in options) local[opt] = options[opt];
|
345
|
+
return CodeMirror.hint.xml(cm, local);
|
346
|
+
}
|
347
|
+
CodeMirror.registerHelper("hint", "html", htmlHint);
|
348
|
+
});
|
@@ -0,0 +1,146 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
var Pos = CodeMirror.Pos;
|
13
|
+
|
14
|
+
function forEach(arr, f) {
|
15
|
+
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
|
16
|
+
}
|
17
|
+
|
18
|
+
function arrayContains(arr, item) {
|
19
|
+
if (!Array.prototype.indexOf) {
|
20
|
+
var i = arr.length;
|
21
|
+
while (i--) {
|
22
|
+
if (arr[i] === item) {
|
23
|
+
return true;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
return arr.indexOf(item) != -1;
|
29
|
+
}
|
30
|
+
|
31
|
+
function scriptHint(editor, keywords, getToken, options) {
|
32
|
+
// Find the token at the cursor
|
33
|
+
var cur = editor.getCursor(), token = getToken(editor, cur);
|
34
|
+
if (/\b(?:string|comment)\b/.test(token.type)) return;
|
35
|
+
token.state = CodeMirror.innerMode(editor.getMode(), token.state).state;
|
36
|
+
|
37
|
+
// If it's not a 'word-style' token, ignore the token.
|
38
|
+
if (!/^[\w$_]*$/.test(token.string)) {
|
39
|
+
token = {start: cur.ch, end: cur.ch, string: "", state: token.state,
|
40
|
+
type: token.string == "." ? "property" : null};
|
41
|
+
} else if (token.end > cur.ch) {
|
42
|
+
token.end = cur.ch;
|
43
|
+
token.string = token.string.slice(0, cur.ch - token.start);
|
44
|
+
}
|
45
|
+
|
46
|
+
var tprop = token;
|
47
|
+
// If it is a property, find out what it is a property of.
|
48
|
+
while (tprop.type == "property") {
|
49
|
+
tprop = getToken(editor, Pos(cur.line, tprop.start));
|
50
|
+
if (tprop.string != ".") return;
|
51
|
+
tprop = getToken(editor, Pos(cur.line, tprop.start));
|
52
|
+
if (!context) var context = [];
|
53
|
+
context.push(tprop);
|
54
|
+
}
|
55
|
+
return {list: getCompletions(token, context, keywords, options),
|
56
|
+
from: Pos(cur.line, token.start),
|
57
|
+
to: Pos(cur.line, token.end)};
|
58
|
+
}
|
59
|
+
|
60
|
+
function javascriptHint(editor, options) {
|
61
|
+
return scriptHint(editor, javascriptKeywords,
|
62
|
+
function (e, cur) {return e.getTokenAt(cur);},
|
63
|
+
options);
|
64
|
+
};
|
65
|
+
CodeMirror.registerHelper("hint", "javascript", javascriptHint);
|
66
|
+
|
67
|
+
function getCoffeeScriptToken(editor, cur) {
|
68
|
+
// This getToken, it is for coffeescript, imitates the behavior of
|
69
|
+
// getTokenAt method in javascript.js, that is, returning "property"
|
70
|
+
// type and treat "." as indepenent token.
|
71
|
+
var token = editor.getTokenAt(cur);
|
72
|
+
if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
|
73
|
+
token.end = token.start;
|
74
|
+
token.string = '.';
|
75
|
+
token.type = "property";
|
76
|
+
}
|
77
|
+
else if (/^\.[\w$_]*$/.test(token.string)) {
|
78
|
+
token.type = "property";
|
79
|
+
token.start++;
|
80
|
+
token.string = token.string.replace(/\./, '');
|
81
|
+
}
|
82
|
+
return token;
|
83
|
+
}
|
84
|
+
|
85
|
+
function coffeescriptHint(editor, options) {
|
86
|
+
return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options);
|
87
|
+
}
|
88
|
+
CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint);
|
89
|
+
|
90
|
+
var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
|
91
|
+
"toUpperCase toLowerCase split concat match replace search").split(" ");
|
92
|
+
var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
|
93
|
+
"lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
|
94
|
+
var funcProps = "prototype apply call bind".split(" ");
|
95
|
+
var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
|
96
|
+
"if in instanceof new null return switch throw true try typeof var void while with").split(" ");
|
97
|
+
var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
|
98
|
+
"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(" ");
|
99
|
+
|
100
|
+
function getCompletions(token, context, keywords, options) {
|
101
|
+
var found = [], start = token.string, global = options && options.globalScope || window;
|
102
|
+
function maybeAdd(str) {
|
103
|
+
if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
|
104
|
+
}
|
105
|
+
function gatherCompletions(obj) {
|
106
|
+
if (typeof obj == "string") forEach(stringProps, maybeAdd);
|
107
|
+
else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
|
108
|
+
else if (obj instanceof Function) forEach(funcProps, maybeAdd);
|
109
|
+
for (var name in obj) maybeAdd(name);
|
110
|
+
}
|
111
|
+
|
112
|
+
if (context && context.length) {
|
113
|
+
// If this is a property, see if it belongs to some object we can
|
114
|
+
// find in the current environment.
|
115
|
+
var obj = context.pop(), base;
|
116
|
+
if (obj.type && obj.type.indexOf("variable") === 0) {
|
117
|
+
if (options && options.additionalContext)
|
118
|
+
base = options.additionalContext[obj.string];
|
119
|
+
if (!options || options.useGlobalScope !== false)
|
120
|
+
base = base || global[obj.string];
|
121
|
+
} else if (obj.type == "string") {
|
122
|
+
base = "";
|
123
|
+
} else if (obj.type == "atom") {
|
124
|
+
base = 1;
|
125
|
+
} else if (obj.type == "function") {
|
126
|
+
if (global.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
|
127
|
+
(typeof global.jQuery == 'function'))
|
128
|
+
base = global.jQuery();
|
129
|
+
else if (global._ != null && (obj.string == '_') && (typeof global._ == 'function'))
|
130
|
+
base = global._();
|
131
|
+
}
|
132
|
+
while (base != null && context.length)
|
133
|
+
base = base[context.pop().string];
|
134
|
+
if (base != null) gatherCompletions(base);
|
135
|
+
} else {
|
136
|
+
// If not, just look in the global object and any local scope
|
137
|
+
// (reading into JS mode internals to get at the local and global variables)
|
138
|
+
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
|
139
|
+
for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
|
140
|
+
if (!options || options.useGlobalScope !== false)
|
141
|
+
gatherCompletions(global);
|
142
|
+
forEach(keywords, maybeAdd);
|
143
|
+
}
|
144
|
+
return found;
|
145
|
+
}
|
146
|
+
});
|