Simplify shift close mechanism on the keybaord
This commit is contained in:
parent
529b4be5ce
commit
591011bc1b
21
popup.js
21
popup.js
|
@ -627,26 +627,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
//Close when c is pressed
|
||||
else if (event.keyCode===67){
|
||||
if (tabKeyIndex>=0){
|
||||
//If shift is down, close all except the selected window
|
||||
if (shiftDown){
|
||||
//Get all tabs in the current window
|
||||
var closeTabList = createTabList(mainList, windowKeyIndex, true, windowList);
|
||||
var selectedTab = tabList[tabKeyIndex];
|
||||
closeTabList.forEach(function(tab){
|
||||
if (tab!==selectedTab){
|
||||
tab.querySelector('i.close').click();
|
||||
}
|
||||
});
|
||||
//Set the tab count to 1 to prevent negative numbers
|
||||
setTabCount(selectedTab.parentNode, 1);
|
||||
tabKeyIndex = 0;
|
||||
}
|
||||
else{
|
||||
tabList[tabKeyIndex].querySelector('i.close').click();
|
||||
tabList.splice(tabKeyIndex, 1);
|
||||
//Move the selection after pressing c.
|
||||
//Check to make sure we're not leaving the bounds of the list
|
||||
if (tabKeyIndex-1>0){
|
||||
if (shiftDown){
|
||||
tabKeyIndex = 0;
|
||||
}
|
||||
else if (tabKeyIndex-1>0){
|
||||
tabKeyIndex-=1;
|
||||
}
|
||||
//If we're closing a window with only one tab left, move to the previous list.
|
||||
|
@ -667,7 +655,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
tabList[tabKeyIndex].classList.add('keyHover');
|
||||
}
|
||||
}
|
||||
}
|
||||
//Pin when p is pressed
|
||||
else if(event.keyCode===80){
|
||||
if (tabKeyIndex>=0){
|
||||
|
|
Loading…
Reference in a new issue