diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-24 22:25:42 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-24 22:25:42 +0900 |
commit | 03370301a7509af4bbc96d60269598bf89c71fe4 (patch) | |
tree | bddfea01bb941e76aeccc21aab79ceb0e7d5f9d7 /src/background | |
parent | 45a10d93c741da285937e6d13401d39c65ee609d (diff) |
NavigateUseCase TabPresenter
Diffstat (limited to 'src/background')
-rw-r--r-- | src/background/presenters/TabPresenter.ts | 4 | ||||
-rw-r--r-- | src/background/usecases/NavigateUseCase.ts | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/background/presenters/TabPresenter.ts b/src/background/presenters/TabPresenter.ts index 5e6e56e..ed88f26 100644 --- a/src/background/presenters/TabPresenter.ts +++ b/src/background/presenters/TabPresenter.ts @@ -36,7 +36,9 @@ export default class TabPresenter { return tabId; } - async getByKeyword(keyword: string, excludePinned: boolean = false): Promise<Tab[]> { + async getByKeyword( + keyword: string, excludePinned: boolean = false, + ): Promise<Tab[]> { let tabs = await browser.tabs.query({ currentWindow: true }); return tabs.filter((t) => { return t.url && t.url.toLowerCase().includes(keyword.toLowerCase()) || diff --git a/src/background/usecases/NavigateUseCase.ts b/src/background/usecases/NavigateUseCase.ts index ced2a0b..152339a 100644 --- a/src/background/usecases/NavigateUseCase.ts +++ b/src/background/usecases/NavigateUseCase.ts @@ -33,9 +33,9 @@ export default class NavigateUseCase { async openParent(): Promise<void> { let tab = await this.tabPresenter.getCurrent(); let url = new URL(tab.url!!); - if (url.hash !== '') { + if (url.hash.length > 0) { url.hash = ''; - } else if (url.search !== '') { + } else if (url.search.length > 0) { url.search = ''; } else { const basenamePattern = /\/[^/]+$/; |