summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/sidebar_height_manager.js
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2017-09-06 10:58:25 +0000
committerTim Zallmann <tzallmann@gitlab.com>2017-09-06 10:58:25 +0000
commit1632ffa6ad16738994122f0e84f331d50f220879 (patch)
treeaabb5e0b0d6f37ee068a8804ccef46b994d4afba /app/assets/javascripts/sidebar_height_manager.js
parentf497f170697c838747bb7cdaca2d1939f843a00c (diff)
parentddb3692a2218e97dfcc256e21a0fccc97c5d9a56 (diff)
downloadgitlab-ce-1632ffa6ad16738994122f0e84f331d50f220879.tar.gz
Merge branch 'clean-up-new-nav-templates' into 'master'
Clean up new navigation templates See merge request !13983
Diffstat (limited to 'app/assets/javascripts/sidebar_height_manager.js')
-rw-r--r--app/assets/javascripts/sidebar_height_manager.js37
1 files changed, 0 insertions, 37 deletions
diff --git a/app/assets/javascripts/sidebar_height_manager.js b/app/assets/javascripts/sidebar_height_manager.js
deleted file mode 100644
index 2752fe2b911..00000000000
--- a/app/assets/javascripts/sidebar_height_manager.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import _ from 'underscore';
-import Cookies from 'js-cookie';
-
-export default {
- init() {
- if (!this.initialized) {
- if (Cookies.get('new_nav') === 'true' && $('.js-issuable-sidebar').length) return;
-
- this.$window = $(window);
- this.$rightSidebar = $('.js-right-sidebar');
- this.$navHeight = $('.navbar-gitlab').outerHeight() +
- $('.layout-nav').outerHeight() +
- $('.sub-nav-scroll').outerHeight();
-
- const throttledSetSidebarHeight = _.throttle(() => this.setSidebarHeight(), 20);
- const debouncedSetSidebarHeight = _.debounce(() => this.setSidebarHeight(), 200);
-
- this.$window.on('scroll', throttledSetSidebarHeight);
- this.$window.on('resize', debouncedSetSidebarHeight);
- this.initialized = true;
- }
- },
-
- setSidebarHeight() {
- const currentScrollDepth = window.pageYOffset || 0;
- const diff = this.$navHeight - currentScrollDepth;
-
- if (diff > 0) {
- const newSidebarHeight = window.innerHeight - diff;
- this.$rightSidebar.outerHeight(newSidebarHeight);
- this.sidebarHeightIsCustom = true;
- } else if (this.sidebarHeightIsCustom) {
- this.$rightSidebar.outerHeight('100%');
- this.sidebarHeightIsCustom = false;
- }
- },
-};