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
7de6ef5
commit b02be0b
Showing
7 changed files
with
327 additions
and
4 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
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-site"></span> to always open in <span id="container-name">this</span> container.<br /> | ||
</p> | ||
<br /> | ||
<br /> | ||
<input id="never-ask" type="checkbox" /><label for="never-ask">Never ask me this again for this site</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-position: -10px -15px; | ||
background-size: 285px; | ||
margin-inline-start: -285px; | ||
padding-inline-start: 285px; | ||
} | ||
|
||
@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,26 @@ | ||
const redirectUrl = new URL(window.location).searchParams.get("url"); | ||
document.getElementById("redirect-url").textContent = redirectUrl; | ||
const redirectSite = new URL(redirectUrl).hostname; | ||
document.getElementById("redirect-site").textContent = redirectSite; | ||
|
||
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, | ||
pageUrl: redirectUrl | ||
}).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