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
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,6 @@ The OneClickPrompts extension enhances AI chat platforms like ChatGPT, Claude, C
60
60
***Dependencies:**
61
61
***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'.
62
62
***utils.js:** Uses utility functions for logging.
63
-
***profile-switcher.js:** For managing profile switching within the floating panel.
64
63
65
64
### `floating-panel-ui-creation.js`
66
65
@@ -71,6 +70,9 @@ The OneClickPrompts extension enhances AI chat platforms like ChatGPT, Claude, C
71
70
*`makeDraggable()`: Enables drag functionality on an element via a handle
72
71
*`positionPanelAtCursor()`: Positions the panel relative to the mouse cursor
73
72
*`createPanelToggleButton()`: Creates the toggle button for summoning the floating panel
73
+
***Dependencies:**
74
+
***floating-panel.js:** Uses the namespace and properties defined here
75
+
***utils.js:** Uses logging utilities
74
76
75
77
### `floating-panel-ui-interaction.js`
76
78
@@ -81,6 +83,10 @@ The OneClickPrompts extension enhances AI chat platforms like ChatGPT, Claude, C
81
83
*`updatePanelFromSettings()`: Updates the panel's appearance and position
82
84
*`restorePanelState()`: Restores the panel visibility based on saved settings
83
85
*`refreshButtonsInPanel()`: Refreshes the buttons displayed in the panel after a profile switch
86
+
***Dependencies:**
87
+
***floating-panel.js:** Uses the namespace and properties defined here
88
+
***utils.js:** Uses logging utilities
89
+
***floating-panel-ui-creation.js:** Calls methods from here during panel initialization
84
90
85
91
### `floating-panel-settings.js`
86
92
@@ -91,6 +97,11 @@ The OneClickPrompts extension enhances AI chat platforms like ChatGPT, Claude, C
91
97
*`debouncedSavePanelSettings()`: Waits 150ms before saving to reduce storage operations
92
98
*`loadAvailableProfiles()`: Gets list of profiles from the service worker
93
99
*`switchToProfile()`: Changes the current profile and refreshes floating panel content
100
+
***Dependencies:**
101
+
***floating-panel.js:** Uses the namespace and properties defined here
102
+
***floating-panel-ui-creation.js:** Calls the profile switcher creation method
103
+
***floating-panel-ui-interaction.js:** Calls methods to update the UI and refresh buttons
104
+
***config.js (Service Worker):** Communicates with the service worker for settings persistence
94
105
95
106
### Code File Dependencies for Floating Panel:
96
107
@@ -107,6 +118,13 @@ The OneClickPrompts extension enhances AI chat platforms like ChatGPT, Claude, C
107
118
3. Panel is positioned and displayed immediately
108
119
4. Settings are saved asynchronously
109
120
121
+
***Implementation Notes:**
122
+
* The floating panel UI was split into creation and interaction files to better separate concerns
123
+
* Creation methods handle the DOM structure and initial behavior setup
124
+
* Interaction methods manage state transitions and dynamic behavior
125
+
* All methods share the same namespace (`window.MaxExtensionFloatingPanel`) defined in `floating-panel.js`
126
+
* This modular approach makes the code more maintainable while preserving functionality
127
+
110
128
### `init.js`
111
129
112
130
***Purpose:** Main initialization script for the content script.
0 commit comments