-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Hello,
Thanks a lot for the great useful chrome app. I would like to have short cut option in the code if it is possible. So far I am using tampermonkey to do it addition to your code maybe you can update your code and would be great it can work with google gemini (aistudio), perpexlity and chatgpt maybe.
Thanks.
Here is the code I am using:
// @name Claude.ai Microphone Toggle
// @namespace http://tampermonkey.net/
// @version 0.7
// @description Toggle Claude.ai microphone with a keyboard shortcut (Ctrl + Alt + S)
// @author science64
// @match https://claude.ai/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function triggerMicrophoneButton() {
const micButton = document.querySelector('.claudet-mic-button[id="mic-button"]');
if (micButton) {
micButton.click();
// Check for activation (modify the attribute/class/style check as needed)
if (!micButton.hasAttribute('activated')) {
const events = ['mousedown', 'mouseup', 'click'];
events.forEach(eventType => {
const event = new MouseEvent(eventType, {
view: window,
bubbles: true,
cancelable: true
});
micButton.dispatchEvent(event);
});
}
}
}
function waitForElement(selector, callback) {
const element = document.querySelector(selector);
if (element) {
callback(element);
} else {
setTimeout(() => {
waitForElement(selector, callback);
}, 500);
}
}
window.addEventListener('keydown', function(event) {
if (event.ctrlKey && event.altKey && event.key === 's') {
event.preventDefault();
waitForElement('.claudet-mic-button[id="mic-button"]', (btn) => {
triggerMicrophoneButton();
});
}
});
})();```
Metadata
Metadata
Assignees
Labels
No labels