Skip to content

Commit

Permalink
Merge pull request #3 from amerikan/feat/ignore-using-pinned-tabs-for…
Browse files Browse the repository at this point in the history
…-grouping

feat: ignore using pinned tabs for grouping
  • Loading branch information
amerikan authored Oct 3, 2023
2 parents 67d4dcc + 41ad000 commit 9eddd7a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ async function groupTabsByDomain() {

const domainGroups = {};

tabs.forEach((tab) => {
const url = new URL(tab.url);
const domainKey = url.hostname;

if (domainGroups.hasOwnProperty(domainKey)) {
domainGroups[domainKey].push(tab);
} else {
domainGroups[domainKey] = [tab];
}
});
tabs
.filter((tab) => !tab.pinned)
.forEach((tab) => {
const url = new URL(tab.url);
const domainKey = url.hostname;

if (domainGroups.hasOwnProperty(domainKey)) {
domainGroups[domainKey].push(tab);
} else {
domainGroups[domainKey] = [tab];
}
});

const newTabPositionIds = [];

Expand Down

0 comments on commit 9eddd7a

Please sign in to comment.