Skip to content

Commit

Permalink
feat: consent page (firefox only)
Browse files Browse the repository at this point in the history
fix: background.js

Add files via upload
  • Loading branch information
driedpampas committed Sep 19, 2023
1 parent ff66ba3 commit e2145cb
Show file tree
Hide file tree
Showing 3 changed files with 257 additions and 144 deletions.
63 changes: 63 additions & 0 deletions src/html/consent.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<title>FastForward</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="base.js"></script>
<link rel="stylesheet" href="style.css" />
<style>
.container {
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
padding: 20px;
width: 80%;
max-width: 600px;
margin: 0 auto;
text-align: center;
}
p {
color: #ffffff;
font-size: 28px;
line-height: 1.5;
}
.buttons {
border: none; /* Increase border width for better visibility */
border-image: linear-gradient(
135deg,
var(--ff-aqua) 0%,
var(--ff-blue) 50%,
var(--ff-purple) 100%
) 1;
background-color: transparent;
border: none;
padding: 18px 36px; /* Increase padding for a larger button */
font-size: 24px; /* Use a font size of 24px for better readability */
cursor: pointer;
border-radius: 8px; /* Increase border radius for a softer look */
transition: background-color 0.3s ease;
}

</style>
</head>
<body>
<nav>
<ul>
<div class="logo-wrapper"><img class="logo" src="../icon/branding.png" alt="FastForward"></div>
</ul>
</nav>
<div class="uk-margin-top uk-margin-bottom uk-margin-left uk-margin-right">
<div class="container">
<h2>Thank you for installing FastForward</h2>
<p>
This extension collects the tab url when you choose to add a website to the whitelist.
</p>
<p>
If you consent to this data collection hit "Agree" to continue. Otherwise hit "Refuse" and the extension will be uninstalled.
</p>
<button id="agree" class="buttons">Agree</button>
<button id="refuse" class="buttons">Refuse</button>
</div>
<script src="consent.js"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions src/html/consent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Function to save consent status
async function saveConsentStatus(consentStatus) {
return browser.storage.local.set({ consentStatus: consentStatus });
}

// Function to get consent status
async function getConsentStatus() {
return new Promise((resolve) => {
browser.storage.local.get('consentStatus').then((result) => {
resolve(result.consentStatus);
});
});
}

// Event listener for "Agree" button
document.querySelector('#agree').addEventListener('click', async function () {
console.log("Agree button clicked.");
await saveConsentStatus('consent-granted');
window.location.href = 'options.html';
});

// Event listener for "Refuse" button
document.querySelector('#refuse').addEventListener('click', async function () {
console.log("Uninstalling extension.");
browser.management.uninstallSelf();
});
Loading

0 comments on commit e2145cb

Please sign in to comment.