Add TAB_LAST operation

jh-changes
Daniel Campoverde 7 years ago
parent d0df1a05a1
commit ef98e196ab
  1. 2
      src/background/actions/operation.js
  2. 15
      src/background/tabs.js
  3. 3
      src/shared/default-settings.js
  4. 1
      src/shared/operations.js

@ -22,6 +22,8 @@ const exec = (operation, tab) => {
return tabs.selectNextTab(tab.index, operation.count); return tabs.selectNextTab(tab.index, operation.count);
case operations.TAB_FIRST: case operations.TAB_FIRST:
return tabs.selectFirstTab(); return tabs.selectFirstTab();
case operations.TAB_LAST:
return tabs.selectLastTab();
case operations.TAB_RELOAD: case operations.TAB_RELOAD:
return tabs.reload(tab, operation.cache); return tabs.reload(tab, operation.cache);
case operations.ZOOM_IN: case operations.ZOOM_IN:

@ -86,13 +86,12 @@ const selectFirstTab = () => {
}); });
}; };
// const selectLastTab = (current, count) => { const selectLastTab = () => {
// return browser.tabs.query({ currentWindow: true }).then((tabs) => { return browser.tabs.query({ currentWindow: true }).then((tabs) => {
// let select = tabs.length; let id = tabs[tabs.length - 1].id;
// let id = tabs[select].id; return browser.tabs.update(id, { active: true });
// return browser.tabs.update(id, { active: true }); });
// }); };
// };
const reload = (current, cache) => { const reload = (current, cache) => {
return browser.tabs.reload( return browser.tabs.reload(
@ -103,5 +102,5 @@ const reload = (current, cache) => {
export { export {
closeTab, reopenTab, selectAt, selectByKeyword, getCompletions, closeTab, reopenTab, selectAt, selectByKeyword, getCompletions,
selectPrevTab, selectNextTab, selectFirstTab, reload selectPrevTab, selectNextTab, selectFirstTab, selectLastTab, reload
}; };

@ -28,7 +28,8 @@ export default {
"u": { "type": "tabs.reopen" }, "u": { "type": "tabs.reopen" },
"K": { "type": "tabs.prev", "count": 1 }, "K": { "type": "tabs.prev", "count": 1 },
"J": { "type": "tabs.next", "count": 1 }, "J": { "type": "tabs.next", "count": 1 },
"g0": { "type": "tabs.first"}, "g0": { "type": "tabs.first" },
"g$": { "type": "tabs.last" },
"r": { "type": "tabs.reload", "cache": false }, "r": { "type": "tabs.reload", "cache": false },
"R": { "type": "tabs.reload", "cache": true }, "R": { "type": "tabs.reload", "cache": true },
"zi": { "type": "zoom.in" }, "zi": { "type": "zoom.in" },

@ -37,6 +37,7 @@ export default {
TAB_PREV: 'tabs.prev', TAB_PREV: 'tabs.prev',
TAB_NEXT: 'tabs.next', TAB_NEXT: 'tabs.next',
TAB_FIRST: 'tabs.first', TAB_FIRST: 'tabs.first',
TAB_LAST: 'tabs.last',
TAB_RELOAD: 'tabs.reload', TAB_RELOAD: 'tabs.reload',
// Zooms // Zooms