Skip to content

Commit 7fa0e83

Browse files
authored
Merge pull request #1108 from driedpampas/main
Add consent dialog to comply with Firefox Addon Guidelines
2 parents 9dde3da + b677c30 commit 7fa0e83

File tree

3 files changed

+261
-144
lines changed

3 files changed

+261
-144
lines changed

src/html/consent.html

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>FastForward</title>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<script src="base.js"></script>
8+
<link rel="stylesheet" href="style.css" />
9+
<style>
10+
.container {
11+
border-radius: 5px;
12+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
13+
padding: 20px;
14+
width: 80%;
15+
max-width: 600px;
16+
margin: 0 auto;
17+
text-align: center;
18+
}
19+
p {
20+
color: #ffffff;
21+
font-size: 28px;
22+
line-height: 1.5;
23+
}
24+
.buttons {
25+
border: none; /* Increase border width for better visibility */
26+
border-image: linear-gradient(
27+
135deg,
28+
var(--ff-aqua) 0%,
29+
var(--ff-blue) 50%,
30+
var(--ff-purple) 100%
31+
) 1;
32+
background-color: transparent;
33+
border: none;
34+
padding: 18px 36px; /* Increase padding for a larger button */
35+
font-size: 24px; /* Use a font size of 24px for better readability */
36+
cursor: pointer;
37+
border-radius: 8px; /* Increase border radius for a softer look */
38+
transition: background-color 0.3s ease;
39+
}
40+
41+
</style>
42+
</head>
43+
<body>
44+
<nav>
45+
<ul>
46+
<div class="logo-wrapper"><img class="logo" src="../icon/branding.png" alt="FastForward"></div>
47+
</ul>
48+
</nav>
49+
<div class="uk-margin-top uk-margin-bottom uk-margin-left uk-margin-right">
50+
<div class="container">
51+
<h2>Thank you for installing FastForward</h2>
52+
<p>
53+
This extension collects the tab url when you choose to add a website to the whitelist.
54+
</p>
55+
<p>
56+
If you consent to this data collection hit "Agree" to continue. Otherwise hit "Refuse" and the extension will be uninstalled.
57+
</p>
58+
<button id="agree" class="buttons">Agree</button>
59+
<button id="refuse" class="buttons">Refuse</button>
60+
</div>
61+
<script src="consent.js"></script>
62+
</body>
63+
</html>

src/html/consent.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Function to save consent status
2+
async function saveConsentStatus(consentStatus) {
3+
return browser.storage.local.set({ consentStatus: consentStatus });
4+
}
5+
6+
// Function to get consent status
7+
async function getConsentStatus() {
8+
return new Promise((resolve) => {
9+
browser.storage.local.get('consentStatus').then((result) => {
10+
resolve(result.consentStatus);
11+
});
12+
});
13+
}
14+
15+
// Event listener for "Agree" button
16+
document.querySelector('#agree').addEventListener('click', async function () {
17+
console.log("Agree button clicked.");
18+
await saveConsentStatus('consent-granted');
19+
window.location.href = 'options.html';
20+
});
21+
22+
// Event listener for "Refuse" button
23+
document.querySelector('#refuse').addEventListener('click', async function () {
24+
console.log("Uninstalling extension.");
25+
browser.management.uninstallSelf();
26+
});

0 commit comments

Comments
 (0)