Skip to content

Commit 9bd4bfa

Browse files
committed
auto send indication in the button's tooltip
1 parent 4e98cec commit 9bd4bfa

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

buttons.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
Functions:
1010
- createCustomSendButton: Creates a custom send button based on provided configuration.
1111
- determineShortcutKeyForButtonIndex: Assigns a shortcut key to a button based on its index.
12+
1213
After that, tje
1314
1415
Usage:
@@ -22,9 +23,10 @@
2223
buttons-clicking-copilot.js - ... for Copilot
2324
buttons-clicking-claude.js - ... Claude
2425
25-
26-
Instructions for AI: do not remove comments! MUST NOT REMOVE COMMENTS. This one too! */
26+
Instructions for AI: do not remove comments! MUST NOT REMOVE COMMENTS. This one too!
27+
*/
2728
'use strict';
29+
2830
/**
2931
* Namespace object containing functions related to creating and managing custom buttons.
3032
*/
@@ -50,8 +52,12 @@ window.MaxExtensionButtons = {
5052
}
5153
}
5254

55+
// Prepare tooltip parts: append (Auto-sends) if autoSend behavior is enabled
56+
const autoSendDescription = buttonConfig.autoSend ? ' (Auto-sends)' : '';
5357
const shortcutDescription = assignedShortcutKey !== null ? ` (Shortcut: Alt+${assignedShortcutKey})` : '';
54-
customButtonElement.setAttribute('title', `${buttonConfig.text}${shortcutDescription}`);
58+
59+
// Set the tooltip (title attribute) combining the button text with auto-send and shortcut info
60+
customButtonElement.setAttribute('title', `${buttonConfig.text}${autoSendDescription}${shortcutDescription}`);
5561

5662
customButtonElement.style.cssText = `
5763
background-color: transparent;
@@ -103,7 +109,6 @@ function processCustomSendButtonClick(event, customText, autoSend) {
103109
event.preventDefault();
104110
logConCgp('[buttons] Custom send button clicked');
105111

106-
107112
// Invert autoSend if Shift key is pressed during the click
108113
if (event.shiftKey) {
109114
autoSend = !autoSend;
@@ -114,7 +119,7 @@ function processCustomSendButtonClick(event, customText, autoSend) {
114119
logConCgp('[buttons] Active site:', activeSite);
115120

116121
// Handle different sites
117-
// In processCustomSendButtonClick function
122+
// In processCustomSendButtonClick function
118123
switch (activeSite) {
119124
case 'ChatGPT':
120125
processChatGPTCustomSendButtonClick(event, customText, autoSend);
@@ -131,14 +136,12 @@ function processCustomSendButtonClick(event, customText, autoSend) {
131136
case 'AIStudio':
132137
processAIStudioCustomSendButtonClick(event, customText, autoSend);
133138
break;
134-
case 'AIStudio':
135-
processAIStudioCustomSendButtonClick(event, customText, autoSend);
136-
break;
137-
default:
138-
logConCgp('[buttons] Unsupported site:', activeSite);
139-
}
139+
case 'AIStudio':
140+
processAIStudioCustomSendButtonClick(event, customText, autoSend);
141+
break;
142+
default:
143+
logConCgp('[buttons] Unsupported site:', activeSite);
144+
}
140145
}
141146

142-
143-
144147
// #endregion

0 commit comments

Comments
 (0)