From f7907fc09ceeb13fad8058ffc5c4abf806d39fa4 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Fri, 12 Feb 2021 13:38:18 +0100 Subject: [PATCH] Fixed linter errors --- src/assets/javascripts/actions/_/index.ts | 28 +++++++++++++++++++ .../javascripts/components/search/_/index.ts | 5 +++- src/overrides/assets/javascripts/index.ts | 6 ++-- .../javascripts/templates/icon/index.tsx | 2 ++ src/overrides/main.html | 11 -------- 5 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/assets/javascripts/actions/_/index.ts b/src/assets/javascripts/actions/_/index.ts index 68796dc23..f70e8ad49 100644 --- a/src/assets/javascripts/actions/_/index.ts +++ b/src/assets/javascripts/actions/_/index.ts @@ -46,3 +46,31 @@ export function resetFocusable( ): void { el.removeAttribute("tabindex") } + +/** + * Set scroll lock + * + * @param el - Scrollable element + * @param value - Vertical offset + */ +export function setScrollLock( + el: HTMLElement, value: number +): void { + el.setAttribute("data-md-state", "lock") + el.style.top = `-${value}px` +} + +/** + * Reset scroll lock + * + * @param el - Scrollable element + */ +export function resetScrollLock( + el: HTMLElement +): void { + const value = -1 * parseInt(el.style.top, 10) + el.removeAttribute("data-md-state") + el.style.top = "" + if (value) + window.scrollTo(0, value) +} diff --git a/src/assets/javascripts/components/search/_/index.ts b/src/assets/javascripts/components/search/_/index.ts index 8212fdb7a..d46bdcbf8 100644 --- a/src/assets/javascripts/components/search/_/index.ts +++ b/src/assets/javascripts/components/search/_/index.ts @@ -24,7 +24,10 @@ import { Observable, merge } from "rxjs" import { filter, sample, take } from "rxjs/operators" import { configuration } from "~/_" -import { requestJSON, getElementOrThrow } from "~/browser" +import { + getElementOrThrow, + requestJSON +} from "~/browser" import { SearchIndex, isSearchQueryMessage, diff --git a/src/overrides/assets/javascripts/index.ts b/src/overrides/assets/javascripts/index.ts index fe5fb8623..2fe3becf8 100644 --- a/src/overrides/assets/javascripts/index.ts +++ b/src/overrides/assets/javascripts/index.ts @@ -20,12 +20,14 @@ * IN THE SOFTWARE. */ +/* eslint-disable */ + import { filter } from "fuzzaldrin-plus" import { from, fromEvent } from "rxjs" - -import { getElement, getElementOrThrow } from "browser" import { map, switchMap } from "rxjs/operators" +import { getElement, getElementOrThrow } from "~/browser" + import { renderIconSearch } from "./templates/icon" // Obtain configuration diff --git a/src/overrides/assets/javascripts/templates/icon/index.tsx b/src/overrides/assets/javascripts/templates/icon/index.tsx index 20d99e7de..5c87226cc 100644 --- a/src/overrides/assets/javascripts/templates/icon/index.tsx +++ b/src/overrides/assets/javascripts/templates/icon/index.tsx @@ -20,6 +20,8 @@ * IN THE SOFTWARE. */ +/* eslint-disable */ + import { wrap } from "fuzzaldrin-plus" import { h, round } from "utilities" diff --git a/src/overrides/main.html b/src/overrides/main.html index 43ce45197..0ba0145d6 100644 --- a/src/overrides/main.html +++ b/src/overrides/main.html @@ -96,17 +96,6 @@ {% block scripts %} {{ super() }} - - {% block config %} - {%- set configuration = { - "base": base_url, - "features": features - } -%} - - {% endblock %} - {% endblock %}