aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoremlow <dev@emlow.com>2018-04-01 16:16:29 +0100
committeremlow <dev@emlow.com>2018-04-01 16:16:29 +0100
commit21c28e668ef6fa6ca384f5bc67bcba1f22f26d57 (patch)
tree2d1516bd1e2cdc3f06031ca1853f72178d174124 /src
parent8dcb8f8c2212ac9b3b9d6fff02b47648f2a08fe5 (diff)
shortcut to view page source
Diffstat (limited to 'src')
-rw-r--r--src/background/actions/operation.js5
-rw-r--r--src/shared/operations.js3
-rw-r--r--src/shared/settings/default.js1
3 files changed, 9 insertions, 0 deletions
diff --git a/src/background/actions/operation.js b/src/background/actions/operation.js
index 56eb168..c477ce7 100644
--- a/src/background/actions/operation.js
+++ b/src/background/actions/operation.js
@@ -77,6 +77,11 @@ const exec = (operation, tab) => {
return browser.tabs.sendMessage(tab.id, {
type: messages.CONSOLE_HIDE,
});
+ case operations.PAGE_SOURCE:
+ return browser.tabs.create({
+ url: 'view-source:' + tab.url,
+ index: tab.index + 1
+ });
default:
return Promise.resolve();
}
diff --git a/src/shared/operations.js b/src/shared/operations.js
index a2f980f..e8cc8cf 100644
--- a/src/shared/operations.js
+++ b/src/shared/operations.js
@@ -37,6 +37,9 @@ export default {
// Focus
FOCUS_INPUT: 'focus.input',
+ // Page
+ PAGE_SOURCE: 'page.source',
+
// Tabs
TAB_CLOSE: 'tabs.close',
TAB_CLOSE_FORCE: 'tabs.close.force',
diff --git a/src/shared/settings/default.js b/src/shared/settings/default.js
index 3c4dcac..f82db5a 100644
--- a/src/shared/settings/default.js
+++ b/src/shared/settings/default.js
@@ -46,6 +46,7 @@ export default {
"gu": { "type": "navigate.parent" },
"gU": { "type": "navigate.root" },
"gi": { "type": "focus.input" },
+ "gf": { "type": "page.source" },
"y": { "type": "urls.yank" },
"p": { "type": "urls.paste", "newTab": false },
"P": { "type": "urls.paste", "newTab": true },