Visitors from .tech will see a message on .io

This commit is contained in:
ポール ウェッブ 2018-10-04 11:47:30 -05:00
parent 652139c6a4
commit d175546ad5
3 changed files with 111 additions and 1 deletions

View file

@ -115,3 +115,30 @@ $(document).ready(function() {
// })
// });
});
document.addEventListener("DOMContentLoaded", () => {
if (
document.referrer.includes("http://localhost:8080") ||
document.referrer.includes("https://lbry.tech")
) {
const html = `
<section class="alert" id="tech-greeting">
<div class="inner-wrap">
<p><strong>Welcome to the less-technical side of LBRY!</strong> You've had fun delving into the code, we hope.</p>
<br><br>
<p>Here by accident? Come back to <a href="${document.referrer}">the techno scene</a>.</p>
<button id="close-alert">×</button>
</div>
</section>
`;
document.querySelector("body").insertAdjacentHTML("afterend", html);
document.getElementById("close-alert").onclick = () => {
document.getElementById("tech-greeting").style.display = "none";
};
}
});

82
web/scss/_alert.scss Normal file
View file

@ -0,0 +1,82 @@
.alert {
bottom: 0; left: 0;
background-color: #d2d227;
cursor: default;
font-family: "Raleway", sans-serif;
line-height: 1.33;
padding-top: 3rem;
padding-right: env(safe-area-inset-right);
padding-bottom: 3rem;
padding-left: env(safe-area-inset-left);
position: fixed;
text-align: left;
width: 100%;
z-index: 30;
> div:first-of-type {
position: relative;
}
@media (min-width: 901px) {
font-size: 1rem;
}
@media (max-width: 900px) {
font-size: 0.8rem;
}
p, button {
display: inline-block;
}
p {
padding-right: 1rem;
width: calc(100% - 2.25rem);
}
a {
font-weight: 600;
text-decoration: underline;
}
button {
width: 1.25rem; height: 1.25rem;
top: 0; right: 0;
background-color: #fff;
border: none;
border-radius: 50%;
cursor: pointer;
display: block;
font-size: 1rem;
line-height: 1;
margin-right: 1rem;
margin-left: 1rem;
padding: 0 0 3px 0;
position: absolute;
text-align: center;
}
.inner-wrap {
margin-right: auto;
margin-left: auto;
max-width: 1200px;
@media (min-width: 901px) {
padding-right: 1rem;
padding-left: 1rem;
}
@media (max-width: 900px) {
padding-right: 2rem;
padding-left: 2rem;
}
&::after {
clear: both;
content: "";
display: block;
}
}
}

View file

@ -2,6 +2,7 @@
@import "reset";
@import "grid";
@import "icons";
@import "alert";
@import "notice";
@import "badge";
@import "basic";
@ -18,4 +19,4 @@
@import "quickstart";
@import "social";
@import "home";
@import "slider";
@import "slider";