-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcontent.js
More file actions
23 lines (21 loc) · 743 Bytes
/
Copy pathcontent.js
File metadata and controls
23 lines (21 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function showInPageNotification(message) {
const notificationDiv = document.createElement('div');
notificationDiv.textContent = message;
notificationDiv.style.position = 'fixed';
notificationDiv.style.bottom = '10px';
notificationDiv.style.right = '10px';
notificationDiv.style.backgroundColor = 'rgba(0,0,0,0.7)';
notificationDiv.style.color = 'white';
notificationDiv.style.padding = '10px';
notificationDiv.style.borderRadius = '5px';
document.body.appendChild(notificationDiv);
setTimeout(() => {
notificationDiv.remove();
}, 3000);
}
// Example usage
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.message === 'showNotification') {
showInPageNotification(request.payload);
}
});