remove duplicate functionality (bad merge conflict resolution?)
This commit is contained in:
parent
24e5a1e8db
commit
ffd2823261
|
@ -57,32 +57,13 @@
|
|||
|
||||
(function () {
|
||||
document.addEventListener('page:fetch', gl.utils.cleanupBeforeFetch);
|
||||
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 () {
|
||||
// Scroll the window to avoid the topnav bar
|
||||
// https://github.com/twitter/bootstrap/issues/1768
|
||||
if (location.hash) {
|
||||
return setTimeout(adjustScroll, 100);
|
||||
window.addEventListener('hashchange', gl.utils.handleLocationHash);
|
||||
window.addEventListener('load', function onLoad() {
|
||||
window.removeEventListener('load', onLoad, false);
|
||||
if (window.location.hash) {
|
||||
setTimeout(gl.utils.handleLocationHash, 100);
|
||||
}
|
||||
};
|
||||
}, false);
|
||||
|
||||
$(function () {
|
||||
var $body = $('body');
|
||||
|
|
|
@ -94,10 +94,20 @@
|
|||
return $(document).off('scroll');
|
||||
};
|
||||
|
||||
w.gl.utils.shiftWindow = function() {
|
||||
return w.scrollBy(0, -100);
|
||||
};
|
||||
// automatically adjust scroll position for hash urls taking the height of the navbar into account
|
||||
// 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) {
|
||||
return $tooltipEl.tooltip('destroy').attr('title', newTitle).tooltip('fixTitle');
|
||||
|
|
Loading…
Reference in New Issue