From 170445c95fc9b5581510c2c3ea8136e801390f7a Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 25 Jun 2017 18:01:27 -0400 Subject: [PATCH] Add setting to force native scrollbars on webkit/blink Closes #601. --- assets/javascripts/app/app.coffee | 1 + assets/javascripts/lib/util.coffee | 9 ++++ .../templates/pages/settings_tmpl.coffee | 3 ++ .../views/content/settings_page.coffee | 3 +- assets/stylesheets/components/_content.scss | 45 +++---------------- assets/stylesheets/components/_settings.scss | 3 ++ assets/stylesheets/components/_sidebar.scss | 25 +++++------ assets/stylesheets/global/_base.scss | 45 +++++++++++++++++++ 8 files changed, 80 insertions(+), 54 deletions(-) diff --git a/assets/javascripts/app/app.coffee b/assets/javascripts/app/app.coffee index 3993970e..cb915261 100644 --- a/assets/javascripts/app/app.coffee +++ b/assets/javascripts/app/app.coffee @@ -185,6 +185,7 @@ return hideLoading: -> + document.body.classList.add '_overlay-scrollbars' if $.overlayScrollbarsEnabled() document.body.classList.remove '_booting' document.body.classList.remove '_loading' return diff --git a/assets/javascripts/lib/util.coffee b/assets/javascripts/lib/util.coffee index ca1fbc7a..c2e8e7f1 100644 --- a/assets/javascripts/lib/util.coffee +++ b/assets/javascripts/lib/util.coffee @@ -357,6 +357,15 @@ isIOS = null $.isIOS = -> isIOS ?= navigator.userAgent?.indexOf('iPhone') >= 0 || navigator.userAgent?.indexOf('iPad') >= 0 +$.overlayScrollbarsEnabled = -> + return false unless $.isMac() + div = document.createElement('div') + div.setAttribute('style', 'width: 100px; height: 100px; overflow: scroll; position: absolute') + document.body.appendChild(div) + result = div.offsetWidth is div.clientWidth + document.body.removeChild(div) + result + HIGHLIGHT_DEFAULTS = className: 'highlight' delay: 1000 diff --git a/assets/javascripts/templates/pages/settings_tmpl.coffee b/assets/javascripts/templates/pages/settings_tmpl.coffee index e1b0a6dc..2e5b6ed2 100644 --- a/assets/javascripts/templates/pages/settings_tmpl.coffee +++ b/assets/javascripts/templates/pages/settings_tmpl.coffee @@ -25,6 +25,9 @@ app.templates.settingsPage = (settings) -> """ +