Make sure a window isn't selected when C or P is pressed
This commit is contained in:
parent
b2432607fc
commit
03d4fd9a95
46
popup.js
46
popup.js
|
@ -429,32 +429,36 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
}
|
||||
//Close when c is pressed
|
||||
else if (event.keyCode===67){
|
||||
tabList[tabKeyIndex].querySelector('i.close').click();
|
||||
//Move the selection after pressing c.
|
||||
//Check to make sure we're not leaving the bounds of the list
|
||||
if (tabKeyIndex-1>0){
|
||||
tabKeyIndex-=1;
|
||||
}
|
||||
//If we're closing a window with only one tab left, move to the previous list.
|
||||
if (tabList.length===0){
|
||||
//Remove the list from the popup
|
||||
//If we're at the front of the list, we move to the window below it.
|
||||
if (windowKeyIndex===0){
|
||||
tabList = createTabList(mainList, windowKeyIndex);
|
||||
tabKeyIndex=0;
|
||||
if (tabKeyIndex>0){
|
||||
tabList[tabKeyIndex].querySelector('i.close').click();
|
||||
//Move the selection after pressing c.
|
||||
//Check to make sure we're not leaving the bounds of the list
|
||||
if (tabKeyIndex-1>0){
|
||||
tabKeyIndex-=1;
|
||||
}
|
||||
//Otherwise, we move up one.
|
||||
if (windowKeyIndex>0){
|
||||
windowKeyIndex-=1;
|
||||
tabList = createTabList(mainList, windowKeyIndex);
|
||||
tabKeyIndex=tabList.length-1;
|
||||
}
|
||||
//If we're closing a window with only one tab left, move to the previous list.
|
||||
if (tabList.length===0){
|
||||
//Remove the list from the popup
|
||||
//If we're at the front of the list, we move to the window below it.
|
||||
if (windowKeyIndex===0){
|
||||
tabList = createTabList(mainList, windowKeyIndex);
|
||||
tabKeyIndex=0;
|
||||
}
|
||||
//Otherwise, we move up one.
|
||||
if (windowKeyIndex>0){
|
||||
windowKeyIndex-=1;
|
||||
tabList = createTabList(mainList, windowKeyIndex);
|
||||
tabKeyIndex=tabList.length-1;
|
||||
}
|
||||
}
|
||||
tabList[tabKeyIndex].classList.add('keyHover');
|
||||
}
|
||||
tabList[tabKeyIndex].classList.add('keyHover');
|
||||
}
|
||||
//Pin when p is pressed
|
||||
else if(event.keyCode===80){
|
||||
tabList[tabKeyIndex].querySelector('i.pin').click();
|
||||
if (tabKeyIndex>0){
|
||||
tabList[tabKeyIndex].querySelector('i.pin').click();
|
||||
}
|
||||
}
|
||||
//Go to search box when s is pressed.
|
||||
else if (event.keyCode===83){
|
||||
|
|
Loading…
Reference in a new issue