From b711d15dac3af6d462577c58e2fd55e760832d1e Mon Sep 17 00:00:00 2001 From: squidfunk Date: Wed, 20 Nov 2019 15:37:04 +0100 Subject: [PATCH] Documentation --- .../javascripts/component/anchor/index.ts | 22 +++++++++---------- .../javascripts/component/header/index.ts | 12 +++++----- .../javascripts/component/navigation/index.ts | 13 ++++++----- .../javascripts/component/sidebar/index.ts | 6 ++--- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/assets/javascripts/component/anchor/index.ts b/src/assets/javascripts/component/anchor/index.ts index 020b2a4da..20fc3cf59 100644 --- a/src/assets/javascripts/component/anchor/index.ts +++ b/src/assets/javascripts/component/anchor/index.ts @@ -58,35 +58,35 @@ interface WatchOptions { /** * Set anchor blur * - * @param anchor - Anchor HTML element + * @param el - Anchor element * @param blur - Anchor blur */ export function setAnchorBlur( - anchor: HTMLAnchorElement, blur: boolean + el: HTMLAnchorElement, blur: boolean ): void { - anchor.setAttribute("data-md-state", blur ? "blur" : "") + el.setAttribute("data-md-state", blur ? "blur" : "") } /** - * Set sidebar state lock + * Set anchor active * - * @param anchor - Anchor HTML element + * @param el - Anchor element * @param active - Whether the anchor is active */ export function setAnchorActive( - anchor: HTMLAnchorElement, active: boolean + el: HTMLAnchorElement, active: boolean ): void { - anchor.classList.toggle("md-nav__link--active", active) + el.classList.toggle("md-nav__link--active", active) } /** * Reset anchor * - * @param anchor - Anchor HTML element + * @param el - Anchor element */ -export function resetAnchor(anchor: HTMLAnchorElement) { - anchor.removeAttribute("data-md-state") - anchor.classList.remove("md-nav__link--active") +export function resetAnchor(el: HTMLAnchorElement) { + el.removeAttribute("data-md-state") + el.classList.remove("md-nav__link--active") } /* ------------------------------------------------------------------------- */ diff --git a/src/assets/javascripts/component/header/index.ts b/src/assets/javascripts/component/header/index.ts index 899b10119..7001e33af 100644 --- a/src/assets/javascripts/component/header/index.ts +++ b/src/assets/javascripts/component/header/index.ts @@ -42,22 +42,22 @@ export interface Header { /** * Set header shadow * - * @param header - Header HTML element + * @param el - Header element * @param shadow - Shadow */ export function setHeaderShadow( - header: HTMLElement, shadow: boolean + el: HTMLElement, shadow: boolean ): void { - header.setAttribute("data-md-state", shadow ? "shadow" : "") + el.setAttribute("data-md-state", shadow ? "shadow" : "") } /** * Reset header * - * @param header - Header HTML element + * @param el - Header element */ -export function resetHeader(header: HTMLElement): void { - header.removeAttribute("data-md-state") +export function resetHeader(el: HTMLElement): void { + el.removeAttribute("data-md-state") } /* ------------------------------------------------------------------------- */ diff --git a/src/assets/javascripts/component/navigation/index.ts b/src/assets/javascripts/component/navigation/index.ts index 8838e19a7..71684ed47 100644 --- a/src/assets/javascripts/component/navigation/index.ts +++ b/src/assets/javascripts/component/navigation/index.ts @@ -41,13 +41,14 @@ export type NavigationIndex = Map /** * Set navigation overflow scrolling * - * @param nav - Navigation element + * @param el - Navigation element * @param active - Whether overflow scrolling is active */ export function setNavigationOverflowScrolling( - nav: HTMLElement, active: boolean + el: HTMLElement, active: boolean ): void { - nav.style.webkitOverflowScrolling = active ? "touch" : "" + el.style.background = active ? "yellow" : "" // TODO: hack, temporary + el.style.webkitOverflowScrolling = active ? "touch" : "" } /* ------------------------------------------------------------------------- */ @@ -55,14 +56,14 @@ export function setNavigationOverflowScrolling( /** * Create an observable to index all navigation elements * - * @param nav - Top-level navigation element + * @param el - Top-level navigation element * * @return Navigation index observable */ export function watchNavigationIndex( - nav: HTMLElement + el: HTMLElement ): Observable { - const list = getElements("nav", nav) + const list = getElements("nav", el) /* Build index to map inputs to navigation lists */ const index = new Map() diff --git a/src/assets/javascripts/component/sidebar/index.ts b/src/assets/javascripts/component/sidebar/index.ts index 4db3b49ba..e518b3d76 100644 --- a/src/assets/javascripts/component/sidebar/index.ts +++ b/src/assets/javascripts/component/sidebar/index.ts @@ -58,7 +58,7 @@ interface WatchOptions { /** * Set sidebar height * - * @param el - Sidebar HTML element + * @param el - Sidebar element * @param height - Sidebar height */ export function setSidebarHeight( @@ -70,7 +70,7 @@ export function setSidebarHeight( /** * Set sidebar lock * - * @param el - Sidebar HTML element + * @param el - Sidebar element * @param lock - Whether the sidebar is locked */ export function setSidebarLock( @@ -82,7 +82,7 @@ export function setSidebarLock( /** * Reset sidebar * - * @param el - Sidebar HTML element + * @param el - Sidebar element */ export function resetSidebar(el: HTMLElement): void { el.removeAttribute("data-md-state")