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 c2d78c7
Showing
6 changed files
with
184 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,33 @@ | ||
<html> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | ||
<title>Containers confirm navigation</title> | ||
<link xmlns="http://www.w3.org/1999/xhtml" rel="stylesheet" href="chrome://browser/skin/aboutNetError.css" type="text/css" media="all" /> | ||
<link rel="stylesheet" href="/css/confirm-page.css" /> | ||
</head> | ||
<body> | ||
<main> | ||
<div class="title"> | ||
<h1 class="title-text">Hey, we heard you liked containers!</h1> | ||
</div> | ||
<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 open it.</p> | ||
<br /> | ||
<label><input id="never-ask" type="checkbox" /> Never ask me this again</label> | ||
<br /> | ||
<div class="button-container"> | ||
<button id="confirm" class="button primary">Take me there</button> | ||
</div> | ||
</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,33 @@ | ||
/* General Rules and Resets */ | ||
.title { | ||
background-image: none; | ||
} | ||
|
||
main { | ||
background: url(/img/onboarding-1.png) no-repeat; | ||
background-size: 285px; | ||
margin-inline-start: -285px; | ||
padding-inline-start: 285px; | ||
background-position: -10px -15px; | ||
} | ||
|
||
@media only screen and (max-width: 1300px) { | ||
main { | ||
background: none; | ||
} | ||
|
||
/* for a mid sized window we have enough for this but not our image */ | ||
.title { | ||
background-image: url("chrome://global/skin/icons/info.svg"); | ||
} | ||
} | ||
|
||
html { | ||
box-sizing: border-box; | ||
font: message-box; | ||
} | ||
|
||
#redirect-url, | ||
#redirect-origin { | ||
font-weight: bold; | ||
} |
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