-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
chrome.runtime.onInstalled.addListener(function() { | ||
console.log('Tab Organizer Extension Installed'); | ||
}); | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "Tab Organizer", | ||
"version": "1.0", | ||
"description": "Organize your tabs into groups.", | ||
"permissions": [ | ||
"tabs" | ||
], | ||
"action": { | ||
"default_popup": "popup.html", | ||
"default_icon": { | ||
"16": "icons/icon16.png", | ||
"48": "icons/icon48.png", | ||
"128": "icons/icon128.png" | ||
} | ||
}, | ||
"background": { | ||
"service_worker": "background.js" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
width: 300px; | ||
padding: 10px; | ||
} | ||
|
||
#container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
#groups { | ||
width: 100%; | ||
margin-bottom: 10px; | ||
} | ||
|
||
.group { | ||
background: #f1f1f1; | ||
border: 1px solid #ccc; | ||
padding: 5px; | ||
margin: 5px 0; | ||
} | ||
|
||
button { | ||
padding: 5px 10px; | ||
cursor: pointer; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="popup.css"> | ||
</head> | ||
<body> | ||
<div id="container"> | ||
<h1>Tab Organizer</h1> | ||
<div id="groups"> | ||
<!-- Groups will be displayed here --> | ||
</div> | ||
<button id="createGroup">Create New Group</button> | ||
</div> | ||
<script src="popup.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
const createGroupButton = document.getElementById('createGroup'); | ||
|
||
createGroupButton.addEventListener('click', function() { | ||
chrome.tabs.query({ currentWindow: true }, function(tabs) { | ||
const groupId = Date.now().toString(); // Unique ID for the group | ||
tabs.forEach(tab => { | ||
chrome.tabs.group({ tabIds: tab.id, groupId: parseInt(groupId) }, function(groupId) { | ||
console.log(`Tab ${tab.id} added to group ${groupId}`); | ||
}); | ||
}); | ||
renderGroups(); | ||
}); | ||
}); | ||
|
||
function renderGroups() { | ||
chrome.tabGroups.query({ windowId: chrome.windows.WINDOW_ID_CURRENT }, function(groups) { | ||
const groupsContainer = document.getElementById('groups'); | ||
groupsContainer.innerHTML = ''; // Clear previous groups | ||
|
||
groups.forEach(group => { | ||
const groupElement = document.createElement('div'); | ||
groupElement.className = 'group'; | ||
groupElement.innerText = `Group ${group.id}`; | ||
groupsContainer.appendChild(groupElement); | ||
}); | ||
}); | ||
} | ||
|
||
renderGroups(); // Initial render of groups | ||
}); | ||
|