summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2017-01-04 13:27:20 -0600
committerAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2017-02-10 15:09:08 -0600
commit19cb7b0a3ddbcc94f5c46a60d1494d53bd4faaee (patch)
tree92adcc690503ae4f09449cd1b9ff5b4e1a06b091
parenta11e798aa0fdc2f67bdc0fc5ad611a6872af0e9f (diff)
downloadgitlab-ce-19cb7b0a3ddbcc94f5c46a60d1494d53bd4faaee.tar.gz
Remove navbar height offsets
-rw-r--r--app/assets/javascripts/build.js2
-rw-r--r--app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es62
-rw-r--r--app/assets/javascripts/lib/utils/common_utils.js.es624
-rw-r--r--app/assets/javascripts/merge_request_tabs.js.es67
4 files changed, 5 insertions, 30 deletions
diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js
index eed447d54a0..86fb08c00a5 100644
--- a/app/assets/javascripts/build.js
+++ b/app/assets/javascripts/build.js
@@ -285,7 +285,7 @@
e.preventDefault();
$currentTarget = $(e.currentTarget);
$.scrollTo($currentTarget.attr('href'), {
- offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight())
+ offset: 0
});
};
diff --git a/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6 b/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6
index 57cb0d0ae6e..283dc330cad 100644
--- a/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6
+++ b/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6
@@ -181,7 +181,7 @@ const Vue = require('vue');
}
$.scrollTo($target, {
- offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight())
+ offset: 0
});
}
},
diff --git a/app/assets/javascripts/lib/utils/common_utils.js.es6 b/app/assets/javascripts/lib/utils/common_utils.js.es6
index 5becf688652..0966adcfb68 100644
--- a/app/assets/javascripts/lib/utils/common_utils.js.es6
+++ b/app/assets/javascripts/lib/utils/common_utils.js.es6
@@ -69,30 +69,18 @@
var hash = w.gl.utils.getLocationHash();
if (!hash) return;
- // This is required to handle non-unicode characters in hash
- hash = decodeURIComponent(hash);
-
- var navbar = document.querySelector('.navbar-gitlab');
- var subnav = document.querySelector('.layout-nav');
- var fixedTabs = document.querySelector('.js-tabs-affix');
-
- var adjustment = 0;
- if (navbar) adjustment -= navbar.offsetHeight;
- if (subnav) adjustment -= subnav.offsetHeight;
-
// scroll to user-generated markdown anchor if we cannot find a match
if (document.getElementById(hash) === null) {
var target = document.getElementById('user-content-' + hash);
if (target && target.scrollIntoView) {
target.scrollIntoView(true);
- window.scrollBy(0, adjustment);
}
} else {
// only adjust for fixedTabs when not targeting user-generated content
+ var fixedTabs = document.querySelector('.js-tabs-affix');
if (fixedTabs) {
- adjustment -= fixedTabs.offsetHeight;
+ window.scrollBy(0, -fixedTabs.offsetHeight);
}
- window.scrollBy(0, adjustment);
}
};
@@ -137,14 +125,6 @@
return e.metaKey || e.ctrlKey || e.altKey || e.shiftKey;
};
- gl.utils.isMetaClick = function(e) {
- // Identify following special clicks
- // 1) Cmd + Click on Mac (e.metaKey)
- // 2) Ctrl + Click on PC (e.ctrlKey)
- // 3) Middle-click or Mouse Wheel Click (e.which is 2)
- return e.metaKey || e.ctrlKey || e.which === 2;
- };
-
gl.utils.scrollToElement = function($el) {
var top = $el.offset().top;
gl.navBarHeight = gl.navBarHeight || $('.navbar-gitlab').height();
diff --git a/app/assets/javascripts/merge_request_tabs.js.es6 b/app/assets/javascripts/merge_request_tabs.js.es6
index e74658d59bd..fad96ff2882 100644
--- a/app/assets/javascripts/merge_request_tabs.js.es6
+++ b/app/assets/javascripts/merge_request_tabs.js.es6
@@ -125,9 +125,8 @@ require('./flash');
if (this.diffViewType() === 'parallel') {
this.expandViewContainer();
}
- const navBarHeight = $('.navbar-gitlab').outerHeight();
$.scrollTo('.merge-request-details .merge-request-tabs', {
- offset: -navBarHeight,
+ offset: 0,
});
} else {
this.expandView();
@@ -141,8 +140,6 @@ require('./flash');
scrollToElement(container) {
if (location.hash) {
const offset = 0 - (
- $('.navbar-gitlab').outerHeight() +
- $('.layout-nav').outerHeight() +
$('.js-tabs-affix').outerHeight()
);
const $el = $(`${container} ${location.hash}:not(.match)`);
@@ -330,8 +327,6 @@ require('./flash');
if (Breakpoints.get().getBreakpointSize() === 'xs' || !$tabs.length) return;
const $diffTabs = $('#diff-notes-app');
- const $fixedNav = $('.navbar-fixed-top');
- const $layoutNav = $('.layout-nav');
$tabs.off('affix.bs.affix affix-top.bs.affix')
.affix({