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
f02f08f5
Unverified
Commit
f02f08f5
authored
Oct 21, 2016
by
Luke Bennett
Committed by
Luke "Jared" Bennett
Nov 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Account for merge request fixed affix bar
account for merge request fixed affix bar when adjusting scroll targets
parent
0c99e5d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
application.js
app/assets/javascripts/application.js
+18
-1
merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+1
-1
No files found.
app/assets/javascripts/application.js
View file @
f02f08f5
...
@@ -58,11 +58,28 @@
...
@@ -58,11 +58,28 @@
document
.
addEventListener
(
'page:fetch'
,
gl
.
utils
.
cleanupBeforeFetch
);
document
.
addEventListener
(
'page:fetch'
,
gl
.
utils
.
cleanupBeforeFetch
);
window
.
addEventListener
(
'hashchange'
,
gl
.
utils
.
shiftWindow
);
window
.
addEventListener
(
'hashchange'
,
gl
.
utils
.
shiftWindow
);
// automatically adjust scroll position for hash urls taking the height of the navbar into account
// https://github.com/twitter/bootstrap/issues/1768
window
.
adjustScroll
=
function
()
{
var
navbar
=
document
.
querySelector
(
'.navbar-gitlab'
);
var
subnav
=
document
.
querySelector
(
'.layout-nav'
);
var
fixedTabs
=
document
.
querySelector
(
'.js-tabs-affix'
);
adjustment
=
0
;
if
(
navbar
)
adjustment
-=
navbar
.
offsetHeight
;
if
(
subnav
)
adjustment
-=
subnav
.
offsetHeight
;
if
(
fixedTabs
)
adjustment
-=
fixedTabs
.
offsetHeight
;
return
scrollBy
(
0
,
adjustment
);
};
window
.
addEventListener
(
"hashchange"
,
adjustScroll
);
window
.
onload
=
function
()
{
window
.
onload
=
function
()
{
// Scroll the window to avoid the topnav bar
// Scroll the window to avoid the topnav bar
// https://github.com/twitter/bootstrap/issues/1768
// https://github.com/twitter/bootstrap/issues/1768
if
(
location
.
hash
)
{
if
(
location
.
hash
)
{
return
setTimeout
(
gl
.
utils
.
shiftWindow
,
100
);
return
setTimeout
(
adjustScroll
,
100
);
}
}
};
};
...
...
app/assets/javascripts/merge_request_tabs.js
View file @
f02f08f5
...
@@ -130,7 +130,7 @@
...
@@ -130,7 +130,7 @@
MergeRequestTabs
.
prototype
.
scrollToElement
=
function
(
container
)
{
MergeRequestTabs
.
prototype
.
scrollToElement
=
function
(
container
)
{
var
$el
,
navBarHeight
;
var
$el
,
navBarHeight
;
if
(
window
.
location
.
hash
)
{
if
(
window
.
location
.
hash
)
{
navBarHeight
=
$
(
'.navbar-gitlab'
).
outerHeight
()
+
$
(
'.layout-nav'
).
outerHeight
();
navBarHeight
=
$
(
'.navbar-gitlab'
).
outerHeight
()
+
$
(
'.layout-nav'
).
outerHeight
()
+
document
.
querySelector
(
'.js-tabs-affix'
).
offsetHeight
;
$el
=
$
(
container
+
" "
+
window
.
location
.
hash
+
":not(.match)"
);
$el
=
$
(
container
+
" "
+
window
.
location
.
hash
+
":not(.match)"
);
if
(
$el
.
length
)
{
if
(
$el
.
length
)
{
return
$
.
scrollTo
(
container
+
" "
+
window
.
location
.
hash
+
":not(.match)"
,
{
return
$
.
scrollTo
(
container
+
" "
+
window
.
location
.
hash
+
":not(.match)"
,
{
...
...
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