Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
97f65071
Commit
97f65071
authored
Aug 10, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace jQuery's outerHeight with vanilla implementation
parent
0bdfe446
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+19
-6
No files found.
app/assets/javascripts/lib/utils/common_utils.js
View file @
97f65071
...
...
@@ -151,11 +151,24 @@ export const isMetaKey = (e) => e.metaKey || e.ctrlKey || e.altKey || e.shiftKey
// 3) Middle-click or Mouse Wheel Click (e.which is 2)
export
const
isMetaClick
=
(
e
)
=>
e
.
metaKey
||
e
.
ctrlKey
||
e
.
which
===
2
;
/**
* Get the current computed outer height for given selector.
*/
export
const
getOuterHeight
=
(
selector
)
=>
{
const
element
=
document
.
querySelector
(
selector
);
if
(
!
element
)
{
return
undefined
;
}
return
element
.
offsetHeight
;
};
export
const
contentTop
=
()
=>
{
const
isDesktop
=
breakpointInstance
.
isDesktop
();
const
heightCalculators
=
[
()
=>
$
(
'
#js-peek
'
).
outerHeight
(
),
()
=>
$
(
'
.navbar-gitlab
'
).
outerHeight
(
),
()
=>
getOuterHeight
(
'
#js-peek
'
),
()
=>
getOuterHeight
(
'
.navbar-gitlab
'
),
({
desktop
})
=>
{
const
container
=
document
.
querySelector
(
'
.line-resolve-all-container
'
);
let
size
=
0
;
...
...
@@ -166,14 +179,14 @@ export const contentTop = () => {
return
size
;
},
()
=>
$
(
'
.merge-request-tabs
'
).
outerHeight
(
),
()
=>
$
(
'
.js-diff-files-changed
'
).
outerHeight
(
),
()
=>
getOuterHeight
(
'
.merge-request-tabs
'
),
()
=>
getOuterHeight
(
'
.js-diff-files-changed
'
),
({
desktop
})
=>
{
const
diffsTabIsActive
=
window
.
mrTabs
?.
currentAction
===
'
diffs
'
;
let
size
;
if
(
desktop
&&
diffsTabIsActive
)
{
size
=
$
(
'
.diff-file .file-title-flex-parent:visible
'
).
outerHeight
(
);
size
=
getOuterHeight
(
'
.diff-file .file-title-flex-parent:not([style="display:none"])
'
);
}
return
size
;
...
...
@@ -182,7 +195,7 @@ export const contentTop = () => {
let
size
;
if
(
desktop
)
{
size
=
$
(
'
.mr-version-controls
'
).
outerHeight
(
);
size
=
getOuterHeight
(
'
.mr-version-controls
'
);
}
return
size
;
...
...
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