Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
粉色的八爪鱼
xxl-job
提交
48d30d77
X
xxl-job
项目概览
粉色的八爪鱼
/
xxl-job
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
xxl-job
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
48d30d77
编写于
9月 05, 2017
作者:
许雪里
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Wed IDE加载优化
上级
76cc89bc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
68 addition
and
91 deletion
+68
-91
xxl-job-admin/src/main/webapp/WEB-INF/template/jobcode/jobcode.index.ftl
...rc/main/webapp/WEB-INF/template/jobcode/jobcode.index.ftl
+23
-5
xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js
xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js
+13
-21
xxl-job-admin/src/main/webapp/static/plugins/codemirror/mode/javascript/javascript.js
...p/static/plugins/codemirror/mode/javascript/javascript.js
+32
-65
未找到文件。
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
(
glue
Type
,
glue
Source
)
{
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
);
}
codeEditor
=
CodeMirror
(
document
.
getElementById
(
"
ideWindow
"
),
{
mode
:
ideMode
,
lineNumbers
:
true
,
matchBrackets
:
true
,
value
:
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
$
\x
a1-
\u
ffff
]
/
,
false
)))
{
cx
.
marked
=
"
keyword
"
;
return
cont
(
classBody
);
}
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
$
\x
a1-
\u
ffff
]
/
,
false
))
{
cx
.
marked
=
"
keyword
"
;
return
cont
(
classBody
);
}
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
()
...
...
@@ -835,4 +802,4 @@ CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true})
CodeMirror
.
defineMIME
(
"
text/typescript
"
,
{
name
:
"
javascript
"
,
typescript
:
true
});
CodeMirror
.
defineMIME
(
"
application/typescript
"
,
{
name
:
"
javascript
"
,
typescript
:
true
});
});
\ No newline at end of file
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录