Skip to content

Commit 7fb4125

Browse files
committed
feat: Add Image Gallery with date grouping and carousel viewer
- Create gallery.js with complete image management system - Add Gallery tab to productivity tray with grid layout - Implement context menu 'Save to Chaos Gallery' for images - Add date-based grouping (Today, Yesterday, week days, dates) - Build full-screen carousel viewer with keyboard navigation - Add individual image download with hover button - Implement bulk download by date with staggered downloads - Create enhanced empty state with step-by-step instructions - Add copy URL, delete, and view source actions - Integrate carousel with arrow navigation and ESC to close - Store images in chrome.storage.local with metadata - Add comprehensive CSS styling for gallery components - Update About tab with Gallery feature documentation - Update README with Gallery usage and features
1 parent fa69bf5 commit 7fb4125

5 files changed

Lines changed: 1205 additions & 49 deletions

File tree

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Transform your new tab into a mesmerizing double pendulum physics simulation wit
2222
-**Smart To-Do List** - Priority levels, filters, completion tracking, and quick add
2323
- 🔖 **Bookmarks Manager** - Search and access all your bookmarks instantly
2424
- 🎨 **Custom Widgets** - Create your own HTML/CSS/JS widgets with drag, resize, and minimize
25-
- 🎯 **Context Menu Integration** - Right-click any text or link to add to your to-do list
25+
- 🖼️ **Image Gallery** - Save images from any webpage with right-click context menu
26+
- 🎯 **Context Menu Integration** - Right-click any text, link, or image to save to Chaos Tab
2627
- 💫 **Collapsible Tray** - Slides up from bottom, stays out of the way until needed
2728
- 🌐 **Online Indicator** - Real-time connection status with glowing indicator
2829

@@ -124,6 +125,17 @@ Transform your new tab into a mesmerizing double pendulum physics simulation wit
124125
- Shadow DOM isolation for safe rendering
125126
- All widgets sync across devices
126127

128+
**🖼️ Gallery Tab:**
129+
- Right-click any image on any webpage → "Save to Chaos Gallery"
130+
- Images saved with source URL and page title
131+
- Grid layout with hover actions
132+
- View full-size image in modal
133+
- Copy image URL to clipboard
134+
- Delete individual images
135+
- Clear all images at once
136+
- Stores images locally in browser storage
137+
- Shows when image was saved (relative time)
138+
127139
**🔖 Bookmarks Tab:**
128140
- View all Chrome bookmarks in one place
129141
- Fast search by title or URL
@@ -206,7 +218,7 @@ curl -sL https://unpkg.com/pell@1.0.6/dist/pell.min.js -o pell.min.js
206218
### Building
207219
After downloading external dependencies, create a distribution package:
208220
```bash
209-
zip -r chaos-tab-v1.0.0.zip manifest.json newtab.html newtab.js background.js tray.js notes.js todos.js bookmarks.js widgets.js icons/ external/ -x "*.DS_Store"
221+
zip -r chaos-tab-v1.0.0.zip manifest.json newtab.html newtab.js background.js tray.js notes.js todos.js bookmarks.js widgets.js gallery.js icons/ external/ -x "*.DS_Store"
210222
```
211223

212224
## Privacy

background.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ chrome.runtime.onInstalled.addListener(() => {
1010
title: 'Add Link to To-Do List',
1111
contexts: ['link']
1212
});
13+
14+
chrome.contextMenus.create({
15+
id: 'saveToGallery',
16+
title: 'Save to Chaos Gallery',
17+
contexts: ['image']
18+
});
1319
});
1420

1521
chrome.contextMenus.onClicked.addListener((info, tab) => {
@@ -34,6 +40,8 @@ chrome.contextMenus.onClicked.addListener((info, tab) => {
3440
sourceUrl: info.pageUrl
3541
};
3642
addTodoItem(todoItem);
43+
} else if (info.menuItemId === 'saveToGallery') {
44+
saveImageToGallery(info, tab);
3745
}
3846
});
3947

@@ -44,3 +52,33 @@ function addTodoItem(item) {
4452
chrome.storage.sync.set({ chaosTodos: todos });
4553
});
4654
}
55+
56+
function saveImageToGallery(info, tab) {
57+
const imageData = {
58+
url: info.srcUrl,
59+
srcUrl: info.srcUrl,
60+
pageUrl: info.pageUrl,
61+
pageTitle: tab.title,
62+
timestamp: Date.now()
63+
};
64+
65+
// Send message to the new tab page to add the image
66+
chrome.tabs.query({ url: 'chrome-extension://*/newtab.html' }, (tabs) => {
67+
tabs.forEach(t => {
68+
chrome.tabs.sendMessage(t.id, {
69+
action: 'addToGallery',
70+
imageData: imageData
71+
});
72+
});
73+
});
74+
75+
// Also store it directly in case no tab is open
76+
chrome.storage.local.get(['chaosGallery'], (result) => {
77+
const images = result.chaosGallery || [];
78+
images.unshift({
79+
id: Date.now(),
80+
...imageData
81+
});
82+
chrome.storage.local.set({ chaosGallery: images });
83+
});
84+
}

0 commit comments

Comments
 (0)