Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
82b5fe51
Commit
82b5fe51
authored
Jul 31, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uses jQuery to scroll since setting document.body.scrollTop does not work in firefox
parent
4c89929f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
app/assets/javascripts/build.js
app/assets/javascripts/build.js
+10
-9
changelogs/unreleased/34492-firefox-job.yml
changelogs/unreleased/34492-firefox-job.yml
+4
-0
No files found.
app/assets/javascripts/build.js
View file @
82b5fe51
...
@@ -64,7 +64,7 @@ window.Build = (function () {
...
@@ -64,7 +64,7 @@ window.Build = (function () {
$
(
window
)
$
(
window
)
.
off
(
'
scroll
'
)
.
off
(
'
scroll
'
)
.
on
(
'
scroll
'
,
()
=>
{
.
on
(
'
scroll
'
,
()
=>
{
const
contentHeight
=
this
.
$buildTraceOutput
.
prop
(
'
scrollHeight
'
);
const
contentHeight
=
this
.
$buildTraceOutput
.
height
(
);
if
(
contentHeight
>
this
.
windowSize
)
{
if
(
contentHeight
>
this
.
windowSize
)
{
// means the user did not scroll, the content was updated.
// means the user did not scroll, the content was updated.
this
.
windowSize
=
contentHeight
;
this
.
windowSize
=
contentHeight
;
...
@@ -105,16 +105,17 @@ window.Build = (function () {
...
@@ -105,16 +105,17 @@ window.Build = (function () {
};
};
Build
.
prototype
.
canScroll
=
function
()
{
Build
.
prototype
.
canScroll
=
function
()
{
return
document
.
body
.
scrollHeight
>
window
.
innerHeight
;
return
$
(
document
).
height
()
>
$
(
window
).
height
()
;
};
};
Build
.
prototype
.
toggleScroll
=
function
()
{
Build
.
prototype
.
toggleScroll
=
function
()
{
const
currentPosition
=
document
.
body
.
scrollTop
;
const
currentPosition
=
$
(
document
).
scrollTop
()
;
const
windowHeight
=
window
.
innerHeight
;
const
scrollHeight
=
$
(
document
).
height
()
;
const
windowHeight
=
$
(
window
).
height
();
if
(
this
.
canScroll
())
{
if
(
this
.
canScroll
())
{
if
(
currentPosition
>
0
&&
if
(
currentPosition
>
0
&&
(
document
.
body
.
scrollHeight
-
currentPosition
!==
windowHeight
))
{
(
scrollHeight
-
currentPosition
!==
windowHeight
))
{
// User is in the middle of the log
// User is in the middle of the log
this
.
toggleDisableButton
(
this
.
$scrollTopBtn
,
false
);
this
.
toggleDisableButton
(
this
.
$scrollTopBtn
,
false
);
...
@@ -124,7 +125,7 @@ window.Build = (function () {
...
@@ -124,7 +125,7 @@ window.Build = (function () {
this
.
toggleDisableButton
(
this
.
$scrollTopBtn
,
true
);
this
.
toggleDisableButton
(
this
.
$scrollTopBtn
,
true
);
this
.
toggleDisableButton
(
this
.
$scrollBottomBtn
,
false
);
this
.
toggleDisableButton
(
this
.
$scrollBottomBtn
,
false
);
}
else
if
(
document
.
body
.
scrollHeight
-
currentPosition
===
windowHeight
)
{
}
else
if
(
scrollHeight
-
currentPosition
===
windowHeight
)
{
// User is at the bottom of the build log.
// User is at the bottom of the build log.
this
.
toggleDisableButton
(
this
.
$scrollTopBtn
,
false
);
this
.
toggleDisableButton
(
this
.
$scrollTopBtn
,
false
);
...
@@ -137,7 +138,7 @@ window.Build = (function () {
...
@@ -137,7 +138,7 @@ window.Build = (function () {
};
};
Build
.
prototype
.
scrollDown
=
function
()
{
Build
.
prototype
.
scrollDown
=
function
()
{
document
.
body
.
scrollTop
=
document
.
body
.
scrollHeight
;
$
(
document
).
scrollTop
(
$
(
document
).
height
())
;
};
};
Build
.
prototype
.
scrollToBottom
=
function
()
{
Build
.
prototype
.
scrollToBottom
=
function
()
{
...
@@ -147,7 +148,7 @@ window.Build = (function () {
...
@@ -147,7 +148,7 @@ window.Build = (function () {
};
};
Build
.
prototype
.
scrollToTop
=
function
()
{
Build
.
prototype
.
scrollToTop
=
function
()
{
document
.
body
.
scrollTop
=
0
;
$
(
document
).
scrollTop
(
0
)
;
this
.
hasBeenScrolled
=
true
;
this
.
hasBeenScrolled
=
true
;
this
.
toggleScroll
();
this
.
toggleScroll
();
};
};
...
@@ -178,7 +179,7 @@ window.Build = (function () {
...
@@ -178,7 +179,7 @@ window.Build = (function () {
this
.
state
=
log
.
state
;
this
.
state
=
log
.
state
;
}
}
this
.
windowSize
=
this
.
$buildTraceOutput
.
prop
(
'
scrollHeight
'
);
this
.
windowSize
=
this
.
$buildTraceOutput
.
height
(
);
if
(
log
.
append
)
{
if
(
log
.
append
)
{
this
.
$buildTraceOutput
.
append
(
log
.
html
);
this
.
$buildTraceOutput
.
append
(
log
.
html
);
...
...
changelogs/unreleased/34492-firefox-job.yml
0 → 100644
View file @
82b5fe51
---
title
:
Use jQuery to control scroll behavior in job log for cross browser consistency
merge_request
:
author
:
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment