-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgmail-script.js
27 lines (25 loc) · 1.21 KB
/
gmail-script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
window.onload = () => {
// document.body.appendChild(document.createTextNode("I am ready to loading...."))
// document.body.innerText = "asdadhkask"
window.onhashchange = () => {
if (window.location.hash.startsWith("#inbox/")) {
let spans = document.querySelectorAll("span")
for (let span of spans) {
if (span.innerText === "Reply") {
span.addEventListener("click", () => {
let email = document.querySelector(".adn.ads")
console.log(email.textContent, "textContent");
(async function () {
const gptResponse = await chrome.runtime.sendMessage(email.textContent)
console.log('====================GMIL================');
console.log(gptResponse);
console.log('=====================GMIL===============');
let gmailTextBox = document.querySelector("[role=textbox]")
gmailTextBox.innerText = gptResponse
})()
})
}
}
}
}
}