From e1dac618a8b8929f601c7ec8aca3842c5ebf9d03 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 13 Apr 2020 20:37:36 +0900 Subject: Use plugin:prettier/recommended --- src/content/presenters/NavigationPresenter.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/content/presenters/NavigationPresenter.ts') diff --git a/src/content/presenters/NavigationPresenter.ts b/src/content/presenters/NavigationPresenter.ts index 951e62a..3edcd12 100644 --- a/src/content/presenters/NavigationPresenter.ts +++ b/src/content/presenters/NavigationPresenter.ts @@ -8,7 +8,7 @@ export default interface NavigationPresenter { openLinkNext(): void; } -const REL_PATTERN: {[key: string]: RegExp} = { +const REL_PATTERN: { [key: string]: RegExp } = { prev: /^(?:prev(?:ious)?|older)\b|\u2039|\u2190|\xab|\u226a|<>/i, }; @@ -18,7 +18,7 @@ const REL_PATTERN: {[key: string]: RegExp} = { // eslint-disable-next-line func-style function selectLast( selector: string, - filter?: (e: E) => boolean, + filter?: (e: E) => boolean ): E | null { let nodes = Array.from( window.document.querySelectorAll(selector) as NodeListOf @@ -40,15 +40,15 @@ export class NavigationPresenterImpl implements NavigationPresenter { } openLinkPrev(): void { - this.linkRel('prev'); + this.linkRel("prev"); } openLinkNext(): void { - this.linkRel('next'); + this.linkRel("next"); } // Code common to linkPrev and linkNext which navigates to the specified page. - private linkRel(rel: 'prev' | 'next'): void { + private linkRel(rel: "prev" | "next"): void { const link = selectLast(`link[rel~=${rel}][href]`); if (link) { window.location.href = link.href; @@ -57,10 +57,11 @@ export class NavigationPresenterImpl implements NavigationPresenter { const pattern = REL_PATTERN[rel]; - const a = selectLast(`a[rel~=${rel}][href]`) || - // `innerText` is much slower than `textContent`, but produces much better - // (i.e. less unexpected) results - selectLast('a[href]', lnk => pattern.test(lnk.innerText)); + const a = + selectLast(`a[rel~=${rel}][href]`) || + // `innerText` is much slower than `textContent`, but produces much better + // (i.e. less unexpected) results + selectLast("a[href]", (lnk) => pattern.test(lnk.innerText)); if (a) { a.click(); -- cgit v1.2.3