提交 48d30d77 authored 作者: xuxueli's avatar xuxueli

Wed IDE加载优化

上级 76cc89bc
...@@ -109,16 +109,34 @@ ...@@ -109,16 +109,34 @@
</div> </div>
<@netCommon.commonScript /> <@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/lib/codemirror.js"></script>
<script src="${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js"></script> <script src="${glueTypeModeSrc}"></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="${request.contextPath}/static/plugins/codemirror/addon/hint/show-hint.js"></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 src="${request.contextPath}/static/plugins/codemirror/addon/hint/anyword-hint.js"></script>
<script> <script>
var id = '${jobInfo.id}'; var id = '${jobInfo.id}';
var glueType = '${jobInfo.glueType}'; var ideMode = '${glueTypeIdeMode}';
</script> </script>
<script src="${request.contextPath}/static/js/jobcode.index.1.js"></script> <script src="${request.contextPath}/static/js/jobcode.index.1.js"></script>
......
...@@ -8,36 +8,28 @@ $(function() { ...@@ -8,36 +8,28 @@ $(function() {
});*/ });*/
var codeEditor; var codeEditor;
function initIde(glueType, glueSource) { function initIde(glueSource) {
var ideMode = "text/x-java"; if (codeEditor == null) {
if ('GLUE_GROOVY'==glueType){ codeEditor = CodeMirror(document.getElementById("ideWindow"), {
ideMode = "text/x-java"; mode : ideMode,
} else if ('GLUE_SHELL'==glueType){ lineNumbers : true,
ideMode = "text/x-sh"; matchBrackets : true,
} else if ('GLUE_PYTHON'==glueType){ value: glueSource
ideMode = "text/x-python"; });
} else if ('GLUE_NODEJS'==glueType){ } else {
ideMode = "text/javascript" 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 // code change
$(".source_version").click(function(){ $(".source_version").click(function(){
var glueType = $(this).attr('glueType');
var sourceId = $(this).attr('version'); var sourceId = $(this).attr('version');
var temp = $( "#" + sourceId ).val(); var temp = $( "#" + sourceId ).val();
codeEditor.setValue(''); //codeEditor.setValue('');
initIde(glueType, temp); initIde(temp);
}); });
// code source save // code source save
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论