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
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".
@@ -87,10 +88,20 @@ The OneClickPrompts extension enhances AI chat platforms like ChatGPT, Claude, C
87
88
88
89
### `floating-panel-ui-queue.js`
89
90
90
-
-**Purpose:** Initializes the interactive elements within the floating panel's queue section.
91
-
-**Role:** This script finds the pre-existing queue elements loaded from `floating-panel.html` and attaches the necessary JavaScript logic and event handlers. It no longer creates the DOM elements itself. Key functions:
91
+
-**Purpose:** Initializes the interactive elements within the floating panel's queue section and handles rendering the queue's visual state.
92
+
-**Role:** This script finds the pre-existing queue elements loaded from `floating-panel.html` and attaches the necessary JavaScript logic and event handlers. It is responsible for all direct DOM manipulation of the queue UI. Key functions:
92
93
-`initializeQueueSection()`: Finds the queue toggle, delay input, and control buttons in the DOM and wires up their functionality.
93
-
-**Dependencies:**`floating-panel.html` (relies on its structure), `interface.js` (uses `createToggle`).
94
+
-`renderQueueDisplay()`: Clears and redraws the list of queued prompt icons.
95
+
-`updateQueueControlsState()`: Manages the enabled/disabled state and icons of the play/pause and reset buttons.
-**Purpose:** Contains the core state management and execution logic for the prompt queue.
101
+
-**Role:** This script is UI-agnostic and manages the `promptQueue` array, the sending process, timers, and state flags (`isQueueRunning`). It provides the backend functionality for the queue feature. Key functions:
102
+
-`addToQueue()`, `removeFromQueue()`, `startQueue()`, `pauseQueue()`, `resetQueue()`: Manage the queue's lifecycle.
103
+
-`processNextQueueItem()`: The core loop that sends a prompt and sets a timer for the next.
@@ -139,7 +150,7 @@ The OneClickPrompts extension enhances AI chat platforms like ChatGPT, Claude, C
139
150
### `buttons.js`
140
151
141
152
-**Purpose:** Manages the creation and functionality of custom send buttons.
142
-
-**Role:** Creates button elements based on configuration, assigns keyboard shortcuts, and handles click events across different supported sites. It decides which site-specific functions are called.
153
+
-**Role:** Creates button elements based on configuration, assigns keyboard shortcuts, and handles click events across different supported sites. It decides which site-specific functions are called. It also contains the logic to divert clicks to the prompt queue when Queue Mode is active in the floating panel.
143
154
144
155
### `buttons-init.js`
145
156
@@ -253,12 +264,14 @@ The extension operates as follows:
253
264
4. The content scripts retrieve the configuration from the service worker and inject the custom buttons into the page.
254
265
5. Users can toggle between inline injected buttons and the floating panel via the toggle button (🔼).
255
266
6. The floating panel's position, size, and visibility state are saved per website and restored when revisiting.
256
-
7. When the user clicks a custom button (either in the inline container or floating panel), the appropriate site-specific function is called to insert the text and trigger the send button.
267
+
7. When the user clicks a custom button:
268
+
- If the floating panel is active and Queue Mode is on, the prompt is added to a queue. The queue sends prompts sequentially with a configurable delay.
269
+
- Otherwise, the appropriate site-specific function is called to insert the text and trigger the send button.
257
270
258
271
## Additional Notes
259
272
260
273
- The extension uses a resilient injection mechanism to ensure that the custom buttons remain active even when the target website dynamically updates its content.
261
274
- The `InjectionTargetsOnWebsite` class in `utils.js` centralizes the CSS selectors for different websites, making it easier to support new platforms.
262
275
- The floating panel provides an alternative UI that can be positioned anywhere on the screen, offering flexibility for different workflows.
263
276
- Button configurations are consistently applied between the inline injection and floating panel modes.
264
-
- The extension uses debounced saving to prevent excessive storage writes when the user is dragging or resizing the floating panel.
277
+
- The extension uses debounced saving to prevent excessive storage writes when the user is dragging or resizing the floating panel.
0 commit comments