From 5c970fc404e1e057749ce642ea5fb5530c88c4f9 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 28 Dec 2020 23:06:53 -0500 Subject: Remove top link code (#1172) --- ext/bg/js/settings2/settings-display-controller.js | 30 ---------------------- 1 file changed, 30 deletions(-) (limited to 'ext/bg') diff --git a/ext/bg/js/settings2/settings-display-controller.js b/ext/bg/js/settings2/settings-display-controller.js index d0fcffd9..f17e3dcb 100644 --- a/ext/bg/js/settings2/settings-display-controller.js +++ b/ext/bg/js/settings2/settings-display-controller.js @@ -25,7 +25,6 @@ class SettingsDisplayController { this._settingsController = settingsController; this._modalController = modalController; this._contentNode = null; - this._topLink = null; this._menuContainer = null; this._openPopupMenus = new Set(); this._onMoreToggleClickBind = null; @@ -34,7 +33,6 @@ class SettingsDisplayController { prepare() { this._contentNode = document.querySelector('.content'); - this._topLink = document.querySelector('.sidebar-top-link'); this._menuContainer = document.querySelector('#popup-menus'); const onFabButtonClick = this._onFabButtonClick.bind(this); @@ -73,11 +71,6 @@ class SettingsDisplayController { }); menuSelectorObserver.observe(document.documentElement, false); - if (this._topLink !== null) { - this._contentNode.addEventListener('scroll', this._onScroll.bind(this), {passive: true}); - this._topLink.addEventListener('click', this._onTopLinkClick.bind(this), false); - } - window.addEventListener('keydown', this._onKeyDown.bind(this), false); window.addEventListener('popstate', this._onPopState.bind(this), false); this._updateScrollTarget(); @@ -109,13 +102,6 @@ class SettingsDisplayController { this._showMenu(element, menu); } - _onScroll(e) { - const content = e.currentTarget; - const topLink = this._topLink; - const scrollTop = content.scrollTop; - topLink.hidden = (scrollTop < 100); - } - _onFabButtonClick(e) { const action = e.currentTarget.dataset.action; switch (action) { @@ -212,21 +198,6 @@ class SettingsDisplayController { return false; } - _onTopLinkClick(e) { - if (window.location.hash.length > 0) { - const {pathname, search} = window.location; - const url = `${pathname}${search}`; - history.pushState(null, '', url); - } - - const content = this._contentNode; - content.scrollTop = 0; - - e.preventDefault(); - e.stopPropagation(); - return false; - } - _onClosePopupMenu({popupMenu, onClose}) { this._openPopupMenus.delete(popupMenu); popupMenu.off('closed', onClose); @@ -262,7 +233,6 @@ class SettingsDisplayController { const rect1 = content.getBoundingClientRect(); const rect2 = target.getBoundingClientRect(); content.scrollTop += rect2.top - rect1.top; - this._onScroll({currentTarget: content}); } _getMoreContainer(link) { -- cgit v1.2.3