Dummy selectPrevSelTab implementation
This commit is contained in:
parent
0b37c2250e
commit
50cc126e08
4 changed files with 20 additions and 2 deletions
|
@ -27,6 +27,8 @@ const exec = (operation, tab) => {
|
||||||
return tabs.selectFirstTab();
|
return tabs.selectFirstTab();
|
||||||
case operations.TAB_LAST:
|
case operations.TAB_LAST:
|
||||||
return tabs.selectLastTab();
|
return tabs.selectLastTab();
|
||||||
|
case operations.TAB_PREV_SEL:
|
||||||
|
return tabs.selectPrevSelTab();
|
||||||
case operations.TAB_RELOAD:
|
case operations.TAB_RELOAD:
|
||||||
return tabs.reload(tab, operation.cache);
|
return tabs.reload(tab, operation.cache);
|
||||||
case operations.TAB_PIN:
|
case operations.TAB_PIN:
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
// var prevSelTab = null;
|
||||||
|
var prevSelTab = 0;
|
||||||
|
|
||||||
const closeTab = (id) => {
|
const closeTab = (id) => {
|
||||||
return browser.tabs.remove(id);
|
return browser.tabs.remove(id);
|
||||||
};
|
};
|
||||||
|
@ -93,6 +96,17 @@ const selectLastTab = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const selectPrevSelTab = () => {
|
||||||
|
if (prevSelTab != null) {
|
||||||
|
return browser.tabs.query({ currentWindow: true }).then((tabs) => {
|
||||||
|
let id = tabs[prevSelTab].id;
|
||||||
|
return browser.tabs.update(id, { active: true });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// some error message
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const reload = (current, cache) => {
|
const reload = (current, cache) => {
|
||||||
return browser.tabs.reload(
|
return browser.tabs.reload(
|
||||||
current.id,
|
current.id,
|
||||||
|
@ -117,6 +131,6 @@ const duplicate = (id) => {
|
||||||
|
|
||||||
export {
|
export {
|
||||||
closeTab, reopenTab, selectAt, selectByKeyword, getCompletions,
|
closeTab, reopenTab, selectAt, selectByKeyword, getCompletions,
|
||||||
selectPrevTab, selectNextTab, selectFirstTab, selectLastTab, reload,
|
selectPrevTab, selectNextTab, selectFirstTab, selectLastTab, selectPrevSelTab,
|
||||||
updateTabPinned, toggleTabPinned, duplicate
|
reload, updateTabPinned, toggleTabPinned, duplicate
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,6 +38,7 @@ export default {
|
||||||
TAB_NEXT: 'tabs.next',
|
TAB_NEXT: 'tabs.next',
|
||||||
TAB_FIRST: 'tabs.first',
|
TAB_FIRST: 'tabs.first',
|
||||||
TAB_LAST: 'tabs.last',
|
TAB_LAST: 'tabs.last',
|
||||||
|
TAB_PREV_SEL: 'tabs.prevsel',
|
||||||
TAB_RELOAD: 'tabs.reload',
|
TAB_RELOAD: 'tabs.reload',
|
||||||
TAB_PIN: 'tabs.pin',
|
TAB_PIN: 'tabs.pin',
|
||||||
TAB_UNPIN: 'tabs.unpin',
|
TAB_UNPIN: 'tabs.unpin',
|
||||||
|
|
|
@ -30,6 +30,7 @@ export default {
|
||||||
"J": { "type": "tabs.next", "count": 1 },
|
"J": { "type": "tabs.next", "count": 1 },
|
||||||
"g0": { "type": "tabs.first" },
|
"g0": { "type": "tabs.first" },
|
||||||
"g$": { "type": "tabs.last" },
|
"g$": { "type": "tabs.last" },
|
||||||
|
"gl": { "type": "tabs.prevsel" },
|
||||||
"r": { "type": "tabs.reload", "cache": false },
|
"r": { "type": "tabs.reload", "cache": false },
|
||||||
"R": { "type": "tabs.reload", "cache": true },
|
"R": { "type": "tabs.reload", "cache": true },
|
||||||
"zp": { "type": "tabs.pin.toggle" },
|
"zp": { "type": "tabs.pin.toggle" },
|
||||||
|
|
Reference in a new issue