NavigateUseCase TabPresenter

jh-changes
Shin'ya Ueoka 6 years ago
parent 45a10d93c7
commit 03370301a7
  1. 4
      src/background/presenters/TabPresenter.ts
  2. 4
      src/background/usecases/NavigateUseCase.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()) ||

@ -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 = /\/[^/]+$/;