Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
57a4c02c
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
57a4c02c
编写于
6月 29, 2012
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'pull-506'
上级
f5d378f2
30837d89
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
102 addition
and
43 deletion
+102
-43
changelog.html
changelog.html
+3
-0
war/src/main/webapp/scripts/hudson-behavior.js
war/src/main/webapp/scripts/hudson-behavior.js
+99
-43
未找到文件。
changelog.html
浏览文件 @
57a4c02c
...
...
@@ -58,6 +58,9 @@ Upcoming changes</a>
<li
class=
bug
>
Fix French translation
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-13274"
>
issue 13274
</a>
)
<li
class=
rfe
>
Avoid doing AJAX updates if the page becomes invisible.
(
<a
href=
"https://github.com/jenkinsci/jenkins/pull/506"
>
pull 506
</a>
)
<li
class=
rfe
>
Added a new extension point to listen to polling activities.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-14178"
>
issue 14178
</a>
)
...
...
war/src/main/webapp/scripts/hudson-behavior.js
浏览文件 @
57a4c02c
...
...
@@ -36,6 +36,50 @@ function object(o) {
return
new
F
();
}
/**
* A function that returns false if the page is known to be invisible.
*/
var
isPageVisible
=
(
function
(){
// @see https://developer.mozilla.org/en/DOM/Using_the_Page_Visibility_API
// Set the name of the hidden property and the change event for visibility
var
hidden
,
visibilityChange
;
if
(
typeof
document
.
hidden
!==
"
undefined
"
)
{
hidden
=
"
hidden
"
;
visibilityChange
=
"
visibilitychange
"
;
}
else
if
(
typeof
document
.
mozHidden
!==
"
undefined
"
)
{
hidden
=
"
mozHidden
"
;
visibilityChange
=
"
mozvisibilitychange
"
;
}
else
if
(
typeof
document
.
msHidden
!==
"
undefined
"
)
{
hidden
=
"
msHidden
"
;
visibilityChange
=
"
msvisibilitychange
"
;
}
else
if
(
typeof
document
.
webkitHidden
!==
"
undefined
"
)
{
hidden
=
"
webkitHidden
"
;
visibilityChange
=
"
webkitvisibilitychange
"
;
}
// By default, visibility set to true
var
pageIsVisible
=
true
;
// If the page is hidden, prevent any polling
// if the page is shown, restore pollings
function
onVisibilityChange
()
{
pageIsVisible
=
!
document
[
hidden
];
}
// Warn if the browser doesn't support addEventListener or the Page Visibility API
if
(
typeof
document
.
addEventListener
!==
"
undefined
"
&&
typeof
hidden
!==
"
undefined
"
)
{
// Init the value to the real state of the page
pageIsVisible
=
!
document
[
hidden
];
// Handle page visibility change
document
.
addEventListener
(
visibilityChange
,
onVisibilityChange
,
false
);
}
return
function
()
{
return
pageIsVisible
;
}
})();
// id generator
var
iota
=
0
;
...
...
@@ -1439,26 +1483,33 @@ function expandTextArea(button,id) {
// by using the contents fetched from the given URL.
function
refreshPart
(
id
,
url
)
{
var
f
=
function
()
{
new
Ajax
.
Request
(
url
,
{
onSuccess
:
function
(
rsp
)
{
var
hist
=
$
(
id
);
var
p
=
hist
.
up
();
var
next
=
hist
.
next
();
p
.
removeChild
(
hist
);
if
(
isPageVisible
())
{
new
Ajax
.
Request
(
url
,
{
onSuccess
:
function
(
rsp
)
{
var
hist
=
$
(
id
);
var
p
=
hist
.
up
();
var
next
=
hist
.
next
();
p
.
removeChild
(
hist
);
var
div
=
document
.
createElement
(
'
div
'
);
div
.
innerHTML
=
rsp
.
responseText
;
var
div
=
document
.
createElement
(
'
div
'
);
div
.
innerHTML
=
rsp
.
responseText
;
var
node
=
$
(
div
).
firstDescendant
();
p
.
insertBefore
(
node
,
next
);
var
node
=
$
(
div
).
firstDescendant
();
p
.
insertBefore
(
node
,
next
);
Behaviour
.
applySubtree
(
node
);
layoutUpdateCallback
.
call
();
Behaviour
.
applySubtree
(
node
);
layoutUpdateCallback
.
call
();
if
(
isRunAsTest
)
return
;
refreshPart
(
id
,
url
);
}
});
if
(
isRunAsTest
)
return
;
refreshPart
(
id
,
url
);
}
});
}
else
{
// Reschedule
if
(
isRunAsTest
)
return
;
refreshPart
(
id
,
url
);
}
};
// if run as test, just do it once and do it now to make sure it's working,
// but don't repeat.
...
...
@@ -1534,35 +1585,40 @@ function updateBuildHistory(ajaxUrl,nBuild) {
$
(
'
buildHistory
'
).
headers
=
[
"
n
"
,
nBuild
];
function
updateBuilds
()
{
var
bh
=
$
(
'
buildHistory
'
);
if
(
bh
.
headers
==
null
)
{
// Yahoo.log("Missing headers in buildHistory element");
}
new
Ajax
.
Request
(
ajaxUrl
,
{
requestHeaders
:
bh
.
headers
,
onSuccess
:
function
(
rsp
)
{
var
rows
=
bh
.
rows
;
//delete rows with transitive data
while
(
rows
.
length
>
2
&&
Element
.
hasClassName
(
rows
[
1
],
"
transitive
"
))
Element
.
remove
(
rows
[
1
]);
// insert new rows
var
div
=
document
.
createElement
(
'
div
'
);
div
.
innerHTML
=
rsp
.
responseText
;
Behaviour
.
applySubtree
(
div
);
if
(
isPageVisible
()){
var
bh
=
$
(
'
buildHistory
'
);
if
(
bh
.
headers
==
null
)
{
// Yahoo.log("Missing headers in buildHistory element");
}
new
Ajax
.
Request
(
ajaxUrl
,
{
requestHeaders
:
bh
.
headers
,
onSuccess
:
function
(
rsp
)
{
var
rows
=
bh
.
rows
;
//delete rows with transitive data
while
(
rows
.
length
>
2
&&
Element
.
hasClassName
(
rows
[
1
],
"
transitive
"
))
Element
.
remove
(
rows
[
1
]);
// insert new rows
var
div
=
document
.
createElement
(
'
div
'
);
div
.
innerHTML
=
rsp
.
responseText
;
Behaviour
.
applySubtree
(
div
);
var
pivot
=
rows
[
0
];
var
newRows
=
$
(
div
).
firstDescendant
().
rows
;
for
(
var
i
=
newRows
.
length
-
1
;
i
>=
0
;
i
--
)
{
pivot
.
parentNode
.
insertBefore
(
newRows
[
i
],
pivot
.
nextSibling
);
}
var
pivot
=
rows
[
0
];
var
newRows
=
$
(
div
).
firstDescendant
().
rows
;
for
(
var
i
=
newRows
.
length
-
1
;
i
>=
0
;
i
--
)
{
pivot
.
parentNode
.
insertBefore
(
newRows
[
i
],
pivot
.
nextSibling
);
// next update
bh
.
headers
=
[
"
n
"
,
rsp
.
getResponseHeader
(
"
n
"
)];
window
.
setTimeout
(
updateBuilds
,
5000
);
}
// next update
bh
.
headers
=
[
"
n
"
,
rsp
.
getResponseHeader
(
"
n
"
)];
window
.
setTimeout
(
updateBuilds
,
5000
);
}
});
});
}
else
{
// Reschedule again
window
.
setTimeout
(
updateBuilds
,
5000
);
}
}
window
.
setTimeout
(
updateBuilds
,
5000
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录