diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/background/actions/operation.js | 4 | ||||
-rw-r--r-- | src/background/tabs.js | 16 | ||||
-rw-r--r-- | src/shared/default-settings.js | 2 | ||||
-rw-r--r-- | src/shared/operations.js | 2 |
4 files changed, 23 insertions, 1 deletions
diff --git a/src/background/actions/operation.js b/src/background/actions/operation.js index b94c117..a5094c0 100644 --- a/src/background/actions/operation.js +++ b/src/background/actions/operation.js @@ -20,6 +20,10 @@ const exec = (operation, tab) => { return tabs.selectPrevTab(tab.index, operation.count); case operations.TAB_NEXT: return tabs.selectNextTab(tab.index, operation.count); + case operations.TAB_FIRST: + return tabs.selectFirstTab(); + case operations.TAB_LAST: + return tabs.selectLastTab(); case operations.TAB_RELOAD: return tabs.reload(tab, operation.cache); case operations.ZOOM_IN: diff --git a/src/background/tabs.js b/src/background/tabs.js index eed3252..020c826 100644 --- a/src/background/tabs.js +++ b/src/background/tabs.js @@ -79,6 +79,20 @@ const selectNextTab = (current, count) => { }); }; +const selectFirstTab = () => { + return browser.tabs.query({ currentWindow: true }).then((tabs) => { + let id = tabs[0].id; + return browser.tabs.update(id, { active: true }); + }); +}; + +const selectLastTab = () => { + return browser.tabs.query({ currentWindow: true }).then((tabs) => { + let id = tabs[tabs.length - 1].id; + return browser.tabs.update(id, { active: true }); + }); +}; + const reload = (current, cache) => { return browser.tabs.reload( current.id, @@ -88,5 +102,5 @@ const reload = (current, cache) => { export { closeTab, reopenTab, selectAt, selectByKeyword, getCompletions, - selectPrevTab, selectNextTab, reload + selectPrevTab, selectNextTab, selectFirstTab, selectLastTab, reload }; diff --git a/src/shared/default-settings.js b/src/shared/default-settings.js index 60e7876..49eee37 100644 --- a/src/shared/default-settings.js +++ b/src/shared/default-settings.js @@ -28,6 +28,8 @@ export default { "u": { "type": "tabs.reopen" }, "K": { "type": "tabs.prev", "count": 1 }, "J": { "type": "tabs.next", "count": 1 }, + "g0": { "type": "tabs.first" }, + "g$": { "type": "tabs.last" }, "r": { "type": "tabs.reload", "cache": false }, "R": { "type": "tabs.reload", "cache": true }, "zi": { "type": "zoom.in" }, diff --git a/src/shared/operations.js b/src/shared/operations.js index d5c2985..1519e90 100644 --- a/src/shared/operations.js +++ b/src/shared/operations.js @@ -36,6 +36,8 @@ export default { TAB_REOPEN: 'tabs.reopen', TAB_PREV: 'tabs.prev', TAB_NEXT: 'tabs.next', + TAB_FIRST: 'tabs.first', + TAB_LAST: 'tabs.last', TAB_RELOAD: 'tabs.reload', // Zooms |