This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring userSurvey browser action assets #101
- Loading branch information
1 parent
f99f1d6
commit 63bf991
Showing
6 changed files
with
80 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> | ||
<meta content="utf-8" http-equiv="encoding"> | ||
<style> | ||
/* May need to add font bundling or revisit the font choice for cross-browser compatibility. */ | ||
body { | ||
font-family: sans-serif; | ||
} | ||
|
||
.icon { | ||
max-width: 50px; | ||
max-height: 50px; | ||
float: left; | ||
padding-right: 10px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div style="display: flex; max-width: 280px; padding: 10px;"> | ||
<img id="icon" class="icon" style="display: none;"> | ||
<div id="content" class="paragraph" style="padding-left: 10px; padding-right: 10px;"></div> | ||
</div> | ||
<script src="userSurvey.popupNoPrompt.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(async function() { | ||
// Load the message from storage | ||
const messageStorageKey = "webScience.userSurvey.popupNoPromptMessage"; | ||
const messageResults = await browser.storage.local.get(messageStorageKey); | ||
if(messageResults[messageStorageKey]) { | ||
const contentElement = document.getElementById("content"); | ||
contentElement.textContent = messageResults[messageStorageKey]; | ||
} | ||
|
||
// Load icon URL from storage | ||
const iconUrlStorageKey = "webScience.userSurvey.popupIconUrl"; | ||
const iconUrlResults = await browser.storage.local.get(iconUrlStorageKey); | ||
if(iconUrlResults[iconUrlStorageKey]) { | ||
const iconElement = document.getElementById("icon"); | ||
iconElement.src = iconUrlResults[iconUrlStorageKey]; | ||
iconElement.style.display = "block"; | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(async function() { | ||
// Load the message from storage | ||
const messageStorageKey = "webScience.userSurvey.popupPromptMessage"; | ||
const messageResults = await browser.storage.local.get(messageStorageKey); | ||
if(messageResults[messageStorageKey]) { | ||
const contentElement = document.getElementById("content"); | ||
contentElement.textContent = messageResults[messageStorageKey]; | ||
} | ||
|
||
// Load icon URL from storage | ||
const iconUrlStorageKey = "webScience.userSurvey.popupIconUrl"; | ||
const iconUrlResults = await browser.storage.local.get(iconUrlStorageKey); | ||
if(iconUrlResults[iconUrlStorageKey]) { | ||
const iconElement = document.getElementById("icon"); | ||
iconElement.src = iconUrlResults[iconUrlStorageKey]; | ||
iconElement.style.display = "block"; | ||
} | ||
|
||
// Listen for clicks on the buttons | ||
document.addEventListener("click", async (e) => { | ||
if (e.target.name === "agree") { | ||
await browser.runtime.sendMessage({ type: "webScience.userSurvey.openSurvey" }); | ||
} | ||
else if (e.target.name === "later") { | ||
window.close(); | ||
} | ||
else if (e.target.name === "never") { | ||
await browser.runtime.sendMessage({ type: "webScience.userSurvey.cancelSurvey" }); | ||
window.close(); | ||
} | ||
}); | ||
})(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters