diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-10-04 09:44:14 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-10-04 09:44:14 +0900 |
commit | 5381985bd012562696637122b1dcd067480a94d3 (patch) | |
tree | 7e05baefc2df32f6ef324cae755de6294c89c92f /app/assets/javascripts/lib | |
parent | 9c13a512f4a836d2d0d61dc4fbbc6fd8f76aa474 (diff) | |
parent | dfb9ac3a5f97a4c556bacea78174836fe7d39145 (diff) | |
download | gitlab-ce-5381985bd012562696637122b1dcd067480a94d3.tar.gz |
Merge branch 'master-ce' into scheduled-manual-jobs
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index 31faa11ea72..e14fff7a610 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -88,6 +88,7 @@ export const handleLocationHash = () => { const fixedDiffStats = document.querySelector('.js-diff-files-changed'); const fixedNav = document.querySelector('.navbar-gitlab'); const performanceBar = document.querySelector('#js-peek'); + const topPadding = 8; let adjustment = 0; if (fixedNav) adjustment -= fixedNav.offsetHeight; @@ -108,6 +109,10 @@ export const handleLocationHash = () => { adjustment -= performanceBar.offsetHeight; } + if (isInMRPage()) { + adjustment -= topPadding; + } + window.scrollBy(0, adjustment); }; @@ -381,8 +386,11 @@ export const objectToQueryString = (params = {}) => .map(param => `${param}=${params[param]}`) .join('&'); -export const buildUrlWithCurrentLocation = param => - (param ? `${window.location.pathname}${param}` : window.location.pathname); +export const buildUrlWithCurrentLocation = param => { + if (param) return `${window.location.pathname}${param}`; + + return window.location.pathname; +}; /** * Based on the current location and the string parameters provided |