Skip to content

Commit

Permalink
Changed directory name
Browse files Browse the repository at this point in the history
  • Loading branch information
Meetjain1 committed Aug 8, 2024
1 parent bc8a02d commit ef5383e
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Tab Organizer/background.js
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');
});

Binary file added Tab Organizer/icons/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tab Organizer/icons/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tab Organizer/icons/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Tab Organizer/manifest.json
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"
}
}

29 changes: 29 additions & 0 deletions Tab Organizer/popup.css
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;
}

16 changes: 16 additions & 0 deletions Tab Organizer/popup.html
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>
32 changes: 32 additions & 0 deletions Tab Organizer/popup.js
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
});

0 comments on commit ef5383e

Please sign in to comment.