aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-05-24 21:51:18 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-05-24 21:51:18 +0900
commit8d0739463d970deae2ebdd88eedac29e9c4379ff (patch)
tree72cda1df081e5d094c39cab5444855cf09669b0d /src/content
parente779fb1779f33fb15857b5d20cb72a4b00d20f77 (diff)
Move open parent and open root to background
Diffstat (limited to 'src/content')
-rw-r--r--src/content/controllers/KeymapController.ts8
-rw-r--r--src/content/presenters/NavigationPresenter.ts27
-rw-r--r--src/content/usecases/NavigateUseCase.ts8
3 files changed, 0 insertions, 43 deletions
diff --git a/src/content/controllers/KeymapController.ts b/src/content/controllers/KeymapController.ts
index 4be8f9d..4eb6955 100644
--- a/src/content/controllers/KeymapController.ts
+++ b/src/content/controllers/KeymapController.ts
@@ -4,7 +4,6 @@ import KeymapUseCase from '../usecases/KeymapUseCase';
import AddonEnabledUseCase from '../usecases/AddonEnabledUseCase';
import FindSlaveUseCase from '../usecases/FindSlaveUseCase';
import ScrollUseCase from '../usecases/ScrollUseCase';
-import NavigateUseCase from '../usecases/NavigateUseCase';
import FocusUseCase from '../usecases/FocusUseCase';
import ClipboardUseCase from '../usecases/ClipboardUseCase';
import BackgroundClient from '../client/BackgroundClient';
@@ -19,7 +18,6 @@ export default class KeymapController {
private addonEnabledUseCase: AddonEnabledUseCase,
private findSlaveUseCase: FindSlaveUseCase,
private scrollUseCase: ScrollUseCase,
- private navigateUseCase: NavigateUseCase,
private focusUseCase: FocusUseCase,
private clipbaordUseCase: ClipboardUseCase,
private backgroundClient: BackgroundClient,
@@ -84,12 +82,6 @@ export default class KeymapController {
case operations.MARK_JUMP_PREFIX:
this.markKeyUseCase.enableJumpMode();
break;
- case operations.NAVIGATE_PARENT:
- this.navigateUseCase.openParent();
- break;
- case operations.NAVIGATE_ROOT:
- this.navigateUseCase.openRoot();
- break;
case operations.FOCUS_INPUT:
this.focusUseCase.focusFirstInput();
break;
diff --git a/src/content/presenters/NavigationPresenter.ts b/src/content/presenters/NavigationPresenter.ts
index c141112..11d96ec 100644
--- a/src/content/presenters/NavigationPresenter.ts
+++ b/src/content/presenters/NavigationPresenter.ts
@@ -6,10 +6,6 @@ export default interface NavigationPresenter {
openLinkPrev(): void;
openLinkNext(): void;
-
- openParent(): void;
-
- openRoot(): void;
}
const REL_PATTERN: {[key: string]: RegExp} = {
@@ -51,29 +47,6 @@ export class NavigationPresenterImpl implements NavigationPresenter {
this.linkRel('next');
}
- openParent(): void {
- const loc = window.location;
- if (loc.hash !== '') {
- loc.hash = '';
- return;
- } else if (loc.search !== '') {
- loc.search = '';
- return;
- }
-
- const basenamePattern = /\/[^/]+$/;
- const lastDirPattern = /\/[^/]+\/$/;
- if (basenamePattern.test(loc.pathname)) {
- loc.pathname = loc.pathname.replace(basenamePattern, '/');
- } else if (lastDirPattern.test(loc.pathname)) {
- loc.pathname = loc.pathname.replace(lastDirPattern, '/');
- }
- }
-
- openRoot(): void {
- window.location.href = window.location.origin;
- }
-
// Code common to linkPrev and linkNext which navigates to the specified page.
private linkRel(rel: 'prev' | 'next'): void {
let link = selectLast<HTMLLinkElement>(`link[rel~=${rel}][href]`);
diff --git a/src/content/usecases/NavigateUseCase.ts b/src/content/usecases/NavigateUseCase.ts
index 4711c5e..7adccfd 100644
--- a/src/content/usecases/NavigateUseCase.ts
+++ b/src/content/usecases/NavigateUseCase.ts
@@ -24,12 +24,4 @@ export default class NavigateUseCase {
openLinkNext(): void {
this.navigationPresenter.openLinkNext();
}
-
- openParent(): void {
- this.navigationPresenter.openParent();
- }
-
- openRoot(): void {
- this.navigationPresenter.openRoot();
- }
}