Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-06-16 17:20:18 +0300
committerVincent Petry <pvince81@owncloud.com>2015-06-16 17:20:18 +0300
commitad3f9dbb7419b4711ff4849270cf694645aa6567 (patch)
tree1ae315b60eecbe947916b9e1c256a7f89a240132 /core
parent64d502d602d9649a2c05c0c283fb31592fc1505e (diff)
parenta040a5b08e83b08d98780554cef053914fc01a4b (diff)
Merge pull request #16744 from owncloud/backport-15260
[stable8] Backport scrollbar fixes
Diffstat (limited to 'core')
-rw-r--r--core/js/js.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 78342ce97bd..401295244cf 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1191,6 +1191,33 @@ function initCore() {
// initial call
toggleSnapperOnSize();
+ // adjust controls bar width
+ var adjustControlsWidth = function() {
+ if($('#controls').length) {
+ var controlsWidth;
+ // if there is a scrollbar …
+ if($('#app-content').get(0).scrollHeight > $('#app-content').height()) {
+ if($(window).width() > 768) {
+ controlsWidth = $('#content').width() - $('#app-navigation').width() - getScrollBarWidth();
+ } else {
+ controlsWidth = $('#content').width() - getScrollBarWidth();
+ }
+ } else { // if there is none
+ if($(window).width() > 768) {
+ controlsWidth = $('#content').width() - $('#app-navigation').width();
+ } else {
+ controlsWidth = $('#content').width();
+ }
+ }
+ $('#controls').css('width', controlsWidth);
+ $('#controls').css('min-width', controlsWidth);
+ }
+ };
+
+ $(window).resize(_.debounce(adjustControlsWidth, 250));
+
+ $('body').delegate('#app-content', 'apprendered', adjustControlsWidth);
+
}
}
@@ -1615,3 +1642,31 @@ 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);
+}