forked from mozilla/multi-account-containers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP - Auto send users to origins they have set to go to. Fixes mozill…
- Loading branch information
1 parent
9d5223c
commit 4bb53ef
Showing
6 changed files
with
173 additions
and
2 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
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,30 @@ | ||
<html> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | ||
<title>Containers confirm navigation</title> | ||
<link rel="stylesheet" href="/css/confirm-page.css"> | ||
</head> | ||
<body> | ||
<main> | ||
<h1>Hey, we heard you liked containers!</h1> | ||
<form id="redirect-form"> | ||
<p> | ||
A page told us to open: | ||
</p> | ||
<div id="redirect-url"></div> | ||
<p> | ||
You asked for <span id="redirect-origin"></span> to always open in <span id="container-name">this</span> container, are you sure you want to confirm?<br /> | ||
</p> | ||
<p>If you didn't mean to open this link or it looks suspicious don't click it.</p> | ||
<br /> | ||
<p> | ||
<label>Never ask me this again? <input id="never-ask" type="checkbox" /></label> | ||
<br /> | ||
<button id="confirm" class="button primary">Take me there</button> | ||
</p> | ||
</form> | ||
</main> | ||
|
||
<script src="js/confirm-page.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,31 @@ | ||
/* General Rules and Resets */ | ||
body { | ||
background: url(/img/onboarding-1.png) top right no-repeat; | ||
inline-size: 600px; | ||
} | ||
|
||
html { | ||
box-sizing: border-box; | ||
font: message-box; | ||
} | ||
|
||
#redirect-url, | ||
#redirect-origin { | ||
font-weight: bold; | ||
} | ||
|
||
#confirm { | ||
float: right; | ||
} | ||
|
||
.button.primary { | ||
background-color: #0996f8; | ||
block-size: 54px; | ||
border: none; | ||
color: white; | ||
text-align: center; | ||
} | ||
|
||
.button.primary:hover { | ||
background-color: #0675d3; | ||
} |
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,25 @@ | ||
const redirectUrl = new URL(window.location).searchParams.get("url"); | ||
document.getElementById("redirect-url").textContent = redirectUrl; | ||
const redirectOrigin = new URL(redirectUrl).origin; | ||
document.getElementById("redirect-origin").textContent = redirectOrigin; | ||
|
||
document.getElementById("redirect-form").addEventListener("submit", (e) => { | ||
e.preventDefault(); | ||
const neverAsk = document.getElementById("never-ask").checked; | ||
// Sending neverAsk message to background to store for next time we see this process | ||
if (neverAsk) { | ||
browser.runtime.sendMessage({ | ||
neverAsk: true | ||
}).then(() => { | ||
redirect(); | ||
}).catch(() => { | ||
// Can't really do much here user will have to click it again | ||
}); | ||
} | ||
redirect(); | ||
}); | ||
|
||
function redirect() { | ||
const redirectUrl = document.getElementById("redirect-url").textContent; | ||
document.location.replace(redirectUrl); | ||
} |
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