-
Notifications
You must be signed in to change notification settings - Fork 0
/
contentScript.js
23 lines (21 loc) · 1011 Bytes
/
contentScript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
chrome.runtime.onMessage.addListener(function (request) {
if (request.message === "showSummarizedText") {
console.log("showSummarizedText message received");
// Check if the summarizedTextContainer element already exists
let summarizedTextContainer = document.getElementById(
"summarizedTextContainer"
);
if (!summarizedTextContainer) {
// If it doesn't exist, create it
summarizedTextContainer = document.createElement("div");
summarizedTextContainer.id = "summarizedTextContainer";
summarizedTextContainer.style.width = "100%"; // Change width to 100%
summarizedTextContainer.style.float = "none"; // Remove float
summarizedTextContainer.style.borderTop = "1px solid #000"; // Add a horizontal divider
// Add the element to the body
document.body.appendChild(summarizedTextContainer);
}
// Update the element's text content with the summarized text
summarizedTextContainer.textContent = request.summarizedText;
}
});