Added a "login" button to the main page.

Included CSS data and smooth transitions to bring up a login form.
* Missing: functions to process the login data.
This commit is contained in:
Isaiah Koontz 2022-11-13 02:17:12 -08:00
parent 88d8e9c30c
commit 89ca299747
5 changed files with 203 additions and 0 deletions

View File

@ -105,6 +105,136 @@ canvas {
filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(82deg) brightness(105%) contrast(105%);
}
.login-form-button {
position: absolute;
top: 1vh;
left: 7vw;
cursor: pointer;
border: none;
width: 1.7vw;
z-index: 999999;
filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(82deg) brightness(105%) contrast(105%);
}
/* The Login Modal CSS */
/* Full-width input fields */
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
/* Set a style for all buttons */
button {
background-color: #04AA6D;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
button:hover {
opacity: 0.8;
}
/* Extra styles for the cancel button */
.cancelbtn {
width: auto;
padding: 10px 18px;
background-color: #f44336;
}
/* Center the image and position the close button */
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
position: relative;
}
img.avatar {
width: 40%;
}
.container {
padding: 16px;
}
span.psw {
float: right;
padding-top: 16px;
}
/* The Login Modal (background) */
.modal {
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
padding-top: 10px;
visibility: hidden;
opacity: 0;
transition: opacity 0.4s, visibility 0s 0.4s;
}
/* Use to transition & make visible */
.modal.show {
top: 0;
opacity: 1;
visibility: visible;
transition: top 0.4s, opacity 0.4s;
}
/* Modal Content Box */
.modal-content {
background-color: #fefefe;
margin: 5px 150px; /* from the top and left */
border: 1px solid #888;
width: 30%; /* Could be more or less, depending on screen size */
}
/* The Close Button */
.close {
/* Position it in the top right corner outside of the modal */
position: absolute;
right: 25px;
top: 0;
color: #000;
font-size: 35px;
font-weight: bold;
transition: top 0.4s, opacity 0.4s;
}
/* Close button on hover */
.close:hover,
.close:focus {
color: red;
cursor: pointer;
}
/* Change styles for span and cancel button on extra small screens */
@media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
.cancelbtn {
width: 100%;
}
}
/* END of The Login Modal CSS */
@keyframes growonce {
0% {
transform: scale(.5,.5) translate(15vw,0);

18
frontend/css/login.svg Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="50.000000pt" height="50.000000pt" viewBox="0 0 50.000000 50.000000"
preserveAspectRatio="xMidYMid meet">
<g transform="translate(0.000000,50.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M155 456 c-60 -28 -87 -56 -114 -116 -36 -79 -19 -183 42 -249 33
-36 115 -71 167 -71 82 0 185 66 205 131 12 35 1 30 -35 -19 -43 -57 -83 -81
-148 -89 -196 -23 -311 223 -166 359 100 94 268 66 330 -54 17 -33 30 -32 19
1 -20 65 -123 131 -205 131 -26 0 -66 -10 -95 -24z"/>
<path d="M190 295 l-44 -45 46 -47 c26 -26 51 -44 54 -40 4 4 -8 23 -26 42
l-34 35 147 0 c91 0 147 4 147 10 0 6 -56 10 -147 10 l-147 0 32 33 c18 18 32
36 32 40 0 16 -18 4 -60 -38z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 890 B

View File

@ -17,6 +17,39 @@
<img class="file-button" src="css/folder.svg"/>
</a>
<img class="full-main" onclick="fullscreen()" src="css/fullscreen.svg"/>
<!-- Button to open the modal login form -->
<img class="login-form-button" onclick="openModal()" src="css/login.svg"></img>
<!-- The Modal -->
<div id="loginmodal" class="modal">
<span class="close" onclick="closeModal()" title="Close Modal">&times;</span>
<!-- Modal Content -->
<form class="modal-content" action="js/loginhandler.js">
<div class="imgcontainer">
<!-- <img src="icon.png" alt="Avatar" class="avatar"> -->
</div>
<div class="container">
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="submit">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
<div class="container" style="background-color:#f1f1f1">
<button type="button" class="cancelbtn" onclick="closeModal()">Cancel</button>
</div>
</form>
</div>
<!-- END of Modal Content -->
<video autoplay muted loop id="bgvid">
<source id="vid" type="video/mp4">
</video>
@ -28,5 +61,15 @@
</div>
<div id="games-list" class="hidden"></div>
</div>
<script>
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
var modal = document.getElementById('loginmodal');
if (event.target == modal) {
closeModal();
}
}
</script>
</body>
</html>

View File

@ -632,6 +632,18 @@ function fullscreen() {
}
}
// Open the login modal
function openModal() {
let modal = document.getElementById('loginmodal');
modal.classList.add('show');
}
// Close the login modal
function closeModal() {
let modal = document.getElementById('loginmodal');
modal.classList.remove('show');
}
// Load the json profile selected
async function loadjson(name, active_item) {
if (name == 'preview') {

View File