Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
8580f732
J
jenkins
项目概览
FIY695
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8580f732
编写于
1月 28, 2012
作者:
S
Seiji Sogabe
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #364 from ikikko/fixMultiSubmitWithShortcutKey
Fix multi submit with shortcut key
上级
7360f45d
2b2877ef
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
68 addition
and
56 deletion
+68
-56
core/src/main/resources/lib/hudson/scriptConsole.jelly
core/src/main/resources/lib/hudson/scriptConsole.jelly
+2
-56
war/src/main/webapp/scripts/hudson-behavior.js
war/src/main/webapp/scripts/hudson-behavior.js
+66
-0
未找到文件。
core/src/main/resources/lib/hudson/scriptConsole.jelly
浏览文件 @
8580f732
...
...
@@ -39,68 +39,14 @@ THE SOFTWARE.
<!-- this is where the example goes -->
<d:invokeBody />
<form action="script" method="post"
name="form1"
>
<textarea id="script" name="script"
style="width:100%; height:10em
">${request.getParameter('script')}</textarea>
<form action="script" method="post">
<textarea id="script" name="script"
class="script
">${request.getParameter('script')}</textarea>
<div align="right">
<f:submit value="${%Run}"/>
</div>
<script>
$('script').focus();
</script>
</form>
<st:adjunct includes="org.kohsuke.stapler.codemirror.mode.clike.clike"/>
<st:adjunct includes="org.kohsuke.stapler.codemirror.theme.default"/>
<script>
(function() {
var cmdKeyDown = false;
var w = CodeMirror.fromTextArea(document.getElementById("script"),{
mode:"text/x-groovy",
lineNumbers: true,
onKeyEvent: function(editor, event){
function isGeckoCommandKey() {
return Prototype.Browser.Gecko && event.keyCode == 224
}
function isOperaCommandKey() {
return Prototype.Browser.Opera && event.keyCode == 17
}
function isWebKitCommandKey() {
return Prototype.Browser.WebKit && (event.keyCode == 91 || event.keyCode == 93)
}
function isCommandKey() {
return isGeckoCommandKey() || isOperaCommandKey() || isWebKitCommandKey();
}
function saveAndSubmit() {
editor.save();
document.form1.submit();
event.stop();
}
// Mac (Command + Enter)
if (navigator.userAgent.indexOf('Mac') > -1) {
if (event.type == 'keydown' && isCommandKey()) {
cmdKeyDown = true;
}
if (event.type == 'keyup' && isCommandKey()) {
cmdKeyDown = false;
}
if (cmdKeyDown && event.keyCode == Event.KEY_RETURN) {
saveAndSubmit();
return true;
}
// Windows, Linux (Ctrl + Enter)
} else {
if (event.ctrlKey && event.keyCode == Event.KEY_RETURN) {
saveAndSubmit();
return true;
}
}
}
}).getWrapperElement();
w.setAttribute("style","border:1px solid black; margin-top: 1em; margin-bottom: 1em")
})();
</script>
<j:if test="${output!=null}">
<h2>${%Result}</h2>
<pre><st:out value="${output}"/></pre>
...
...
war/src/main/webapp/scripts/hudson-behavior.js
浏览文件 @
8580f732
...
...
@@ -747,6 +747,72 @@ var hudsonRules = {
scroller
.
style
.
height
=
h
+
"
px
"
;
},
// Script Console : settings and shortcut key
"
TEXTAREA.script
"
:
function
(
e
)
{
(
function
()
{
var
cmdKeyDown
=
false
;
var
mode
=
e
.
getAttribute
(
"
script-mode
"
)
||
"
text/x-groovy
"
;
var
readOnly
=
eval
(
e
.
getAttribute
(
"
script-readOnly
"
))
||
false
;
var
w
=
CodeMirror
.
fromTextArea
(
e
,{
mode
:
mode
,
lineNumbers
:
true
,
matchBrackets
:
true
,
readOnly
:
readOnly
,
onKeyEvent
:
function
(
editor
,
event
){
function
isGeckoCommandKey
()
{
return
Prototype
.
Browser
.
Gecko
&&
event
.
keyCode
==
224
}
function
isOperaCommandKey
()
{
return
Prototype
.
Browser
.
Opera
&&
event
.
keyCode
==
17
}
function
isWebKitCommandKey
()
{
return
Prototype
.
Browser
.
WebKit
&&
(
event
.
keyCode
==
91
||
event
.
keyCode
==
93
)
}
function
isCommandKey
()
{
return
isGeckoCommandKey
()
||
isOperaCommandKey
()
||
isWebKitCommandKey
();
}
function
isReturnKeyDown
()
{
return
event
.
type
==
'
keydown
'
&&
event
.
keyCode
==
Event
.
KEY_RETURN
;
}
function
getParentForm
(
element
)
{
if
(
element
==
null
)
throw
'
not found a parent form
'
;
if
(
element
instanceof
HTMLFormElement
)
return
element
;
return
getParentForm
(
element
.
parentNode
);
}
function
saveAndSubmit
()
{
editor
.
save
();
getParentForm
(
e
).
submit
();
event
.
stop
();
}
// Mac (Command + Enter)
if
(
navigator
.
userAgent
.
indexOf
(
'
Mac
'
)
>
-
1
)
{
if
(
event
.
type
==
'
keydown
'
&&
isCommandKey
())
{
cmdKeyDown
=
true
;
}
if
(
event
.
type
==
'
keyup
'
&&
isCommandKey
())
{
cmdKeyDown
=
false
;
}
if
(
cmdKeyDown
&&
isReturnKeyDown
())
{
saveAndSubmit
();
return
true
;
}
// Windows, Linux (Ctrl + Enter)
}
else
{
if
(
event
.
ctrlKey
&&
isReturnKeyDown
())
{
saveAndSubmit
();
return
true
;
}
}
}
}).
getWrapperElement
();
w
.
setAttribute
(
"
style
"
,
"
border:1px solid black; margin-top: 1em; margin-bottom: 1em
"
)
})();
},
// deferred client-side clickable map.
// this is useful where the generation of <map> element is time consuming
"
IMG[lazymap]
"
:
function
(
e
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录