Reorganize http resources and build logic

This commit is contained in:
2022-01-31 23:01:07 -05:00
parent 691f92d90d
commit 5ab9ad02de
17 changed files with 849 additions and 503 deletions

174
bundle/css/common.css Normal file
View File

@@ -0,0 +1,174 @@
html {
height: 100%;
background-color: black;
color: white;
font-family: Verdana, Helvetica, sans-serif;
}
body {
color: white;
font-family: sans-serif;
}
#background-image {
background-image: url("https://cdn.enp.one/img/backgrounds/cl-photo-rt112.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
filter: blur(6px);
-webkit-filter: blur(6px);
position: fixed;
height: 100%;
width: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 0;
}
#background-image .overlay {
background-color: rgba(0, 0, 0, 0.8);
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
}
.fadeout {
-webkit-animation: fadeout 0.25s linear 1;
-webkit-animation-fill-mode: forwards;
animation: fadeout 0.25s linear 1;
animation-fill-mode: forwards;
}
#preloader {
width: 100%;
height: 100%;
display: inline-block;
overflow: hidden;
background-color: black;
z-index: 100;
margin: 0;
position: fixed;
top: 0;
left: 0;
}
.spinner {
width: 140px;
height: 140px;
position: relative;
backface-visibility: hidden;
transform-origin: 0 0;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
background-size: contain;
border-radius: 50%;
}
.spinner div {
position: absolute;
width: 100px;
height: 100px;
border: 20px solid rgba(213, 213, 213, 1);
border-top-color: transparent;
border-radius: 50%;
animation: spinner 1.5s linear infinite;
top: 50%;
left: 50%;
box-sizing: content-box;
}
@-webkit-keyframes fadeout {
0% {opacity: 1;}
100% {opacity: 0;}
}
@keyframes fadeout {
0% {opacity: 1;}
100% {opacity: 0;}
}
@-webkit-keyframes spinner {
0% { transform: translate(-50%,-50%) rotate(0deg); }
100% { transform: translate(-50%,-50%) rotate(360deg); }
}
@keyframes spinner {
0% { transform: translate(-50%,-50%) rotate(0deg); }
100% { transform: translate(-50%,-50%) rotate(360deg); }
}
a {
color: inherit;
text-decoration: none;
transition: all 0.1s ease-in-out;
}
a:hover {
text-decoration: none;
text-shadow: 5px 5px 10px #fff, -5px -5px 10px #fff;
}
ul.buttons {
list-style: none;
padding-left: 0;
margin-top: 1em;
margin-bottom: 1em;
font-size: 1.75em;
}
ul.buttons li {
line-height: 1;
padding: 0.5em;
margin-left: 0.5em;
margin-right: 0.5em;
text-transform: uppercase;
}
.button:hover {
text-shadow:
-3px -3px 5px #fff,
-3px 3px 5px #fff,
3px -3px 5px #fff,
3px 3px 5px #fff,
0px 0px 7px #ff0000;
}
.button.nav:hover {
text-shadow:
0px 0px 7px #000,
-5px -5px 10px #fff,
-5px 5px 10px #fff,
5px -5px 10px #fff,
5px 5px 10px #fff;
-webkit-animation-name: pulse;
-webkit-animation-duration: 5s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-webkit-animation-fill-mode: none;
animation-name: pulse;
animation-duration: 5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-fill-mode: none;
}
.explore:hover { color: #5588e0; }
.youtube:hover { color: #ff0000; }
.instagram:hover { color: #c13584; }
.twitter:hover { color: #1da1f2; }

160
bundle/css/explore.css Normal file
View File

@@ -0,0 +1,160 @@
ul {
list-style: none;
padding: 0;
}
#toggle-description {
position: fixed;
right: 0;
top: 0;
margin: 0.75em;
font-size: 1.5em;
width: 1em;
height: 1em;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.6);
padding: 0.5em;
transition: all 0.25s ease-in-out;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.6), 0 6px 20px 0 rgba(0, 0, 0, 0.6);
z-index: 10;
}
#toggle-description:hover {
cursor: pointer;
box-shadow: 4px 4px 8px 0 rgba(255, 255, 255, 0.3), -4px -4px 8px 0 rgba(255, 255, 255, 0.3);
}
#toggle-description:hover, #toggle-description.active {
background-color: rgba(255, 255, 255, 0.8);
color: black;
}
#header {
font-variant: small-caps;
text-shadow: 3px 3px 5px #000;
text-align: left;
margin-bottom: 2em;
margin-top: 1em;
}
#header h1 {
border-bottom-style: solid;
padding-bottom: 1em;
margin-left: auto;
margin-right: auto;
width: 75%;
}
#header p {
margin-left: auto;
margin-right: auto;
width: 75%;
}
#header span {
float: right;
text-align: right;
font-size: 0.75em;
}
#header span a {
margin-left: 1em;
}
#content {
text-align: center;
max-width: 90%;
left: 50%;
width: 65em;
transform: translate(-50%, 0);
position: absolute;
}
.article {
height: 14em;
margin-bottom: 2em;
border-radius: 7em;
border-style: none;
border-color: rgba(0, 0, 0, 0);
border-width: 5px;
transition: all 0.25s ease-in-out;
color: rgba(0, 0, 0, 0);
text-align: center;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.6), 0 6px 20px 0 rgba(0, 0, 0, 0.6);
}
.article:hover, .primary-text {
color: rgba(255, 255, 255, 1);
}
.article:hover {
box-shadow: 4px 4px 8px 0 rgba(255, 255, 255, 0.3), -4px -4px 8px 0 rgba(255, 255, 255, 0.3);
}
.article-banner {
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
position: relative;
overflow: hidden;
width: 100%;
border-radius: 7em;
outline-style: none;
}
.article-content {
height: 14em;
overflow: hidden;
transition: all 0.25s ease-in-out;
display: block;
padding-left: 4em;
padding-right: 4em;
}
.article-content:hover, .primary-text .article-content {
background-color: rgba(0, 0, 0, 0.7);
text-shadow: 5px 5px 8px #000;
}
.article-content h2 {
text-transform: capitalize;
margin-top: 3em;
margin-bottom: 1.25em;
}
.article-content p {
font-weight: bold;
}
.article-content i {
margin-left: 1em;
margin-right: 0.7em;
}
@media only screen and (max-width: 600px) {
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
p { font-size: 0.9rem; }
#toggle-description { font-size: 1.25rem; }
.article {
border-radius: 3em;
margin-bottom: 1em;
}
.article-banner {
border-radius: 3em;
}
.article-content {
padding-left: 2em;
padding-right: 2em;
}
}

143
bundle/css/home.css Normal file
View File

@@ -0,0 +1,143 @@
#content {
text-align: center;
text-shadow: 3px 3px 5px #000, -3px -3px 5px #000;
font-weight: bold;
color: white;
padding: 1em;
width: 40em;
max-width: 90%;
background-color: rgba(0, 0, 0, 0.4);
border-style: solid;
border-width: 2px;
border-color: rgba(0, 0, 0, 0);
border-radius: 128px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.6), 0 6px 20px 0 rgba(0, 0, 0, 0.6);
position: absolute;
top: 15%;
left: 50%;
transform: translate(-50%, 0);
z-index: 10;
}
#logo {
margin: auto;
margin-top: -5em;
max-width: 60%;
width: 50%;
display: block;
border-style: solid;
border-color: rgba(0, 0, 0, 0.2);
border-radius: 50%;
border-width: 5px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.4), 0 6px 20px 0 rgba(0, 0, 0, 0.4);
}
h1 {
font-variant: small-caps;
font-size: 2.5em;
}
#content p {
margin: 2em;
line-height: 1.5;
}
.button.nav {
padding-top: 0.75em;
padding-bottom: 0.55em;
padding-left: 1.5em;
padding-right: 1.5em;
border-radius: 30px;
transition: all 0.25s ease-in-out;
}
#background-info {
text-align: right;
font-size: 0.85em;
padding: 0.75em;
position: fixed;
bottom: 0;
right: 0;
z-index: 5;
}
footer { font-size: 0.9em; }
footer div { margin-bottom: 0.5em; }
footer a.button i {
padding: 0.5em;
font-size: 1.25em;
}
@keyframes pulse {
0% {
box-shadow:
0px 0px 15px 3px #fff,
0px 0px 15px 3px #88a9fc;
}
10% {
box-shadow:
-10px -10px 15px 3px #fff,
10px 10px 15px 3px #88a9fc;
}
30% {
box-shadow:
-10px 10px 15px 3px #b5f7fc,
10px -10px 15px 3px #fcaa99;
}
45% {
box-shadow:
10px 10px 15px 3px #ecf9a7,
-10px -10px 15px 3px #fcaa99;
}
60% {
box-shadow:
10px -10px 15px 3px #ecf9a7,
-10px 10px 15px 3px #abfcad;
}
75% {
box-shadow:
-10px -10px 15px 3px #b5f7fc,
10px 10px 15px 3px #abfcad;
}
90% {
box-shadow:
-10px 10px 15px 3px #fff,
10px -10px 15px 3px #88a9fc;
}
100% {
box-shadow:
0px 0px 15px 3px #b5f7fc,
0px 0px 15px 3px #88a9fc;
}
}
@media only screen and (max-width: 600px) {
#content {
padding: 0;
padding-bottom: 1em;
border-radius: 32px;
top: 6em;
}
#content p {
margin: 1em;
}
ul.buttons {
margin-top: 1.5em;
margin-bottom: 1.5em;
}
ul.buttons li {
display: block;
margin-top: 1em;
}
}

8
bundle/js/preloader.js Normal file
View File

@@ -0,0 +1,8 @@
window.addEventListener("load", async function() {
document.getElementById("preloader").classList.add("fadeout");
// I don't actually know how promises or async works
// ¯\_(ツ)_/¯
// https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep
await new Promise(r => setTimeout(r, 250))
document.getElementById("preloader").style.display = "none";
});

View File

@@ -0,0 +1,83 @@
const BACKGROUND_IMAGES = [
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-allis.jpg",
description: "Allis Engine #4, Metropolitan Waterworks Museum",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-boston.jpg",
description: "Charles River Basin and Skyline",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-denver.jpg",
description: "Mile-High City Skyline",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-geese.jpg",
description: "Geese and Goslings on the banks of the Charles River",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-hotel.jpg",
description: "Bay Point Hotel, Lake Winnipesaukee",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-lawrencedam.jpg",
description: "Hydroelectric Dam on the St. Lawrence River",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-letchworth.jpg",
description: "The Middle Falls in Letchworth State Park",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-library.jpg",
description: "Robert W. Woodruff Library at Emory University",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-lighthouse.jpg",
description: "Nubble Lighthouse",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-mbta.jpg",
description: "Old vs New MBTA Green Line",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-rockyshore.jpg",
description: "Icy Stormy Shoreline at Brenton Point",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-rt112.jpg",
description: "Northern end of the Route 112 Scenic Byway",
source: ""
},
{
url: "https://cdn.enp.one/img/backgrounds/cl-photo-startrek.jpg",
description: "Enterprise Engineering Systems at the Star Trek Set Museum",
source: ""
}
];
function selectBackground() {
let max = BACKGROUND_IMAGES.length - 1
let min = 0;
index = Math.round(Math.random() * (max - min) + min);
console.log("Loading background #" + index + ": " + BACKGROUND_IMAGES[index].url);
return BACKGROUND_IMAGES[index];
}
window.addEventListener("DOMContentLoaded", function() {
let selected = selectBackground()
document.getElementById(
"background-image"
).style.backgroundImage = "url(" + selected.url + ")";
});

View File

@@ -0,0 +1,23 @@
function togglePrimaryText() {
let items = document.getElementsByClassName("article");
for (index = 0; index < items.length; index++) {
if (items[index].classList.contains("primary-text")) {
items[index].classList.remove("primary-text");
} else {
items[index].classList.add("primary-text");
}
}
let button = document.getElementById("toggle-description");
if (button.classList.contains("active")) {
button.classList.remove("active");
} else {
button.classList.add("active");
}
};
window.addEventListener("load", async function() {
document.getElementById("toggle-description").addEventListener("click", togglePrimaryText);
});