Created
December 28, 2017 05:38
-
-
Save gobenji/6257cf384bf2f13f039f528453078663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/content/actions/operation.js b/src/content/actions/operation.js | |
index 767f14b..d655170 100644 | |
--- a/src/content/actions/operation.js | |
+++ b/src/content/actions/operation.js | |
@@ -54,6 +54,10 @@ const exec = (operation) => { | |
return navigates.parent(window); | |
case operations.NAVIGATE_ROOT: | |
return navigates.root(window); | |
+ case operations.NAVIGATE_URL: | |
+ return navigates.url(window, operation.url); | |
+ case operations.NAVIGATE_URL_TAB: | |
+ return navigates.urlTab(window, operation.url); | |
case operations.URLS_YANK: | |
urls.yank(window); | |
return consoleFrames.postMessage(window.document, { | |
diff --git a/src/content/navigates.js b/src/content/navigates.js | |
index c9baa30..085b7ef 100644 | |
--- a/src/content/navigates.js | |
+++ b/src/content/navigates.js | |
@@ -75,4 +75,14 @@ const root = (win) => { | |
win.location = win.location.origin; | |
}; | |
-export { historyPrev, historyNext, linkPrev, linkNext, parent, root }; | |
+const url = (win, url) => { | |
+ win.location = url; | |
+}; | |
+ | |
+const urlTab = (win, url) => { | |
+ console.log("in tab"); | |
+ browser.tabs.create({ url: url }); | |
+ console.log("done"); | |
+}; | |
+ | |
+export { historyPrev, historyNext, linkPrev, linkNext, parent, root, url, urlTab }; | |
diff --git a/src/shared/operations.js b/src/shared/operations.js | |
index 4c221ba..22a187b 100644 | |
--- a/src/shared/operations.js | |
+++ b/src/shared/operations.js | |
@@ -30,6 +30,8 @@ export default { | |
NAVIGATE_LINK_NEXT: 'navigate.link.next', | |
NAVIGATE_PARENT: 'navigate.parent', | |
NAVIGATE_ROOT: 'navigate.root', | |
+ NAVIGATE_URL: 'navigate.url', | |
+ NAVIGATE_URL_TAB: 'navigate.urlTab', | |
// Tabs | |
TAB_CLOSE: 'tabs.close', | |
diff --git a/src/shared/settings/default.js b/src/shared/settings/default.js | |
index d187565..9e8b3e5 100644 | |
--- a/src/shared/settings/default.js | |
+++ b/src/shared/settings/default.js | |
@@ -24,8 +24,8 @@ export default { | |
"$": { "type": "scroll.end" }, | |
"d": { "type": "tabs.close" }, | |
"u": { "type": "tabs.reopen" }, | |
- "K": { "type": "tabs.prev", "count": 1 }, | |
- "J": { "type": "tabs.next", "count": 1 }, | |
+ "gT": { "type": "tabs.prev", "count": 1 }, | |
+ "gt": { "type": "tabs.next", "count": 1 }, | |
"g0": { "type": "tabs.first" }, | |
"g$": { "type": "tabs.last" }, | |
"r": { "type": "tabs.reload", "cache": false }, | |
@@ -43,6 +43,8 @@ export default { | |
"]]": { "type": "navigate.link.next" }, | |
"gu": { "type": "navigate.parent" }, | |
"gU": { "type": "navigate.root" }, | |
+ "gh": { "type": "navigate.url", "url": "https://www.google.com/ncr" }, | |
+ "gH": { "type": "navigate.urlTab", "url": "https://www.google.com/ncr" }, | |
"y": { "type": "urls.yank" }, | |
"/": { "type": "find.start" }, | |
"n": { "type": "find.next" }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment