shortcut to view page source

jh-changes
emlow 7 years ago
parent 8dcb8f8c22
commit 21c28e668e
  1. 1
      README.md
  2. 5
      src/background/actions/operation.js
  3. 3
      src/shared/operations.js
  4. 1
      src/shared/settings/default.js

@ -47,6 +47,7 @@ The default mappings are as follows:
- <kbd>/</kbd>: start to find a keyword in the page - <kbd>/</kbd>: start to find a keyword in the page
- <kbd>n</kbd>: find next keyword in the page - <kbd>n</kbd>: find next keyword in the page
- <kbd>N</kbd>: find prev keyword in the page - <kbd>N</kbd>: find prev keyword in the page
- <kbd>g</kbd><kbd>f</kbd>: view page source
### Console commands ### Console commands

@ -77,6 +77,11 @@ const exec = (operation, tab) => {
return browser.tabs.sendMessage(tab.id, { return browser.tabs.sendMessage(tab.id, {
type: messages.CONSOLE_HIDE, type: messages.CONSOLE_HIDE,
}); });
case operations.PAGE_SOURCE:
return browser.tabs.create({
url: 'view-source:' + tab.url,
index: tab.index + 1
});
default: default:
return Promise.resolve(); return Promise.resolve();
} }

@ -37,6 +37,9 @@ export default {
// Focus // Focus
FOCUS_INPUT: 'focus.input', FOCUS_INPUT: 'focus.input',
// Page
PAGE_SOURCE: 'page.source',
// Tabs // Tabs
TAB_CLOSE: 'tabs.close', TAB_CLOSE: 'tabs.close',
TAB_CLOSE_FORCE: 'tabs.close.force', TAB_CLOSE_FORCE: 'tabs.close.force',

@ -46,6 +46,7 @@ export default {
"gu": { "type": "navigate.parent" }, "gu": { "type": "navigate.parent" },
"gU": { "type": "navigate.root" }, "gU": { "type": "navigate.root" },
"gi": { "type": "focus.input" }, "gi": { "type": "focus.input" },
"gf": { "type": "page.source" },
"y": { "type": "urls.yank" }, "y": { "type": "urls.yank" },
"p": { "type": "urls.paste", "newTab": false }, "p": { "type": "urls.paste", "newTab": false },
"P": { "type": "urls.paste", "newTab": true }, "P": { "type": "urls.paste", "newTab": true },