You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: code-notes.md
+34-5Lines changed: 34 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,6 @@
2
2
3
3
This document provides a high-level overview of the OneClickPrompts Chrome Extension codebase. It describes the purpose of each file and its role within the extension. Extension was previously called "ChatGPT Quick Buttons for your text".
4
4
5
-
6
5
## Core Functionality
7
6
8
7
The OneClickPrompts extension enhances AI chat platforms like ChatGPT, Claude, Copilot, DeepSeek, AI Studio, and Grok by adding customizable buttons that inject pre-defined prompts into the chat input area. It also includes features for managing profiles, enabling keyboard shortcuts, and customizing the user interface.
@@ -16,8 +15,22 @@ The OneClickPrompts extension enhances AI chat platforms like ChatGPT, Claude, C
16
15
17
16
### `config.js`
18
17
19
-
***Purpose:** Service worker responsible for managing the extension's configuration data using Chrome's storage API.
20
-
***Role:** Handles loading, saving, switching, creating, deleting, and listing profiles. Also manages settings like dark theme and floating panel state. This file is the central source of truth for all configurable extension settings.
18
+
***Purpose:** Service worker script that manages extension configuration and settings.
19
+
***Role:** Handles message passing between content scripts, popup pages, and storage. Key responsibilities:
20
+
* Acts as a central hub for configuration management
21
+
* Stores and retrieves button configurations in Chrome storage
22
+
* Manages profiles (saving, loading, deleting)
23
+
* Handles custom selector configurations
24
+
* Manages floating panel settings across different websites
25
+
* Provides unified storage for all extension settings
26
+
* Implements reset functionality for various setting types
27
+
***Message Handlers:**
28
+
* Processes messages from content scripts and popup pages
29
+
* Handles floating panel settings with message types:
30
+
* 'getFloatingPanelSettings': Retrieves settings for a specific website
31
+
* 'saveFloatingPanelSettings': Saves settings for a specific website
32
+
* 'resetFloatingPanelSettings': Removes all floating panel settings
33
+
* Stores floating panel settings with the prefix 'floating_panel_' followed by the website hostname
21
34
22
35
### `default-config.json`
23
36
@@ -43,11 +56,15 @@ The OneClickPrompts extension enhances AI chat platforms like ChatGPT, Claude, C
43
56
***Role:** Creates a draggable, resizable panel that can be toggled as an alternative to the inline injected buttons. Features include:
* Positioning with the panel's bottom-left corner at the cursor location
46
-
* Persistent state and position saved per website using localStorage
59
+
* Persistent state and position saved per website using Chrome's extension storage via the service worker
47
60
* Draggable header and resizable body
48
61
* Toggle button in the original injected button container
49
62
* Closing via an "x" button to return to the injected buttons
50
-
* Debounced saving (150ms delay) for efficient localStorage operations
63
+
* Debounced saving (150ms delay) for efficient storage operations
64
+
***Dependencies:**
65
+
***config.js (Service Worker):** Directly communicates with the service worker using `chrome.runtime.sendMessage` to save and load panel settings per website hostname. Sends messages with types 'getFloatingPanelSettings' and 'saveFloatingPanelSettings'.
66
+
***utils.js:** Uses utility functions for logging.
67
+
***profile-switcher.js:** For managing profile switching within the floating panel.
51
68
52
69
### `init.js`
53
70
@@ -138,6 +155,18 @@ These scripts are responsible for the user interface in the extension's popup wi
138
155
***Purpose:** Handles the advanced selector configuration.
139
156
***Role:** Enables users to customize CSS selectors for different AI chat platforms.
***Purpose:** Handles the resetting of floating panel settings across all websites.
161
+
***Role:** Provides functionality for the "Reset Floating Window Settings" button in the Settings section of the popup interface. Features include:
162
+
* Clearing all floating panel settings from Chrome's extension storage
163
+
* Targeting only settings with the 'floating_panel_' prefix
164
+
* Providing user feedback through console logs and toast notifications
165
+
* Allowing panels to naturally reset to default positions and states on next page load
166
+
***Dependencies:**
167
+
***config.js (Service Worker):** Directly communicates with the service worker using `chrome.runtime.sendMessage` to reset all floating panel settings by sending a message with type 'resetFloatingPanelSettings'. The service worker handles finding and removing all relevant settings from Chrome's storage.
168
+
***popup.js:** Integrated with the popup interface to provide user feedback via toast notifications and console logging.
169
+
141
170
### `popup-page-styles/*`
142
171
143
172
***Purpose:** Contains CSS files for styling the popup page.
0 commit comments