Skip to content

Commit

Permalink
feat: add chatgpt shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
acro5piano committed Jun 26, 2023
1 parent 98b7348 commit 4a06f75
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
8 changes: 8 additions & 0 deletions manifest.json
Expand Up @@ -22,6 +22,14 @@
"./sites/app.gather.town/index.js"
]
},
{
"matches": [
"https://chat.openai.com/*"
],
"js": [
"./sites/chat.openai.com/index.js"
]
},
{
"matches": [
"https://github.com/*"
Expand Down
13 changes: 13 additions & 0 deletions sites/chat.openai.com/index.ts
@@ -0,0 +1,13 @@
/**
* Maximize presentation with M-z.
*/
document.addEventListener('keyup', (event) => {
console.log(event)
if (event.key === 'o' && event.altKey) {
for (const elm of document.querySelectorAll('a')) {
if (elm.textContent?.includes('New chat')) {
elm.click()
}
}
}
})
26 changes: 1 addition & 25 deletions sites/meet.google.com/index.ts
@@ -1,32 +1,8 @@
import { click } from '../../util/dom'

/**
* Maximize presentation with M-z.
*/
document.addEventListener('keydown', (event) => {
document.addEventListener('keyup', (event) => {
if (event.key === 'z' && event.altKey) {
document.querySelector('[data-resolution-cap="0"]')?.requestFullscreen()
}
})

/**
* Autojoin meeting.
*/
const observer = new MutationObserver(async (mutations) => {
for (const mutation of mutations) {
if (mutation.target.textContent?.includes('Join now')) {
// All mute.
await click('[aria-label="Turn off microphone (ctrl + d)"]')
await click('[aria-label="Turn off camera (ctrl + e)"]')
;(mutation.target as HTMLButtonElement)?.click()
setTimeout(() => {
observer.disconnect()
}, 3000)
}
}
})
observer.observe(document.body, {
attributes: true,
childList: true,
subtree: true,
})

0 comments on commit 4a06f75

Please sign in to comment.