Merge pull request #368 from emlow/issue-279
Add shortcut to view page source
This commit is contained in:
		
						commit
						828ac8cd84
					
				
					 5 changed files with 12 additions and 0 deletions
				
			
		|  | @ -49,6 +49,7 @@ The default mappings are as follows: | |||
| - <kbd>/</kbd>: start to find a keyword in the page | ||||
| - <kbd>n</kbd>: find next keyword in the page | ||||
| - <kbd>N</kbd>: find prev keyword in the page | ||||
| - <kbd>g</kbd><kbd>f</kbd>: view page source | ||||
| 
 | ||||
| ### Console commands | ||||
| 
 | ||||
|  |  | |||
|  | @ -77,6 +77,12 @@ 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, | ||||
|       openerTabId: tab.id, | ||||
|     }); | ||||
|   default: | ||||
|     return Promise.resolve(); | ||||
|   } | ||||
|  |  | |||
|  | @ -36,6 +36,7 @@ const KeyMapFields = [ | |||
|     ['navigate.link.prev', 'Open previous link'], | ||||
|     ['navigate.parent', 'Go to parent directory'], | ||||
|     ['navigate.root', 'Go to root directory'], | ||||
|     ['page.source', 'Open page source'], | ||||
|     ['focus.input', 'Focus input'], | ||||
|   ], [ | ||||
|     ['find.start', 'Start find mode'], | ||||
|  |  | |||
|  | @ -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', | ||||
|  |  | |||
|  | @ -48,6 +48,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 }, | ||||
|  |  | |||
		Reference in a new issue