-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent-script.js
More file actions
68 lines (62 loc) · 2.45 KB
/
content-script.js
File metadata and controls
68 lines (62 loc) · 2.45 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
chrome.storage.sync.get(['focusEnabled'], (result) => {
if (result.focusEnabled) {
const blockedSites = [
'x.com',
'facebook.com',
'instagram.com',
'tiktok.com'
];
if (blockedSites.some(site => location.hostname.includes(site))) {
// Show notification
chrome.runtime.sendMessage({
type: "showNotification",
title: "Focus Mode Activated 🔒",
message: `${location.hostname} is blocked during work hours`
});
// Blocked page content
document.body.innerHTML = `
<div class="blocked-page">
<img src="${chrome.runtime.getURL('icons/icon128.png')}"
alt="FocusForge"
class="blocked-logo">
<h1 class="blocked-title">Time to Focus! ⏳</h1>
<p class="blocked-text">${location.hostname} is restricted</p>
<div class="affiliate-grid">
<a href="https://amzn.to/4hJCxyL" class="affiliate-card">
<img src="${chrome.runtime.getURL('icons/amazon-icon.png')}"
alt="Amazon">
<div class="affiliate-content">
<h3>Productivity Essentials</h3>
<p>Curated by FocusForge</p>
</div>
</a>
<a href="https://www.vpncity.com/ref/67a901299ec32756" class="affiliate-card">
<img src="${chrome.runtime.getURL('icons/vpn-icon.png')}"
alt="VPNCity">
<div class="affiliate-content">
<h3>Secure Browsing</h3>
<p>Military-Grade Encryption</p>
</div>
</a>
<a href="https://trip.tp.st/Cj5Hy7Xj" class="affiliate-card">
<img src="${chrome.runtime.getURL('icons/trip-icon.png')}"
alt="Trip.com">
<div class="affiliate-content">
<h3>Travel Deals</h3>
<p>Book flights & hotels</p>
</div>
</a>
<a href="https://searadar.tp.st/GgqkSfG1" class="affiliate-card">
<img src="${chrome.runtime.getURL('icons/searadar-icon.png')}"
alt="Searadar">
<div class="affiliate-content">
<h3>Sea Adventures</h3>
<p>Find cruises & boats</p>
</div>
</a>
</div>
</div>
`;
}
}
});