BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
6e1d8ab9
Commit
6e1d8ab9
authored
Oct 24, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sticky-perf' into 'master'
Fix performance of sticky.js Closes #39332 See merge request gitlab-org/gitlab-ce!14976
parents
057c81b1
f03d9a9b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
10 deletions
+16
-10
dispatcher.js
app/assets/javascripts/dispatcher.js
+2
-1
init_changes_dropdown.js
app/assets/javascripts/init_changes_dropdown.js
+2
-2
sticky.js
app/assets/javascripts/lib/utils/sticky.js
+2
-6
merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+10
-1
No files found.
app/assets/javascripts/dispatcher.js
View file @
6e1d8ab9
...
...
@@ -240,7 +240,8 @@ import Diff from './diff';
break
;
case
'projects:compare:show'
:
new
Diff
();
initChangesDropdown
();
const
paddingTop
=
16
;
initChangesDropdown
(
document
.
querySelector
(
'.navbar-gitlab'
).
offsetHeight
-
paddingTop
);
break
;
case
'projects:branches:new'
:
case
'projects:branches:create'
:
...
...
app/assets/javascripts/init_changes_dropdown.js
View file @
6e1d8ab9
import
stickyMonitor
from
'./lib/utils/sticky'
;
export
default
()
=>
{
stickyMonitor
(
document
.
querySelector
(
'.js-diff-files-changed'
));
export
default
(
stickyTop
)
=>
{
stickyMonitor
(
document
.
querySelector
(
'.js-diff-files-changed'
)
,
stickyTop
);
$
(
'.js-diff-stats-dropdown'
).
glDropdown
({
filterable
:
true
,
...
...
app/assets/javascripts/lib/utils/sticky.js
View file @
6e1d8ab9
...
...
@@ -28,14 +28,10 @@ export const isSticky = (el, scrollY, stickyTop, insertPlaceholder) => {
}
};
export
default
(
el
,
insertPlaceholder
=
true
)
=>
{
export
default
(
el
,
stickyTop
,
insertPlaceholder
=
true
)
=>
{
if
(
!
el
)
return
;
const
computedStyle
=
window
.
getComputedStyle
(
el
);
if
(
!
/sticky/
.
test
(
computedStyle
.
position
))
return
;
const
stickyTop
=
parseInt
(
computedStyle
.
top
,
10
);
if
(
typeof
CSS
===
'undefined'
||
!
(
CSS
.
supports
(
'(position: -webkit-sticky) or (position: sticky)'
)))
return
;
document
.
addEventListener
(
'scroll'
,
()
=>
isSticky
(
el
,
window
.
scrollY
,
stickyTop
,
insertPlaceholder
),
{
passive
:
true
,
...
...
app/assets/javascripts/merge_request_tabs.js
View file @
6e1d8ab9
...
...
@@ -67,6 +67,10 @@ import Diff from './diff';
class
MergeRequestTabs
{
constructor
({
action
,
setUrl
,
stubLocation
}
=
{})
{
const
mergeRequestTabs
=
document
.
querySelector
(
'.js-tabs-affix'
);
const
navbar
=
document
.
querySelector
(
'.navbar-gitlab'
);
const
paddingTop
=
16
;
this
.
diffsLoaded
=
false
;
this
.
pipelinesLoaded
=
false
;
this
.
commitsLoaded
=
false
;
...
...
@@ -76,6 +80,11 @@ import Diff from './diff';
this
.
setCurrentAction
=
this
.
setCurrentAction
.
bind
(
this
);
this
.
tabShown
=
this
.
tabShown
.
bind
(
this
);
this
.
showTab
=
this
.
showTab
.
bind
(
this
);
this
.
stickyTop
=
navbar
?
navbar
.
offsetHeight
-
paddingTop
:
0
;
if
(
mergeRequestTabs
)
{
this
.
stickyTop
+=
mergeRequestTabs
.
offsetHeight
;
}
if
(
stubLocation
)
{
location
=
stubLocation
;
...
...
@@ -278,7 +287,7 @@ import Diff from './diff';
const
$container
=
$
(
'#diffs'
);
$container
.
html
(
data
.
html
);
initChangesDropdown
();
initChangesDropdown
(
this
.
stickyTop
);
if
(
typeof
gl
.
diffNotesCompileComponents
!==
'undefined'
)
{
gl
.
diffNotesCompileComponents
();
...
...
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