You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
913 B
JavaScript

"use strict";
/******************************************************************************
* Handling navbar clicks and updating navbar
*/
/** Show main list of all stories when click site name */
function navAllStories(evt) {
console.debug("navAllStories", evt);
evt.preventDefault();
hidePageComponents();
putStoriesOnPage();
}
$body.on("click", "#nav-all", navAllStories);
/** Show login/signup on click on "login" */
function navLoginClick(evt) {
console.debug("navLoginClick", evt);
evt.preventDefault();
hidePageComponents();
$loginForm.show();
$signupForm.show();
}
$navLogin.on("click", navLoginClick);
/** When a user first logins in, update the navbar to reflect that. */
function updateNavOnLogin() {
console.debug("updateNavOnLogin");
$(".main-nav-links").show();
$navLogin.hide();
$navLogOut.show();
$navUserProfile.text(`${currentUser.username}`).show();
}