diff --git a/README.md b/README.md index f31f1e2..db69683 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ The default mappings are as follows: - /: start to find a keyword in the page - n: find next keyword in the page - N: find prev keyword in the page +- gf: view page source ### Console commands 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 },