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.
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
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();
|
|
}
|
|
|
|
/** Show story submission form on click on "submit" */
|
|
function navSubmitClick(evt) {
|
|
console.debug("navSubmitClick", evt);
|
|
evt.preventDefault();
|
|
hidePageComponents();
|
|
$addStoryForm.show();
|
|
}
|
|
|
|
$navSubmit.on("click", navSubmitClick);
|