Skip to content

Commit

Permalink
Ignore recently closed tab #14
Browse files Browse the repository at this point in the history
  • Loading branch information
nralbrecht committed Sep 3, 2018
1 parent d9d5bf6 commit 0211a51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions background-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ browser.tabs.onCreated.addListener(function(tab) {
})
.then(function(tabs) {
return browser.tabs.get(tab.id).then(function(tabInfo) {
// check if tab was opened from outside of firefox or is about:newtab
if (tab.url != "about:newtab" || tab.index != tabs.length - 1) {
// don't move these tabs
let newTab = tab.url != "about:newtab"; // new tab
let rightEnd = tab.index != tabs.length - 1; // already at the right
let lastClosed = tab.url == "about:blank" && tab.favIconUrl // undo close tab

if (!lastClosed || !newTab || !rightEnd) {
return browser.tabs.move(tab.id, {
index: -1
});
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"manifest_version": 2,
"name": "Pinned Tab Fix",
"version": "2.2.2",
"version": "2.2.3",

"description": "__MSG_extensionDescription__",
"homepage_url": "https://github.com/nralbrecht/pinned-tab-fix",
Expand Down

0 comments on commit 0211a51

Please sign in to comment.