-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup.js
21 lines (20 loc) · 1.09 KB
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
document.addEventListener("DOMContentLoaded", function () {
const activateButton = document.getElementById("activateButton");
const statusElement = document.getElementById("status");
activateButton.addEventListener("click", function () {
// Send a message to the content script to activate summarization
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(tabs[0].id, { action: "activateExtension" }, function(response) {
if (chrome.runtime.lastError) {
// Handle error (e.g., content script not loaded)
statusElement.textContent = "Error: Make sure you're on a LinkedIn page.";
} else if (response && response.status === "activated") {
statusElement.textContent = "Summarizer activated! Scroll to see 'Summarize' buttons on long posts.";
activateButton.style.display = "none";
} else {
statusElement.textContent = "Activation failed. Please try again.";
}
});
});
});
});