Galaxies Consulting Blog Prototype with JavaScript

by ThinkerMickey

HTML

<!-- Welcome to review my little projetc -->
<h1>Galaxies Consulting BLOG</h1>


<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.9.1/firebase-app.js"></script>

<!-- TODO: Add SDKs for Firebase products that you want to use
     https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.9.1/firebase-analytics.js"></script>

<script>
  // Your web app's Firebase configuration
  // For Firebase JS SDK v7.20.0 and later, measurementId is optional
  var firebaseConfig = {
    apiKey: "AIzaSyAg5qluqaX7efLk8l4N86KXQaEgAi9aNHQ",
    authDomain: "galaxies-consulting-blog.firebaseapp.com",
    projectId: "galaxies-consulting-blog",
    storageBucket: "galaxies-consulting-blog.appspot.com",
    messagingSenderId: "1090838647742",
    appId: "1:1090838647742:web:5f63f86029fed0aa669fef",
    measurementId: "G-6EF8RR9KZ2"
  };
  // Initialize Firebase
  firebase.initializeApp(firebaseConfig);
  firebase.analytics();
</script>


<!-- Navigation -->
<nav class="navigation">
  <div class="topnav">
    <a href="#home">Home</a>
    <a href="#Activities">Activities</a>
    <a href="#Login">Login</a>
    
      <!-- Login -->
      <div id="login-content">
      <form id='login-form' method='post' onsubmit="return false">
        <input type="text" placeholder="Email" id="login_email" required>
        <input type="password" placeholder="Password" id="login_pwd" required>
        <button type='submit'>Log In</button>
        <a id='forgotten-link'>Forgot Password?</a>
      </form>
    </div>
  </div>
</nav>    

<!--content of the blog -->
<h2 style=""><a id="Home">HOME</a></h2>
    <div class="numbertext"></div>
       <img src="http://drive.google.com/uc?export=view&id=1Lnf37Zya6QIADg3wfBCGnAj2bcnQ8Lys" alt="PCB board" style="width:100%">
    
    <h3>History </h3>
    <p> Founded in 2016, we are a Non Profit Organisation of students and...

CSS

/* Reset default style */
/* Thank you for reviewing my code Hope you have a good day */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial;
}

.navigation {
  background: lightblue;
}

.topnav {
  background-color: #3385;
  overflow: hidden;
}

/* Style the links inside the navigation bar */
.topnav a {
  float: left;
  color: yellow;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
}

/* Change the color of links on hover */
.topnav a:hover {
  background-color: #ddd;
  color: black;
}

/* Add a color to the active/current link */
.topnav a.active {
  background-color: #04AA6D;
  color: white;
}

.slideshow-container {
  max-width: 1000px;
  position: relative;
  margin: auto;
}

/* Hide the images by default */
.mySlides {
  display: none;
}

/* On hover, add a black background color with a little bit see-through */
.prev:hover,
.next:hover {
  background-color: rgba(0, 0, 2, 0.8);
}

/* Caption text */
.text {
  color: #f8f2f2;
  font-size: 15px;
  padding: 8px 12px;
  position: absolute;
  bottom: 8px;
  width: 100%;
  text-align: center;
}

/* Number text (1/3 etc) */
.numbertext {
  color: #f2f2f2;
  font-size: 12px;
  padding: 8px 12px;
  position: absolute;
  top: 0;
}

/* The dots/bullets/indicators */
.dot {
  cursor: pointer;
  height: 15px;
  width: 15px;
  margin: 0 2px;
  background-color: #bbb;
  border-radius: 50%;
  display: inline-block;
  transition: background-color 0.6s ease;
}

.active,
.dot:hover {
  background-color: #717171;
}

/* Fading animation */
.fade {
  -webkit-animation-name: fade;
  -webkit-animation-duration: 1.5s;
  animation-name: fade;
  animation-duration: 1.5s;
}

@-webkit-keyframes fade {
  from {
    opacity: .4
  }

  to {
    opacity: 1
  }
}

@keyframes fade {
  from {
    opacity: .4
  }

  to {
    opacity: 1
  }
}

.column {
  float: left;
  width: 33.3%;
  margin-bottom: 16px;
  padding: 0 8px;
}

.card {
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0,...

JavaScript

//Code That Deals with Transitioning the State of the Log In/Auth Pane
  $('#login-form').toggle();
});

$('#forgotten-link').click(function() {
  $('#forgotten-form').show();
  $('#before-reset').show();
  $('#login-form').hide();
});

$('#login-link-modal').click(function() {
  $("#after-reset").hide();
  $('#login-form').show();
});


$('#login-trigger').click(function() {
  handle_auth();
});

//Code that deals with initial display for modal pane that deals with authentication and, for a user that's logged in, logging them out.
function handle_auth() {
  //The function below lets us know if/who is logged in- you can read more about it here: https://firebase.google.com/docs/auth/web/manage-users. 
  var user = firebase.auth().currentUser;
  console.log("dealing with " + user);

  if (!user) {
    //If there's no user (user var is null)  
    $('#login-content').toggle();
    //Reset/hide other forms and div's so the login page displays right.
    $('#register-form').hide();
    $('#before-reset').hide();
    $("#after-reset").hide();
    $("#if-error").hide();
    $('#login-form').show();
  } else {

//This listens for a submit event on the login form. For more on this type of event, see https://api.jquery.com/submit/. It then passes the inputs to the function you see below it. 
$('#login-form').submit(function() {
  // pass the login email and pwd to our login handler function (below)
  login_user($('#login_email').val(), $('#login_pwd').val());
});

function login_user(email, pwd) {
  console.log("attempting to login user " + email);

  // use the Firebase API to sign in the user
  firebase.auth().signInWithEmailAndPassword(email, pwd).then(function(user) {
    //clear the form inputs 
    $("#login-form input[type=text], input[type=password]").val('');
    //deal with errors
  }, function(error) {
    // Handle Errors here.
    var errorCode = error.code;
    var errorMessage = error.message;
    alert("Reminder: This is a stand-alone system you need to...