Commit ffd28232 authored by Mike Greiling's avatar Mike Greiling

remove duplicate functionality (bad merge conflict resolution?)

parent 24e5a1e8
...@@ -57,32 +57,13 @@ ...@@ -57,32 +57,13 @@
(function () { (function () {
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.handleLocationHash);
window.addEventListener('load', function onLoad() {
// automatically adjust scroll position for hash urls taking the height of the navbar into account window.removeEventListener('load', onLoad, false);
// https://github.com/twitter/bootstrap/issues/1768 if (window.location.hash) {
window.adjustScroll = function() { setTimeout(gl.utils.handleLocationHash, 100);
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 () {
// Scroll the window to avoid the topnav bar
// https://github.com/twitter/bootstrap/issues/1768
if (location.hash) {
return setTimeout(adjustScroll, 100);
} }
}; }, false);
$(function () { $(function () {
var $body = $('body'); var $body = $('body');
......
...@@ -94,10 +94,20 @@ ...@@ -94,10 +94,20 @@
return $(document).off('scroll'); return $(document).off('scroll');
}; };
w.gl.utils.shiftWindow = function() { // automatically adjust scroll position for hash urls taking the height of the navbar into account
return w.scrollBy(0, -100); // https://github.com/twitter/bootstrap/issues/1768
}; w.gl.utils.handleLocationHash = function() {
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;
if (fixedTabs) adjustment -= fixedTabs.offsetHeight;
window.scrollBy(0, adjustment);
};
gl.utils.updateTooltipTitle = function($tooltipEl, newTitle) { gl.utils.updateTooltipTitle = function($tooltipEl, newTitle) {
return $tooltipEl.tooltip('destroy').attr('title', newTitle).tooltip('fixTitle'); return $tooltipEl.tooltip('destroy').attr('title', newTitle).tooltip('fixTitle');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment