Add TAB_LAST operation

This commit is contained in:
Daniel Campoverde 2017-10-29 22:26:08 -05:00
parent d0df1a05a1
commit ef98e196ab
4 changed files with 12 additions and 9 deletions

View file

@ -22,6 +22,8 @@ const exec = (operation, tab) => {
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:

View file

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

View file

@ -29,6 +29,7 @@ export default {
"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" },

View file

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