Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
X
XXL-JOB
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
靳帅
XXL-JOB
Commits
48d30d77
提交
48d30d77
authored
9月 05, 2017
作者:
xuxueli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Wed IDE加载优化
上级
76cc89bc
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
60 行增加
和
83 行删除
+60
-83
jobcode.index.ftl
...rc/main/webapp/WEB-INF/template/jobcode/jobcode.index.ftl
+23
-5
jobcode.index.1.js
xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js
+8
-16
javascript.js
...p/static/plugins/codemirror/mode/javascript/javascript.js
+29
-62
没有找到文件。
xxl-job-admin/src/main/webapp/WEB-INF/template/jobcode/jobcode.index.ftl
浏览文件 @
48d30d77
...
...
@@ -109,16 +109,34 @@
</div>
<
@
netCommon
.
commonScript
/>
<
#
assign
glueTypeModeSrc =
"${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js"
/>
<
#
assign
glueTypeIdeMode =
"text/x-java"
/>
<
#
if
jobInfo
.
glueType =
=
"
GLUE_GROOVY
"
>
<
#
assign
glueTypeModeSrc =
"${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js"
/>
<
#
assign
glueTypeIdeMode =
"text/x-java"
/>
<
#
elseif
jobInfo
.
glueType =
=
"
GLUE_SHELL
"
>
<
#
assign
glueTypeModeSrc =
"${request.contextPath}/static/plugins/codemirror/mode/shell/shell.js"
/>
<
#
assign
glueTypeIdeMode =
"text/x-sh"
/>
<
#
elseif
jobInfo
.
glueType =
=
"
GLUE_PYTHON
"
>
<
#
assign
glueTypeModeSrc =
"${request.contextPath}/static/plugins/codemirror/mode/python/python.js"
/>
<
#
assign
glueTypeIdeMode =
"text/x-python"
/>
<
#
elseif
jobInfo
.
glueType =
=
"
GLUE_NODEJS
"
>
<
#
assign
glueTypeModeSrc =
"${request.contextPath}/static/plugins/codemirror/mode/javascript/javascript.js"
/>
<
#
assign
glueTypeIdeMode =
"text/javascript"
/>
</
#
if>
<script
src=
"${request.contextPath}/static/plugins/codemirror/lib/codemirror.js"
></script>
<script
src=
"${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js"
></script>
<script
src=
"${request.contextPath}/static/plugins/codemirror/mode/shell/shell.js"
></script>
<script
src=
"${request.contextPath}/static/plugins/codemirror/mode/python/python.js"
></script>
<script
src=
"${request.contextPath}/static/plugins/codemirror/mode/javascript/javascript.js"
></script>
<script
src=
"${glueTypeModeSrc}"
></script>
<script
src=
"${request.contextPath}/static/plugins/codemirror/addon/hint/show-hint.js"
></script>
<script
src=
"${request.contextPath}/static/plugins/codemirror/addon/hint/anyword-hint.js"
></script>
<script>
var
id
=
'${jobInfo.id}'
;
var
glueType
=
'${jobInfo.glueTyp
e}'
;
var
ideMode
=
'${glueTypeIdeMod
e}'
;
</script>
<script
src=
"${request.contextPath}/static/js/jobcode.index.1.js"
></script>
...
...
xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js
浏览文件 @
48d30d77
...
...
@@ -8,36 +8,28 @@ $(function() {
});*/
var
codeEditor
;
function
initIde
(
glueType
,
glueSource
)
{
var
ideMode
=
"text/x-java"
;
if
(
'GLUE_GROOVY'
==
glueType
){
ideMode
=
"text/x-java"
;
}
else
if
(
'GLUE_SHELL'
==
glueType
){
ideMode
=
"text/x-sh"
;
}
else
if
(
'GLUE_PYTHON'
==
glueType
){
ideMode
=
"text/x-python"
;
}
else
if
(
'GLUE_NODEJS'
==
glueType
){
ideMode
=
"text/javascript"
}
function
initIde
(
glueSource
)
{
if
(
codeEditor
==
null
)
{
codeEditor
=
CodeMirror
(
document
.
getElementById
(
"ideWindow"
),
{
mode
:
ideMode
,
lineNumbers
:
true
,
matchBrackets
:
true
,
value
:
glueSource
});
}
else
{
codeEditor
.
setValue
(
glueSource
);
}
}
initIde
(
glueType
,
$
(
"#version_now"
).
val
());
initIde
(
$
(
"#version_now"
).
val
());
// code change
$
(
".source_version"
).
click
(
function
(){
var
glueType
=
$
(
this
).
attr
(
'glueType'
);
var
sourceId
=
$
(
this
).
attr
(
'version'
);
var
temp
=
$
(
"#"
+
sourceId
).
val
();
codeEditor
.
setValue
(
''
);
initIde
(
glueType
,
temp
);
//
codeEditor.setValue('');
initIde
(
temp
);
});
// code source save
...
...
xxl-job-admin/src/main/webapp/static/plugins/codemirror/mode/javascript/javascript.js
100644 → 100755
浏览文件 @
48d30d77
...
...
@@ -11,6 +11,11 @@
})(
function
(
CodeMirror
)
{
"use strict"
;
function
expressionAllowed
(
stream
,
state
,
backUp
)
{
return
/^
(?:
operator|sof|keyword c|case|new|export|default|
[\[
{}
\(
,;:
]
|=>
)
$/
.
test
(
state
.
lastType
)
||
(
state
.
lastType
==
"quasi"
&&
/
\{\s
*$/
.
test
(
stream
.
string
.
slice
(
0
,
stream
.
pos
-
(
backUp
||
0
))))
}
CodeMirror
.
defineMode
(
"javascript"
,
function
(
config
,
parserConfig
)
{
var
indentUnit
=
config
.
indentUnit
;
var
statementIndent
=
parserConfig
.
statementIndent
;
...
...
@@ -36,12 +41,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
"true"
:
atom
,
"false"
:
atom
,
"null"
:
atom
,
"undefined"
:
atom
,
"NaN"
:
atom
,
"Infinity"
:
atom
,
"this"
:
kw
(
"this"
),
"class"
:
kw
(
"class"
),
"super"
:
kw
(
"atom"
),
"yield"
:
C
,
"export"
:
kw
(
"export"
),
"import"
:
kw
(
"import"
),
"extends"
:
C
,
"await"
:
C
"await"
:
C
,
"async"
:
kw
(
"async"
)
};
// Extend the 'normal' keywords with the TypeScript language extensions
if
(
isTS
)
{
var
type
=
{
type
:
"variable"
,
style
:
"
type
"
};
var
type
=
{
type
:
"variable"
,
style
:
"
variable-3
"
};
var
tsKeywords
=
{
// object-like things
"interface"
:
kw
(
"class"
),
...
...
@@ -49,13 +54,16 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
"namespace"
:
C
,
"module"
:
kw
(
"module"
),
"enum"
:
kw
(
"module"
),
"type"
:
kw
(
"type"
),
// scope modifiers
"public"
:
kw
(
"modifier"
),
"private"
:
kw
(
"modifier"
),
"protected"
:
kw
(
"modifier"
),
"abstract"
:
kw
(
"modifier"
),
"readonly"
:
kw
(
"modifier"
),
// operators
"as"
:
operator
,
// types
"string"
:
type
,
"number"
:
type
,
"boolean"
:
type
,
"any"
:
type
...
...
@@ -143,16 +151,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return ret("operator", "operator", stream.current());
} else if (wordRE.test(ch)) {
stream.eatWhile(wordRE);
var word = stream.current()
if (state.lastType != ".") {
if (keywords.propertyIsEnumerable(word)) {
var kw = keywords[word]
return ret(kw.type, kw.style, word)
}
if (word == "async" && stream.match(/^\s*[\(\w]/, false))
return ret("async", "keyword", word)
}
return ret("variable", "variable", word)
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
ret("variable", "variable", word);
}
}
...
...
@@ -360,18 +361,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
}
if (type == "function") return cont(functiondef);
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
if (type == "variable") {
if (isTS && value == "type") {
cx.marked = "keyword"
return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
} if (isTS && value == "declare") {
cx.marked = "keyword"
return cont(statement)
} else {
return cont(pushlex("stat"), maybelabel);
}
}
if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"),
if (type == "variable") return cont(pushlex("stat"), maybelabel);
if (type == "switch") return cont(pushlex("form"), parenExpr, pushlex("}", "switch"), expect("{"),
block, poplex, poplex);
if (type == "case") return cont(expression, expect(":"));
if (type == "default") return cont(expect(":"));
...
...
@@ -380,7 +371,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "class") return cont(pushlex("form"), className, poplex);
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
if (type == "module") return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex)
if (type == "type") return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
if (type == "async") return cont(statement)
if (value == "@") return cont(expression, statement)
return pass(pushlex("stat"), expression, expect(";"), poplex);
...
...
@@ -398,7 +390,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function expressionInner(type, noComma) {
if (cx.state.fatArrowAt == cx.stream.start) {
var body = noComma ? arrowBodyNoComma : arrowBody;
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(
funarg
, ")"), poplex, expect("=>"), body, popcontext);
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(
pattern
, ")"), poplex, expect("=>"), body, popcontext);
else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
}
...
...
@@ -433,7 +425,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
var expr = noComma == false ? expression : expressionNoComma;
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
if (type == "operator") {
if (/
\
+
\
+|--/.test(value)
|| isTS && value == "!"
) return cont(me);
if (/
\
+
\
+|--/.test(value)) return cont(me);
if (value == "?") return cont(expression, expect(":"), expr);
return cont(expr);
}
...
...
@@ -442,7 +434,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
if (type == ".") return cont(property, me);
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
if (isTS && value == "as") { cx.marked = "keyword"; return cont(typeexpr, me) }
}
function quasi(type, value) {
if (type != "quasi") return pass();
...
...
@@ -467,7 +458,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function maybeTarget(noComma) {
return function(type) {
if (type == ".") return cont(noComma ? targetNoComma : target);
else if (type == "variable" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma)
else return pass(noComma ? expressionNoComma : expression);
};
}
...
...
@@ -502,7 +492,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
} else if (type == "[") {
return cont(expression, expect("]"), afterprop);
} else if (type == "spread") {
return cont(expression
, afterprop
);
return cont(expression);
} else if (type == ":") {
return pass(afterprop)
}
...
...
@@ -549,19 +539,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (value == "?") return cont(maybetype);
}
}
function typeexpr(type, value) {
if (type == "variable") {
if (value == "keyof") {
cx.marked = "keyword"
return cont(typeexpr)
} else {
cx.marked = "type"
return cont(afterType)
}
}
function typeexpr(type) {
if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
if (type == "string" || type == "number" || type == "atom") return cont(afterType);
if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)
if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex)
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
}
function maybeReturnType(type) {
...
...
@@ -575,8 +556,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return cont(typeprop)
} else if (type == ":") {
return cont(typeexpr)
} else if (type == "[") {
return cont(expression, maybetype, expect("]"), typeprop)
}
}
function typearg(type) {
...
...
@@ -587,10 +566,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
if (value == "|" || type == ".") return cont(typeexpr)
if (type == "[") return cont(expect("]"), afterType)
if (value == "extends") return cont(typeexpr)
}
function maybeTypeArgs(_, value) {
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
}
function vardef() {
return pass(pattern, maybetype, maybeAssign, vardefCont);
...
...
@@ -649,7 +624,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (isTS && value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, functiondef)
}
function funarg(type) {
if (type == "spread"
|| type == "modifier"
) return cont(funarg);
if (type == "spread") return cont(funarg);
return pass(pattern, maybetype, maybeAssign);
}
function classExpression(type, value) {
...
...
@@ -667,14 +642,13 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "{") return cont(pushlex("}"), classBody, poplex);
}
function classBody(type, value) {
if (type == "
modifier" || type == "async" ||
(type == "variable" &&
(value == "static" || value == "get" || value == "set"
) &&
cx.stream.match(/^
\
s+[
\
w$
\
xa1-
\
uffff]/, false)
)) {
if (type == "
variable" || cx.style == "keyword") {
if ((value == "async" || value == "static" || value == "get" || value == "set" ||
(isTS && (value == "public" || value == "private" || value == "protected" || value == "readonly" || value == "abstract"))
) &&
cx.stream.match(/^
\
s+[
\
w$
\
xa1-
\
uffff]/, false
)) {
cx.marked = "keyword";
return cont(classBody);
}
if (type == "variable" || cx.style == "keyword") {
cx.marked = "property";
return cont(isTS ? classfield : functiondef, classBody);
}
...
...
@@ -734,12 +708,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
/[,.]/.test(textAfter.charAt(0));
}
function expressionAllowed(stream, state, backUp) {
return state.tokenize == tokenBase &&
/^(?:operator|sof|keyword c|case|new|export|default|[
\
[{}
\
(,;:]|=>)$/.test(state.lastType) ||
(state.lastType == "quasi" && /
\
{
\
s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
}
// Interface
return {
...
...
@@ -814,7 +782,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
jsonMode: jsonMode,
expressionAllowed: expressionAllowed,
skipExpression: function(state) {
var top = state.cc[state.cc.length - 1]
if (top == expression || top == expressionNoComma) state.cc.pop()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论