Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
d728b85f
Commit
d728b85f
authored
Mar 27, 2015
by
Jan-Christoph Borchardt
Browse files
adjust controls bar width to not overlay scrollbar
parent
fb899460
Changes
2
Hide whitespace changes
Inline
Side-by-side
apps/files/js/filelist.js
View file @
d728b85f
...
...
@@ -635,6 +635,8 @@
* @param filesArray array of file data (map)
*/
setFiles
:
function
(
filesArray
)
{
var
self
=
this
;
// detach to make adding multiple rows faster
this
.
files
=
filesArray
;
...
...
@@ -655,7 +657,10 @@
this
.
updateSelectionSummary
();
$
(
window
).
scrollTop
(
0
);
this
.
$fileList
.
trigger
(
jQuery
.
Event
(
"
updated
"
));
this
.
$fileList
.
trigger
(
jQuery
.
Event
(
'
updated
'
));
_
.
defer
(
function
()
{
self
.
$el
.
closest
(
'
#app-content
'
).
trigger
(
jQuery
.
Event
(
'
apprendered
'
));
});
},
/**
* Creates a new table row element using the given file data.
...
...
core/js/js.js
View file @
d728b85f
...
...
@@ -1261,6 +1261,32 @@ function initCore() {
// initial call
toggleSnapperOnSize
();
// adjust controls bar width
var
adjustControlsWidth
=
function
()
{
if
(
$
(
'
#controls
'
).
length
)
{
// if there is a scrollbar …
if
(
$
(
'
#app-content
'
).
get
(
0
).
scrollHeight
>
$
(
'
#app-content
'
).
height
())
{
if
(
$
(
window
).
width
()
>
768
)
{
var
controlsWidth
=
$
(
'
#content
'
).
width
()
-
$
(
'
#app-navigation
'
).
width
()
-
getScrollBarWidth
();
}
else
{
var
controlsWidth
=
$
(
'
#content
'
).
width
()
-
getScrollBarWidth
();
}
}
else
{
// if there is none
if
(
$
(
window
).
width
()
>
768
)
{
var
controlsWidth
=
$
(
'
#content
'
).
width
()
-
$
(
'
#app-navigation
'
).
width
();
}
else
{
var
controlsWidth
=
$
(
'
#content
'
).
width
();
}
}
$
(
'
#controls
'
).
css
(
'
width
'
,
controlsWidth
);
$
(
'
#controls
'
).
css
(
'
min-width
'
,
controlsWidth
);
}
};
$
(
window
).
resize
(
_
.
debounce
(
adjustControlsWidth
,
250
));
$
(
'
body
'
).
delegate
(
'
#app-content
'
,
'
apprendered
'
,
adjustControlsWidth
);
}
}
...
...
@@ -1685,3 +1711,29 @@ jQuery.fn.selectRange = function(start, end) {
jQuery
.
fn
.
exists
=
function
(){
return
this
.
length
>
0
;
};
function
getScrollBarWidth
()
{
var
inner
=
document
.
createElement
(
'
p
'
);
inner
.
style
.
width
=
"
100%
"
;
inner
.
style
.
height
=
"
200px
"
;
var
outer
=
document
.
createElement
(
'
div
'
);
outer
.
style
.
position
=
"
absolute
"
;
outer
.
style
.
top
=
"
0px
"
;
outer
.
style
.
left
=
"
0px
"
;
outer
.
style
.
visibility
=
"
hidden
"
;
outer
.
style
.
width
=
"
200px
"
;
outer
.
style
.
height
=
"
150px
"
;
outer
.
style
.
overflow
=
"
hidden
"
;
outer
.
appendChild
(
inner
);
document
.
body
.
appendChild
(
outer
);
var
w1
=
inner
.
offsetWidth
;
outer
.
style
.
overflow
=
'
scroll
'
;
var
w2
=
inner
.
offsetWidth
;
if
(
w1
==
w2
)
w2
=
outer
.
clientWidth
;
document
.
body
.
removeChild
(
outer
);
return
(
w1
-
w2
);
};
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