Remove top link code (#1172)

This commit is contained in:
toasted-nutbread 2020-12-28 23:06:53 -05:00 committed by GitHub
parent 524c0b2b20
commit 5c970fc404
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {